##// END OF EJS Templates
histedit-test: ensure that non commute test will never commute...
Pierre-Yves David -
r17646:d44731a3 default
parent child Browse files
Show More
@@ -6,79 +6,95 b''
6 6 > histedit=
7 7 > EOF
8 8
9 $ EDITED="$TESTTMP/editedhistory"
10 $ cat > $EDITED <<EOF
11 > pick 177f92b77385 c
12 > pick 055a42cdd887 d
13 > fold bfa474341cc9 does not commute with e
14 > pick e860deea161a e
15 > pick 652413bf663e f
16 > EOF
17 9 $ initrepo ()
18 10 > {
19 11 > hg init $1
20 12 > cd $1
21 13 > for x in a b c d e f ; do
14 > echo $x$x$x$x$x > $x
15 > hg add $x
16 > done
17 > hg ci -m 'Initial commit'
18 > for x in a b c d e f ; do
22 19 > echo $x > $x
23 > hg add $x
24 20 > hg ci -m $x
25 21 > done
26 > echo a >> e
22 > echo 'I can haz no commute' > e
27 23 > hg ci -m 'does not commute with e'
28 24 > cd ..
29 25 > }
30 26
31 27 $ initrepo r
32 28 $ cd r
29 Initial generation of the command files
30
31 $ EDITED="$TESTTMP/editedhistory"
32 $ hg log --template 'pick {node|short} {rev} {desc}\n' -r 3 >> $EDITED
33 $ hg log --template 'pick {node|short} {rev} {desc}\n' -r 4 >> $EDITED
34 $ hg log --template 'fold {node|short} {rev} {desc}\n' -r 7 >> $EDITED
35 $ hg log --template 'pick {node|short} {rev} {desc}\n' -r 5 >> $EDITED
36 $ hg log --template 'pick {node|short} {rev} {desc}\n' -r 6 >> $EDITED
37 $ cat $EDITED
38 pick 65a9a84f33fd 3 c
39 pick 00f1c5383965 4 d
40 fold 39522b764e3d 7 does not commute with e
41 pick 7b4e2f4b7bcd 5 e
42 pick 500cac37a696 6 f
33 43
34 44 log before edit
35 45 $ hg log --graph
36 @ changeset: 6:bfa474341cc9
46 @ changeset: 7:39522b764e3d
37 47 | tag: tip
38 48 | user: test
39 49 | date: Thu Jan 01 00:00:00 1970 +0000
40 50 | summary: does not commute with e
41 51 |
42 o changeset: 5:652413bf663e
52 o changeset: 6:500cac37a696
43 53 | user: test
44 54 | date: Thu Jan 01 00:00:00 1970 +0000
45 55 | summary: f
46 56 |
47 o changeset: 4:e860deea161a
57 o changeset: 5:7b4e2f4b7bcd
48 58 | user: test
49 59 | date: Thu Jan 01 00:00:00 1970 +0000
50 60 | summary: e
51 61 |
52 o changeset: 3:055a42cdd887
62 o changeset: 4:00f1c5383965
53 63 | user: test
54 64 | date: Thu Jan 01 00:00:00 1970 +0000
55 65 | summary: d
56 66 |
57 o changeset: 2:177f92b77385
67 o changeset: 3:65a9a84f33fd
58 68 | user: test
59 69 | date: Thu Jan 01 00:00:00 1970 +0000
60 70 | summary: c
61 71 |
62 o changeset: 1:d2ae7f538514
72 o changeset: 2:da6535b52e45
63 73 | user: test
64 74 | date: Thu Jan 01 00:00:00 1970 +0000
65 75 | summary: b
66 76 |
67 o changeset: 0:cb9a9f314b8b
77 o changeset: 1:c1f09da44841
78 | user: test
79 | date: Thu Jan 01 00:00:00 1970 +0000
80 | summary: a
81 |
82 o changeset: 0:1715188a53c7
68 83 user: test
69 84 date: Thu Jan 01 00:00:00 1970 +0000
70 summary: a
85 summary: Initial commit
71 86
72 87
73 88 edit the history
74 $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
75 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
89 $ HGEDITOR="cat \"$EDITED\" > " hg histedit 3 2>&1 | fixbundle
90 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
91 patching file e
92 Hunk #1 FAILED at 0
76 93 1 out of 1 hunks FAILED -- saving rejects to file e.rej
77 94 abort: Fix up the change and run hg histedit --continue
78 95
79 96 fix up
80 97 $ echo a > e
81 $ hg add e
82 98 $ cat > cat.py <<EOF
83 99 > import sys
84 100 > print open(sys.argv[1]).read()
@@ -86,6 +102,7 b' fix up'
86 102 > print
87 103 > EOF
88 104 $ HGEDITOR="python cat.py" hg histedit --continue 2>&1 | fixbundle | grep -v '2 files removed'
105 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
89 106 d
90 107 ***
91 108 does not commute with e
@@ -104,7 +121,8 b' fix up'
104 121
105 122 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
106 123 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
107 file e already exists
124 patching file e
125 Hunk #1 FAILED at 0
108 126 1 out of 1 hunks FAILED -- saving rejects to file e.rej
109 127 abort: Fix up the change and run hg histedit --continue
110 128
@@ -115,31 +133,36 b' just continue this time'
115 133
116 134 log after edit
117 135 $ hg log --graph
118 @ changeset: 4:f768fd60ca34
136 @ changeset: 5:45bd04206744
119 137 | tag: tip
120 138 | user: test
121 139 | date: Thu Jan 01 00:00:00 1970 +0000
122 140 | summary: f
123 141 |
124 o changeset: 3:671efe372e33
142 o changeset: 4:abff6367c13a
125 143 | user: test
126 144 | date: Thu Jan 01 00:00:00 1970 +0000
127 145 | summary: d
128 146 |
129 o changeset: 2:177f92b77385
147 o changeset: 3:65a9a84f33fd
130 148 | user: test
131 149 | date: Thu Jan 01 00:00:00 1970 +0000
132 150 | summary: c
133 151 |
134 o changeset: 1:d2ae7f538514
152 o changeset: 2:da6535b52e45
135 153 | user: test
136 154 | date: Thu Jan 01 00:00:00 1970 +0000
137 155 | summary: b
138 156 |
139 o changeset: 0:cb9a9f314b8b
157 o changeset: 1:c1f09da44841
158 | user: test
159 | date: Thu Jan 01 00:00:00 1970 +0000
160 | summary: a
161 |
162 o changeset: 0:1715188a53c7
140 163 user: test
141 164 date: Thu Jan 01 00:00:00 1970 +0000
142 summary: a
165 summary: Initial commit
143 166
144 167
145 168 contents of e
@@ -6,24 +6,20 b''
6 6 > histedit=
7 7 > EOF
8 8
9 $ EDITED="$TESTTMP/editedhistory"
10 $ cat > $EDITED <<EOF
11 > pick 177f92b77385 c
12 > pick 055a42cdd887 d
13 > pick bfa474341cc9 does not commute with e
14 > pick e860deea161a e
15 > pick 652413bf663e f
16 > EOF
17 9 $ initrepo ()
18 10 > {
19 11 > hg init $1
20 12 > cd $1
21 13 > for x in a b c d e f ; do
14 > echo $x$x$x$x$x > $x
15 > hg add $x
16 > done
17 > hg ci -m 'Initial commit'
18 > for x in a b c d e f ; do
22 19 > echo $x > $x
23 > hg add $x
24 20 > hg ci -m $x
25 21 > done
26 > echo a >> e
22 > echo 'I can haz no commute' > e
27 23 > hg ci -m 'does not commute with e'
28 24 > cd ..
29 25 > }
@@ -31,48 +27,70 b''
31 27 $ initrepo r1
32 28 $ cd r1
33 29
30 Initial generation of the command files
31
32 $ EDITED="$TESTTMP/editedhistory"
33 $ hg log --template 'pick {node|short} {rev} {desc}\n' -r 3 >> $EDITED
34 $ hg log --template 'pick {node|short} {rev} {desc}\n' -r 4 >> $EDITED
35 $ hg log --template 'pick {node|short} {rev} {desc}\n' -r 7 >> $EDITED
36 $ hg log --template 'pick {node|short} {rev} {desc}\n' -r 5 >> $EDITED
37 $ hg log --template 'pick {node|short} {rev} {desc}\n' -r 6 >> $EDITED
38 $ cat $EDITED
39 pick 65a9a84f33fd 3 c
40 pick 00f1c5383965 4 d
41 pick 39522b764e3d 7 does not commute with e
42 pick 7b4e2f4b7bcd 5 e
43 pick 500cac37a696 6 f
44
34 45 log before edit
35 46 $ hg log --graph
36 @ changeset: 6:bfa474341cc9
47 @ changeset: 7:39522b764e3d
37 48 | tag: tip
38 49 | user: test
39 50 | date: Thu Jan 01 00:00:00 1970 +0000
40 51 | summary: does not commute with e
41 52 |
42 o changeset: 5:652413bf663e
53 o changeset: 6:500cac37a696
43 54 | user: test
44 55 | date: Thu Jan 01 00:00:00 1970 +0000
45 56 | summary: f
46 57 |
47 o changeset: 4:e860deea161a
58 o changeset: 5:7b4e2f4b7bcd
48 59 | user: test
49 60 | date: Thu Jan 01 00:00:00 1970 +0000
50 61 | summary: e
51 62 |
52 o changeset: 3:055a42cdd887
63 o changeset: 4:00f1c5383965
53 64 | user: test
54 65 | date: Thu Jan 01 00:00:00 1970 +0000
55 66 | summary: d
56 67 |
57 o changeset: 2:177f92b77385
68 o changeset: 3:65a9a84f33fd
58 69 | user: test
59 70 | date: Thu Jan 01 00:00:00 1970 +0000
60 71 | summary: c
61 72 |
62 o changeset: 1:d2ae7f538514
73 o changeset: 2:da6535b52e45
63 74 | user: test
64 75 | date: Thu Jan 01 00:00:00 1970 +0000
65 76 | summary: b
66 77 |
67 o changeset: 0:cb9a9f314b8b
78 o changeset: 1:c1f09da44841
79 | user: test
80 | date: Thu Jan 01 00:00:00 1970 +0000
81 | summary: a
82 |
83 o changeset: 0:1715188a53c7
68 84 user: test
69 85 date: Thu Jan 01 00:00:00 1970 +0000
70 summary: a
86 summary: Initial commit
71 87
72 88
73 89 edit the history
74 $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
75 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
90 $ HGEDITOR="cat \"$EDITED\" > " hg histedit 3 2>&1 | fixbundle
91 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
92 patching file e
93 Hunk #1 FAILED at 0
76 94 1 out of 1 hunks FAILED -- saving rejects to file e.rej
77 95 abort: Fix up the change and run hg histedit --continue
78 96
@@ -84,55 +102,62 b' abort the edit'
84 102 second edit set
85 103
86 104 $ hg log --graph
87 @ changeset: 6:bfa474341cc9
105 @ changeset: 7:39522b764e3d
88 106 | tag: tip
89 107 | user: test
90 108 | date: Thu Jan 01 00:00:00 1970 +0000
91 109 | summary: does not commute with e
92 110 |
93 o changeset: 5:652413bf663e
111 o changeset: 6:500cac37a696
94 112 | user: test
95 113 | date: Thu Jan 01 00:00:00 1970 +0000
96 114 | summary: f
97 115 |
98 o changeset: 4:e860deea161a
116 o changeset: 5:7b4e2f4b7bcd
99 117 | user: test
100 118 | date: Thu Jan 01 00:00:00 1970 +0000
101 119 | summary: e
102 120 |
103 o changeset: 3:055a42cdd887
121 o changeset: 4:00f1c5383965
104 122 | user: test
105 123 | date: Thu Jan 01 00:00:00 1970 +0000
106 124 | summary: d
107 125 |
108 o changeset: 2:177f92b77385
126 o changeset: 3:65a9a84f33fd
109 127 | user: test
110 128 | date: Thu Jan 01 00:00:00 1970 +0000
111 129 | summary: c
112 130 |
113 o changeset: 1:d2ae7f538514
131 o changeset: 2:da6535b52e45
114 132 | user: test
115 133 | date: Thu Jan 01 00:00:00 1970 +0000
116 134 | summary: b
117 135 |
118 o changeset: 0:cb9a9f314b8b
136 o changeset: 1:c1f09da44841
137 | user: test
138 | date: Thu Jan 01 00:00:00 1970 +0000
139 | summary: a
140 |
141 o changeset: 0:1715188a53c7
119 142 user: test
120 143 date: Thu Jan 01 00:00:00 1970 +0000
121 summary: a
144 summary: Initial commit
122 145
123 146
124 147 edit the history
125 $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
126 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
148 $ HGEDITOR="cat \"$EDITED\" > " hg histedit 3 2>&1 | fixbundle
149 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
150 patching file e
151 Hunk #1 FAILED at 0
127 152 1 out of 1 hunks FAILED -- saving rejects to file e.rej
128 153 abort: Fix up the change and run hg histedit --continue
129 154
130 155 fix up
131 $ echo a > e
132 $ hg add e
156 $ echo 'I can haz no commute' > e
133 157 $ hg histedit --continue 2>&1 | fixbundle
134 158 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
135 file e already exists
159 patching file e
160 Hunk #1 FAILED at 0
136 161 1 out of 1 hunks FAILED -- saving rejects to file e.rej
137 162 abort: Fix up the change and run hg histedit --continue
138 163
@@ -143,36 +168,41 b' just continue this time'
143 168
144 169 log after edit
145 170 $ hg log --graph
146 @ changeset: 5:9ab84894b459
171 @ changeset: 6:8e082d1a72ea
147 172 | tag: tip
148 173 | user: test
149 174 | date: Thu Jan 01 00:00:00 1970 +0000
150 175 | summary: f
151 176 |
152 o changeset: 4:1fff3ae8199d
177 o changeset: 5:13b04d775b81
153 178 | user: test
154 179 | date: Thu Jan 01 00:00:00 1970 +0000
155 180 | summary: does not commute with e
156 181 |
157 o changeset: 3:055a42cdd887
182 o changeset: 4:00f1c5383965
158 183 | user: test
159 184 | date: Thu Jan 01 00:00:00 1970 +0000
160 185 | summary: d
161 186 |
162 o changeset: 2:177f92b77385
187 o changeset: 3:65a9a84f33fd
163 188 | user: test
164 189 | date: Thu Jan 01 00:00:00 1970 +0000
165 190 | summary: c
166 191 |
167 o changeset: 1:d2ae7f538514
192 o changeset: 2:da6535b52e45
168 193 | user: test
169 194 | date: Thu Jan 01 00:00:00 1970 +0000
170 195 | summary: b
171 196 |
172 o changeset: 0:cb9a9f314b8b
197 o changeset: 1:c1f09da44841
198 | user: test
199 | date: Thu Jan 01 00:00:00 1970 +0000
200 | summary: a
201 |
202 o changeset: 0:1715188a53c7
173 203 user: test
174 204 date: Thu Jan 01 00:00:00 1970 +0000
175 summary: a
205 summary: Initial commit
176 206
177 207
178 208 start over
@@ -181,25 +211,32 b' start over'
181 211
182 212 $ initrepo r2
183 213 $ cd r2
184 $ cat > $EDITED <<EOF
185 > pick 177f92b77385 c
186 > pick 055a42cdd887 d
187 > mess bfa474341cc9 does not commute with e
188 > pick e860deea161a e
189 > pick 652413bf663e f
190 > EOF
214 $ rm $EDITED
215 $ hg log --template 'pick {node|short} {rev} {desc}\n' -r 3 >> $EDITED
216 $ hg log --template 'pick {node|short} {rev} {desc}\n' -r 4 >> $EDITED
217 $ hg log --template 'mess {node|short} {rev} {desc}\n' -r 7 >> $EDITED
218 $ hg log --template 'pick {node|short} {rev} {desc}\n' -r 5 >> $EDITED
219 $ hg log --template 'pick {node|short} {rev} {desc}\n' -r 6 >> $EDITED
220 $ cat $EDITED
221 pick 65a9a84f33fd 3 c
222 pick 00f1c5383965 4 d
223 mess 39522b764e3d 7 does not commute with e
224 pick 7b4e2f4b7bcd 5 e
225 pick 500cac37a696 6 f
191 226
192 227 edit the history, this time with a fold action
193 $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
194 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
228 $ HGEDITOR="cat \"$EDITED\" > " hg histedit 3 2>&1 | fixbundle
229 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
230 patching file e
231 Hunk #1 FAILED at 0
195 232 1 out of 1 hunks FAILED -- saving rejects to file e.rej
196 233 abort: Fix up the change and run hg histedit --continue
197 234
198 $ echo a > e
199 $ hg add e
235 $ echo 'I can haz no commute' > e
200 236 $ HGEDITOR="cat \"$EDITED\" > " hg histedit --continue 2>&1 | fixbundle
201 237 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
202 file e already exists
238 patching file e
239 Hunk #1 FAILED at 0
203 240 1 out of 1 hunks FAILED -- saving rejects to file e.rej
204 241 abort: Fix up the change and run hg histedit --continue
205 242 second edit also fails, but just continue
@@ -209,36 +246,41 b' second edit also fails, but just continu'
209 246
210 247 post message fix
211 248 $ hg log --graph
212 @ changeset: 5:6459970fb49b
249 @ changeset: 6:f14da722aa4b
213 250 | tag: tip
214 251 | user: test
215 252 | date: Thu Jan 01 00:00:00 1970 +0000
216 253 | summary: f
217 254 |
218 o changeset: 4:556f27c874b0
255 o changeset: 5:382ff1adf0ed
219 256 | user: test
220 257 | date: Thu Jan 01 00:00:00 1970 +0000
221 | summary: pick 177f92b77385 c
258 | summary: pick 65a9a84f33fd 3 c
222 259 |
223 o changeset: 3:055a42cdd887
260 o changeset: 4:00f1c5383965
224 261 | user: test
225 262 | date: Thu Jan 01 00:00:00 1970 +0000
226 263 | summary: d
227 264 |
228 o changeset: 2:177f92b77385
265 o changeset: 3:65a9a84f33fd
229 266 | user: test
230 267 | date: Thu Jan 01 00:00:00 1970 +0000
231 268 | summary: c
232 269 |
233 o changeset: 1:d2ae7f538514
270 o changeset: 2:da6535b52e45
234 271 | user: test
235 272 | date: Thu Jan 01 00:00:00 1970 +0000
236 273 | summary: b
237 274 |
238 o changeset: 0:cb9a9f314b8b
275 o changeset: 1:c1f09da44841
276 | user: test
277 | date: Thu Jan 01 00:00:00 1970 +0000
278 | summary: a
279 |
280 o changeset: 0:1715188a53c7
239 281 user: test
240 282 date: Thu Jan 01 00:00:00 1970 +0000
241 summary: a
283 summary: Initial commit
242 284
243 285
244 286 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now