##// END OF EJS Templates
tests: histedit-helpers fixbundle should not complain about no input
timeless -
r27350:89027334 default
parent child Browse files
Show More
@@ -1,6 +1,7
1 fixbundle() {
1 fixbundle() {
2 grep -v 'saving bundle' | grep -v 'saved backup' | \
2 grep -v 'saving bundle' | grep -v 'saved backup' | \
3 grep -v added | grep -v adding | \
3 grep -v added | grep -v adding | \
4 grep -v "unable to find 'e' for patching" | \
4 grep -v "unable to find 'e' for patching" | \
5 grep -v "e: No such file or directory"
5 grep -v "e: No such file or directory" | \
6 cat
6 }
7 }
@@ -1,212 +1,211
1 test for old histedit issue #6:
1 test for old histedit issue #6:
2 editing a changeset without any actual change would corrupt the repository
2 editing a changeset without any actual change would corrupt the repository
3
3
4 $ . "$TESTDIR/histedit-helpers.sh"
4 $ . "$TESTDIR/histedit-helpers.sh"
5
5
6 $ cat >> $HGRCPATH <<EOF
6 $ cat >> $HGRCPATH <<EOF
7 > [extensions]
7 > [extensions]
8 > histedit=
8 > histedit=
9 > EOF
9 > EOF
10
10
11 $ initrepo ()
11 $ initrepo ()
12 > {
12 > {
13 > dir="$1"
13 > dir="$1"
14 > comment="$2"
14 > comment="$2"
15 > if [ -n "${comment}" ]; then
15 > if [ -n "${comment}" ]; then
16 > echo % ${comment}
16 > echo % ${comment}
17 > echo % ${comment} | sed 's:.:-:g'
17 > echo % ${comment} | sed 's:.:-:g'
18 > fi
18 > fi
19 > hg init ${dir}
19 > hg init ${dir}
20 > cd ${dir}
20 > cd ${dir}
21 > for x in a b c d e f ; do
21 > for x in a b c d e f ; do
22 > echo $x > $x
22 > echo $x > $x
23 > hg add $x
23 > hg add $x
24 > hg ci -m $x
24 > hg ci -m $x
25 > done
25 > done
26 > cd ..
26 > cd ..
27 > }
27 > }
28
28
29 $ geneditor ()
29 $ geneditor ()
30 > {
30 > {
31 > # generate an editor script for selecting changesets to be edited
31 > # generate an editor script for selecting changesets to be edited
32 > choice=$1 # changesets that should be edited (using sed line ranges)
32 > choice=$1 # changesets that should be edited (using sed line ranges)
33 > cat <<EOF | sed 's:^....::'
33 > cat <<EOF | sed 's:^....::'
34 > # editing the rules, replacing 'pick' with 'edit' for the chosen lines
34 > # editing the rules, replacing 'pick' with 'edit' for the chosen lines
35 > sed '${choice}s:^pick:edit:' "\$1" > "\${1}.tmp"
35 > sed '${choice}s:^pick:edit:' "\$1" > "\${1}.tmp"
36 > mv "\${1}.tmp" "\$1"
36 > mv "\${1}.tmp" "\$1"
37 > # displaying the resulting rules, minus comments and empty lines
37 > # displaying the resulting rules, minus comments and empty lines
38 > sed '/^#/d;/^$/d;s:^:| :' "\$1" >&2
38 > sed '/^#/d;/^$/d;s:^:| :' "\$1" >&2
39 > EOF
39 > EOF
40 > }
40 > }
41
41
42 $ startediting ()
42 $ startediting ()
43 > {
43 > {
44 > # begin an editing session
44 > # begin an editing session
45 > choice="$1" # changesets that should be edited
45 > choice="$1" # changesets that should be edited
46 > number="$2" # number of changesets considered (from tip)
46 > number="$2" # number of changesets considered (from tip)
47 > comment="$3"
47 > comment="$3"
48 > geneditor "${choice}" > edit.sh
48 > geneditor "${choice}" > edit.sh
49 > echo % start editing the history ${comment}
49 > echo % start editing the history ${comment}
50 > HGEDITOR="sh ./edit.sh" hg histedit -- -${number} 2>&1 | fixbundle
50 > HGEDITOR="sh ./edit.sh" hg histedit -- -${number} 2>&1 | fixbundle
51 > }
51 > }
52
52
53 $ continueediting ()
53 $ continueediting ()
54 > {
54 > {
55 > # continue an edit already in progress
55 > # continue an edit already in progress
56 > editor="$1" # message editor when finalizing editing
56 > editor="$1" # message editor when finalizing editing
57 > comment="$2"
57 > comment="$2"
58 > echo % finalize changeset editing ${comment}
58 > echo % finalize changeset editing ${comment}
59 > HGEDITOR=${editor} hg histedit --continue 2>&1 | fixbundle
59 > HGEDITOR=${editor} hg histedit --continue 2>&1 | fixbundle
60 > }
60 > }
61
61
62 $ graphlog ()
62 $ graphlog ()
63 > {
63 > {
64 > comment="${1:-log}"
64 > comment="${1:-log}"
65 > echo % "${comment}"
65 > echo % "${comment}"
66 > hg log -G --template '{rev} {node} \"{desc|firstline}\"\n'
66 > hg log -G --template '{rev} {node} \"{desc|firstline}\"\n'
67 > }
67 > }
68
68
69
69
70 $ initrepo r1 "test editing with no change"
70 $ initrepo r1 "test editing with no change"
71 % test editing with no change
71 % test editing with no change
72 -----------------------------
72 -----------------------------
73 $ cd r1
73 $ cd r1
74 $ graphlog "log before editing"
74 $ graphlog "log before editing"
75 % log before editing
75 % log before editing
76 @ 5 652413bf663ef2a641cab26574e46d5f5a64a55a "f"
76 @ 5 652413bf663ef2a641cab26574e46d5f5a64a55a "f"
77 |
77 |
78 o 4 e860deea161a2f77de56603b340ebbb4536308ae "e"
78 o 4 e860deea161a2f77de56603b340ebbb4536308ae "e"
79 |
79 |
80 o 3 055a42cdd88768532f9cf79daa407fc8d138de9b "d"
80 o 3 055a42cdd88768532f9cf79daa407fc8d138de9b "d"
81 |
81 |
82 o 2 177f92b773850b59254aa5e923436f921b55483b "c"
82 o 2 177f92b773850b59254aa5e923436f921b55483b "c"
83 |
83 |
84 o 1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b"
84 o 1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b"
85 |
85 |
86 o 0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a"
86 o 0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a"
87
87
88 $ startediting 2 3 "(not changing anything)" # edit the 2nd of 3 changesets
88 $ startediting 2 3 "(not changing anything)" # edit the 2nd of 3 changesets
89 % start editing the history (not changing anything)
89 % start editing the history (not changing anything)
90 | pick 055a42cdd887 3 d
90 | pick 055a42cdd887 3 d
91 | edit e860deea161a 4 e
91 | edit e860deea161a 4 e
92 | pick 652413bf663e 5 f
92 | pick 652413bf663e 5 f
93 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
93 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
94 Make changes as needed, you may commit or record as needed now.
94 Make changes as needed, you may commit or record as needed now.
95 When you are finished, run hg histedit --continue to resume.
95 When you are finished, run hg histedit --continue to resume.
96 $ continueediting true "(leaving commit message unaltered)"
96 $ continueediting true "(leaving commit message unaltered)"
97 % finalize changeset editing (leaving commit message unaltered)
97 % finalize changeset editing (leaving commit message unaltered)
98 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
98 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
99 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
99 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
100
100
101
101
102 check state of working copy
102 check state of working copy
103 $ hg id
103 $ hg id
104 794fe033d0a0 tip
104 794fe033d0a0 tip
105
105
106 $ graphlog "log after history editing"
106 $ graphlog "log after history editing"
107 % log after history editing
107 % log after history editing
108 @ 5 794fe033d0a030f8df77c5de945fca35c9181c30 "f"
108 @ 5 794fe033d0a030f8df77c5de945fca35c9181c30 "f"
109 |
109 |
110 o 4 04d2fab980779f332dec458cc944f28de8b43435 "e"
110 o 4 04d2fab980779f332dec458cc944f28de8b43435 "e"
111 |
111 |
112 o 3 055a42cdd88768532f9cf79daa407fc8d138de9b "d"
112 o 3 055a42cdd88768532f9cf79daa407fc8d138de9b "d"
113 |
113 |
114 o 2 177f92b773850b59254aa5e923436f921b55483b "c"
114 o 2 177f92b773850b59254aa5e923436f921b55483b "c"
115 |
115 |
116 o 1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b"
116 o 1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b"
117 |
117 |
118 o 0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a"
118 o 0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a"
119
119
120
120
121 $ cd ..
121 $ cd ..
122
122
123 $ initrepo r2 "test editing with no change, then abort"
123 $ initrepo r2 "test editing with no change, then abort"
124 % test editing with no change, then abort
124 % test editing with no change, then abort
125 -----------------------------------------
125 -----------------------------------------
126 $ cd r2
126 $ cd r2
127 $ graphlog "log before editing"
127 $ graphlog "log before editing"
128 % log before editing
128 % log before editing
129 @ 5 652413bf663ef2a641cab26574e46d5f5a64a55a "f"
129 @ 5 652413bf663ef2a641cab26574e46d5f5a64a55a "f"
130 |
130 |
131 o 4 e860deea161a2f77de56603b340ebbb4536308ae "e"
131 o 4 e860deea161a2f77de56603b340ebbb4536308ae "e"
132 |
132 |
133 o 3 055a42cdd88768532f9cf79daa407fc8d138de9b "d"
133 o 3 055a42cdd88768532f9cf79daa407fc8d138de9b "d"
134 |
134 |
135 o 2 177f92b773850b59254aa5e923436f921b55483b "c"
135 o 2 177f92b773850b59254aa5e923436f921b55483b "c"
136 |
136 |
137 o 1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b"
137 o 1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b"
138 |
138 |
139 o 0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a"
139 o 0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a"
140
140
141 $ startediting 1,2 3 "(not changing anything)" # edit the 1st two of 3 changesets
141 $ startediting 1,2 3 "(not changing anything)" # edit the 1st two of 3 changesets
142 % start editing the history (not changing anything)
142 % start editing the history (not changing anything)
143 | edit 055a42cdd887 3 d
143 | edit 055a42cdd887 3 d
144 | edit e860deea161a 4 e
144 | edit e860deea161a 4 e
145 | pick 652413bf663e 5 f
145 | pick 652413bf663e 5 f
146 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
146 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
147 Make changes as needed, you may commit or record as needed now.
147 Make changes as needed, you may commit or record as needed now.
148 When you are finished, run hg histedit --continue to resume.
148 When you are finished, run hg histedit --continue to resume.
149 $ continueediting true "(leaving commit message unaltered)"
149 $ continueediting true "(leaving commit message unaltered)"
150 % finalize changeset editing (leaving commit message unaltered)
150 % finalize changeset editing (leaving commit message unaltered)
151 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
151 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
152 Make changes as needed, you may commit or record as needed now.
152 Make changes as needed, you may commit or record as needed now.
153 When you are finished, run hg histedit --continue to resume.
153 When you are finished, run hg histedit --continue to resume.
154 $ graphlog "log after first edit"
154 $ graphlog "log after first edit"
155 % log after first edit
155 % log after first edit
156 @ 6 e5ae3ca2f1ffdbd89ec41ebc273a231f7c3022f2 "d"
156 @ 6 e5ae3ca2f1ffdbd89ec41ebc273a231f7c3022f2 "d"
157 |
157 |
158 | o 5 652413bf663ef2a641cab26574e46d5f5a64a55a "f"
158 | o 5 652413bf663ef2a641cab26574e46d5f5a64a55a "f"
159 | |
159 | |
160 | o 4 e860deea161a2f77de56603b340ebbb4536308ae "e"
160 | o 4 e860deea161a2f77de56603b340ebbb4536308ae "e"
161 | |
161 | |
162 | o 3 055a42cdd88768532f9cf79daa407fc8d138de9b "d"
162 | o 3 055a42cdd88768532f9cf79daa407fc8d138de9b "d"
163 |/
163 |/
164 o 2 177f92b773850b59254aa5e923436f921b55483b "c"
164 o 2 177f92b773850b59254aa5e923436f921b55483b "c"
165 |
165 |
166 o 1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b"
166 o 1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b"
167 |
167 |
168 o 0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a"
168 o 0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a"
169
169
170
170
171 abort editing session, after first forcibly updating away
171 abort editing session, after first forcibly updating away
172 $ hg up 0
172 $ hg up 0
173 abort: histedit in progress
173 abort: histedit in progress
174 (use 'hg histedit --continue' or 'hg histedit --abort')
174 (use 'hg histedit --continue' or 'hg histedit --abort')
175 [255]
175 [255]
176 $ mv .hg/histedit-state .hg/histedit-state-ignore
176 $ mv .hg/histedit-state .hg/histedit-state-ignore
177 $ hg up 0
177 $ hg up 0
178 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
178 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
179 $ mv .hg/histedit-state-ignore .hg/histedit-state
179 $ mv .hg/histedit-state-ignore .hg/histedit-state
180 $ hg sum
180 $ hg sum
181 parent: 0:cb9a9f314b8b
181 parent: 0:cb9a9f314b8b
182 a
182 a
183 branch: default
183 branch: default
184 commit: 1 added, 1 unknown (new branch head)
184 commit: 1 added, 1 unknown (new branch head)
185 update: 6 new changesets (update)
185 update: 6 new changesets (update)
186 phases: 7 draft
186 phases: 7 draft
187 hist: 2 remaining (histedit --continue)
187 hist: 2 remaining (histedit --continue)
188
188
189 $ hg histedit --abort 2>&1 | fixbundle
189 $ hg histedit --abort 2>&1 | fixbundle
190 [1]
191
190
192 modified files should survive the abort when we've moved away already
191 modified files should survive the abort when we've moved away already
193 $ hg st
192 $ hg st
194 A e
193 A e
195 ? edit.sh
194 ? edit.sh
196
195
197 $ graphlog "log after abort"
196 $ graphlog "log after abort"
198 % log after abort
197 % log after abort
199 o 5 652413bf663ef2a641cab26574e46d5f5a64a55a "f"
198 o 5 652413bf663ef2a641cab26574e46d5f5a64a55a "f"
200 |
199 |
201 o 4 e860deea161a2f77de56603b340ebbb4536308ae "e"
200 o 4 e860deea161a2f77de56603b340ebbb4536308ae "e"
202 |
201 |
203 o 3 055a42cdd88768532f9cf79daa407fc8d138de9b "d"
202 o 3 055a42cdd88768532f9cf79daa407fc8d138de9b "d"
204 |
203 |
205 o 2 177f92b773850b59254aa5e923436f921b55483b "c"
204 o 2 177f92b773850b59254aa5e923436f921b55483b "c"
206 |
205 |
207 o 1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b"
206 o 1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b"
208 |
207 |
209 @ 0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a"
208 @ 0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a"
210
209
211
210
212 $ cd ..
211 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now