Show More
@@ -1,550 +1,576 b'' | |||
|
1 | 1 | #testcases obsstore-off obsstore-on |
|
2 | 2 | |
|
3 | 3 | $ cat << EOF >> $HGRCPATH |
|
4 | 4 | > [extensions] |
|
5 | 5 | > amend= |
|
6 | 6 | > debugdrawdag=$TESTDIR/drawdag.py |
|
7 | 7 | > [diff] |
|
8 | 8 | > git=1 |
|
9 | 9 | > EOF |
|
10 | 10 | |
|
11 | 11 | #if obsstore-on |
|
12 | 12 | $ cat << EOF >> $HGRCPATH |
|
13 | 13 | > [experimental] |
|
14 | 14 | > evolution.createmarkers=True |
|
15 | 15 | > EOF |
|
16 | 16 | #endif |
|
17 | 17 | |
|
18 | 18 | Basic amend |
|
19 | 19 | |
|
20 | 20 | $ hg init repo1 |
|
21 | 21 | $ cd repo1 |
|
22 | 22 | $ hg debugdrawdag <<'EOS' |
|
23 | 23 | > B |
|
24 | 24 | > | |
|
25 | 25 | > A |
|
26 | 26 | > EOS |
|
27 | 27 | |
|
28 | 28 | $ hg update B -q |
|
29 | 29 | $ echo 2 >> B |
|
30 | 30 | |
|
31 | 31 | $ hg amend |
|
32 | 32 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/112478962961-7e959a55-amend.hg (obsstore-off !) |
|
33 | 33 | #if obsstore-off |
|
34 | 34 | $ hg log -p -G --hidden -T '{rev} {node|short} {desc}\n' |
|
35 | 35 | @ 1 be169c7e8dbe B |
|
36 | 36 | | diff --git a/B b/B |
|
37 | 37 | | new file mode 100644 |
|
38 | 38 | | --- /dev/null |
|
39 | 39 | | +++ b/B |
|
40 | 40 | | @@ -0,0 +1,1 @@ |
|
41 | 41 | | +B2 |
|
42 | 42 | | |
|
43 | 43 | o 0 426bada5c675 A |
|
44 | 44 | diff --git a/A b/A |
|
45 | 45 | new file mode 100644 |
|
46 | 46 | --- /dev/null |
|
47 | 47 | +++ b/A |
|
48 | 48 | @@ -0,0 +1,1 @@ |
|
49 | 49 | +A |
|
50 | 50 | \ No newline at end of file |
|
51 | 51 | |
|
52 | 52 | #else |
|
53 | 53 | $ hg log -p -G --hidden -T '{rev} {node|short} {desc}\n' |
|
54 | 54 | @ 2 be169c7e8dbe B |
|
55 | 55 | | diff --git a/B b/B |
|
56 | 56 | | new file mode 100644 |
|
57 | 57 | | --- /dev/null |
|
58 | 58 | | +++ b/B |
|
59 | 59 | | @@ -0,0 +1,1 @@ |
|
60 | 60 | | +B2 |
|
61 | 61 | | |
|
62 | 62 | | x 1 112478962961 B |
|
63 | 63 | |/ diff --git a/B b/B |
|
64 | 64 | | new file mode 100644 |
|
65 | 65 | | --- /dev/null |
|
66 | 66 | | +++ b/B |
|
67 | 67 | | @@ -0,0 +1,1 @@ |
|
68 | 68 | | +B |
|
69 | 69 | | \ No newline at end of file |
|
70 | 70 | | |
|
71 | 71 | o 0 426bada5c675 A |
|
72 | 72 | diff --git a/A b/A |
|
73 | 73 | new file mode 100644 |
|
74 | 74 | --- /dev/null |
|
75 | 75 | +++ b/A |
|
76 | 76 | @@ -0,0 +1,1 @@ |
|
77 | 77 | +A |
|
78 | 78 | \ No newline at end of file |
|
79 | 79 | |
|
80 | 80 | #endif |
|
81 | 81 | |
|
82 | 82 | Nothing changed |
|
83 | 83 | |
|
84 | 84 | $ hg amend |
|
85 | 85 | nothing changed |
|
86 | 86 | [1] |
|
87 | 87 | |
|
88 | 88 | $ hg amend -d "0 0" |
|
89 | 89 | nothing changed |
|
90 | 90 | [1] |
|
91 | 91 | |
|
92 | 92 | $ hg amend -d "Thu Jan 01 00:00:00 1970 UTC" |
|
93 | 93 | nothing changed |
|
94 | 94 | [1] |
|
95 | 95 | |
|
96 | 96 | #if obsstore-on |
|
97 | 97 | $ hg init repo-merge-state |
|
98 | 98 | $ cd repo-merge-state |
|
99 | 99 | $ echo a > f |
|
100 | 100 | $ hg ci -Aqm a |
|
101 | 101 | $ echo b > f |
|
102 | 102 | $ hg ci -Aqm b |
|
103 | 103 | $ echo c > f |
|
104 | 104 | $ hg co -m '.^' |
|
105 | 105 | merging f |
|
106 | 106 | warning: conflicts while merging f! (edit, then use 'hg resolve --mark') |
|
107 | 107 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
108 | 108 | use 'hg resolve' to retry unresolved file merges |
|
109 | 109 | [1] |
|
110 | 110 | $ echo d > f |
|
111 | 111 | $ hg resolve -m f |
|
112 | 112 | (no more unresolved files) |
|
113 | 113 | $ hg ci --amend --config experimental.evolution.allowunstable=True |
|
114 | 114 | 1 new orphan changesets |
|
115 | 115 | $ hg resolve -l |
|
116 | 116 | $ cd .. |
|
117 | 117 | #endif |
|
118 | 118 | |
|
119 | 119 | Matcher and metadata options |
|
120 | 120 | |
|
121 | 121 | $ echo 3 > C |
|
122 | 122 | $ echo 4 > D |
|
123 | 123 | $ hg add C D |
|
124 | 124 | $ hg amend -m NEWMESSAGE -I C |
|
125 | 125 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/be169c7e8dbe-7684ddc5-amend.hg (obsstore-off !) |
|
126 | 126 | $ hg log -r . -T '{node|short} {desc} {files}\n' |
|
127 | 127 | c7ba14d9075b NEWMESSAGE B C |
|
128 | 128 | $ echo 5 > E |
|
129 | 129 | $ rm C |
|
130 | 130 | $ hg amend -d '2000 1000' -u 'Foo <foo@example.com>' -A C D |
|
131 | 131 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/c7ba14d9075b-b3e76daa-amend.hg (obsstore-off !) |
|
132 | 132 | $ hg log -r . -T '{node|short} {desc} {files} {author} {date}\n' |
|
133 | 133 | 14f6c4bcc865 NEWMESSAGE B D Foo <foo@example.com> 2000.01000 |
|
134 | 134 | |
|
135 | 135 | Amend with editor |
|
136 | 136 | |
|
137 | 137 | $ cat > $TESTTMP/prefix.sh <<'EOF' |
|
138 | 138 | > printf 'EDITED: ' > $TESTTMP/msg |
|
139 | 139 | > cat "$1" >> $TESTTMP/msg |
|
140 | 140 | > mv $TESTTMP/msg "$1" |
|
141 | 141 | > EOF |
|
142 | 142 | $ chmod +x $TESTTMP/prefix.sh |
|
143 | 143 | |
|
144 | 144 | $ HGEDITOR="sh $TESTTMP/prefix.sh" hg amend --edit |
|
145 | 145 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/14f6c4bcc865-6591f15d-amend.hg (obsstore-off !) |
|
146 | 146 | $ hg log -r . -T '{node|short} {desc}\n' |
|
147 | 147 | 298f085230c3 EDITED: NEWMESSAGE |
|
148 | 148 | $ HGEDITOR="sh $TESTTMP/prefix.sh" hg amend -e -m MSG |
|
149 | 149 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/298f085230c3-d81a6ad3-amend.hg (obsstore-off !) |
|
150 | 150 | $ hg log -r . -T '{node|short} {desc}\n' |
|
151 | 151 | 974f07f28537 EDITED: MSG |
|
152 | 152 | |
|
153 | 153 | $ echo FOO > $TESTTMP/msg |
|
154 | 154 | $ hg amend -l $TESTTMP/msg -m BAR |
|
155 | 155 | abort: cannot specify both --message and --logfile |
|
156 | 156 | [10] |
|
157 | 157 | $ hg amend -l $TESTTMP/msg |
|
158 | 158 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/974f07f28537-edb6470a-amend.hg (obsstore-off !) |
|
159 | 159 | $ hg log -r . -T '{node|short} {desc}\n' |
|
160 | 160 | 507be9bdac71 FOO |
|
161 | 161 | |
|
162 | 162 | Interactive mode |
|
163 | 163 | |
|
164 | 164 | $ touch F G |
|
165 | 165 | $ hg add F G |
|
166 | 166 | $ cat <<EOS | hg amend -i --config ui.interactive=1 |
|
167 | 167 | > y |
|
168 | 168 | > n |
|
169 | 169 | > EOS |
|
170 | 170 | diff --git a/F b/F |
|
171 | 171 | new file mode 100644 |
|
172 | 172 | examine changes to 'F'? |
|
173 | 173 | (enter ? for help) [Ynesfdaq?] y |
|
174 | 174 | |
|
175 | 175 | diff --git a/G b/G |
|
176 | 176 | new file mode 100644 |
|
177 | 177 | examine changes to 'G'? |
|
178 | 178 | (enter ? for help) [Ynesfdaq?] n |
|
179 | 179 | |
|
180 | 180 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/507be9bdac71-c8077452-amend.hg (obsstore-off !) |
|
181 | 181 | $ hg log -r . -T '{files}\n' |
|
182 | 182 | B D F |
|
183 | 183 | |
|
184 | 184 | Amend in the middle of a stack |
|
185 | 185 | |
|
186 | 186 | $ hg init $TESTTMP/repo2 |
|
187 | 187 | $ cd $TESTTMP/repo2 |
|
188 | 188 | $ hg debugdrawdag <<'EOS' |
|
189 | 189 | > C |
|
190 | 190 | > | |
|
191 | 191 | > B |
|
192 | 192 | > | |
|
193 | 193 | > A |
|
194 | 194 | > EOS |
|
195 | 195 | |
|
196 | 196 | $ hg update -q B |
|
197 | 197 | $ echo 2 >> B |
|
198 | 198 | $ hg amend |
|
199 | 199 | abort: cannot amend changeset, as that will orphan 1 descendants |
|
200 | 200 | (see 'hg help evolution.instability') |
|
201 | 201 | [10] |
|
202 | 202 | |
|
203 | 203 | #if obsstore-on |
|
204 | 204 | |
|
205 | 205 | With allowunstable, amend could work in the middle of a stack |
|
206 | 206 | |
|
207 | 207 | $ cat >> $HGRCPATH <<EOF |
|
208 | 208 | > [experimental] |
|
209 | 209 | > evolution.createmarkers=True |
|
210 | 210 | > evolution.allowunstable=True |
|
211 | 211 | > EOF |
|
212 | 212 | |
|
213 | 213 | $ hg amend |
|
214 | 214 | 1 new orphan changesets |
|
215 | 215 | $ hg log -T '{rev} {node|short} {desc}\n' -G |
|
216 | 216 | @ 3 be169c7e8dbe B |
|
217 | 217 | | |
|
218 | 218 | | * 2 26805aba1e60 C |
|
219 | 219 | | | |
|
220 | 220 | | x 1 112478962961 B |
|
221 | 221 | |/ |
|
222 | 222 | o 0 426bada5c675 A |
|
223 | 223 | |
|
224 | 224 | Checking the note stored in the obsmarker |
|
225 | 225 | |
|
226 | 226 | $ echo foo > bar |
|
227 | 227 | $ hg add bar |
|
228 | 228 | $ hg amend --note 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy' |
|
229 | 229 | abort: cannot store a note of more than 255 bytes |
|
230 | 230 | [10] |
|
231 | 231 | $ hg amend --note "adding bar" |
|
232 | 232 | $ hg debugobsolete -r . |
|
233 | 233 | 112478962961147124edd43549aedd1a335e44bf be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'} |
|
234 | 234 | be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 16084da537dd8f84cfdb3055c633772269d62e1b 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'note': 'adding bar', 'operation': 'amend', 'user': 'test'} |
|
235 | 235 | |
|
236 | 236 | Cannot cause divergence by default |
|
237 | 237 | |
|
238 | 238 | $ hg co --hidden 1 |
|
239 | 239 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
240 | 240 | $ hg amend -m divergent |
|
241 | 241 | abort: cannot amend 112478962961, as that creates content-divergence with 16084da537dd |
|
242 | 242 | (add --verbose for details or see 'hg help evolution.instability') |
|
243 | 243 | [10] |
|
244 | 244 | $ hg amend -m divergent --verbose |
|
245 | 245 | abort: cannot amend 112478962961, as that creates content-divergence with 16084da537dd |
|
246 | 246 | changeset 112478962961 already has a successor in changeset 16084da537dd |
|
247 | 247 | rewriting changeset 112478962961 would create "content-divergence" |
|
248 | 248 | set experimental.evolution.allowdivergence=True to skip this check |
|
249 | 249 | (see 'hg help evolution.instability' for details on content-divergence) |
|
250 | 250 | [10] |
|
251 | 251 | $ hg amend -m divergent --config experimental.evolution.allowdivergence=true |
|
252 | 252 | 2 new content-divergent changesets |
|
253 | ||
|
254 | Hidden common predecessor of divergence does not cause crash | |
|
255 | ||
|
256 | First create C1 as a pruned successor of C | |
|
257 | $ hg co C | |
|
258 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
259 | $ hg amend -m C1 | |
|
260 | $ hg tag --local C1 | |
|
261 | $ hg debugobsolete $(hg log -T '{node}' -r C1) | |
|
262 | 1 new obsolescence markers | |
|
263 | obsoleted 1 changesets | |
|
264 | Now create C2 as other side of divergence (not actually divergent because C1 is | |
|
265 | pruned) | |
|
266 | $ hg co C | |
|
267 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
268 | $ hg amend -m C2 | |
|
269 | 1 new orphan changesets | |
|
270 | Make the common predecessor (C) pruned | |
|
271 | $ hg tag --local --remove C | |
|
272 | $ hg co C1 | |
|
273 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
274 | Try to cause divergence | |
|
275 | $ hg amend -m C11 | |
|
276 | abort: filtered revision '26805aba1e600a82e93661149f2313866a221a7b' (known-bad-output !) | |
|
277 | [255] | |
|
278 | [10] | |
|
253 | 279 | #endif |
|
254 | 280 | |
|
255 | 281 | Cannot amend public changeset |
|
256 | 282 | |
|
257 | 283 | $ hg phase -r A --public |
|
258 | 284 | $ hg update -C -q A |
|
259 | 285 | $ hg amend -m AMEND |
|
260 | 286 | abort: cannot amend public changesets: 426bada5c675 |
|
261 | 287 | (see 'hg help phases' for details) |
|
262 | 288 | [10] |
|
263 | 289 | |
|
264 | 290 | Amend a merge changeset |
|
265 | 291 | |
|
266 | 292 | $ hg init $TESTTMP/repo3 |
|
267 | 293 | $ cd $TESTTMP/repo3 |
|
268 | 294 | $ hg debugdrawdag <<'EOS' |
|
269 | 295 | > C |
|
270 | 296 | > /| |
|
271 | 297 | > A B |
|
272 | 298 | > EOS |
|
273 | 299 | $ hg update -q C |
|
274 | 300 | $ hg amend -m FOO |
|
275 | 301 | saved backup bundle to $TESTTMP/repo3/.hg/strip-backup/a35c07e8a2a4-15ff4612-amend.hg (obsstore-off !) |
|
276 | 302 | $ rm .hg/localtags |
|
277 | 303 | $ hg log -G -T '{desc}\n' |
|
278 | 304 | @ FOO |
|
279 | 305 | |\ |
|
280 | 306 | | o B |
|
281 | 307 | | |
|
282 | 308 | o A |
|
283 | 309 | |
|
284 | 310 | |
|
285 | 311 | More complete test for status changes (issue5732) |
|
286 | 312 | ------------------------------------------------- |
|
287 | 313 | |
|
288 | 314 | Generates history of files having 3 states, r0_r1_wc: |
|
289 | 315 | |
|
290 | 316 | r0: ground (content/missing) |
|
291 | 317 | r1: old state to be amended (content/missing, where missing means removed) |
|
292 | 318 | wc: changes to be included in r1 (content/missing-tracked/untracked) |
|
293 | 319 | |
|
294 | 320 | $ hg init $TESTTMP/wcstates |
|
295 | 321 | $ cd $TESTTMP/wcstates |
|
296 | 322 | |
|
297 | 323 | $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 1 |
|
298 | 324 | $ hg addremove -q --similarity 0 |
|
299 | 325 | $ hg commit -m0 |
|
300 | 326 | |
|
301 | 327 | $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 2 |
|
302 | 328 | $ hg addremove -q --similarity 0 |
|
303 | 329 | $ hg commit -m1 |
|
304 | 330 | |
|
305 | 331 | $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 wc |
|
306 | 332 | $ hg addremove -q --similarity 0 |
|
307 | 333 | $ hg forget *_*_*-untracked |
|
308 | 334 | $ rm *_*_missing-* |
|
309 | 335 | |
|
310 | 336 | amend r1 to include wc changes |
|
311 | 337 | |
|
312 | 338 | $ hg amend |
|
313 | 339 | saved backup bundle to * (glob) (obsstore-off !) |
|
314 | 340 | |
|
315 | 341 | clean/modified/removed/added states of the amended revision |
|
316 | 342 | |
|
317 | 343 | $ hg status --all --change . 'glob:content1_*_content1-tracked' |
|
318 | 344 | C content1_content1_content1-tracked |
|
319 | 345 | C content1_content2_content1-tracked |
|
320 | 346 | C content1_missing_content1-tracked |
|
321 | 347 | $ hg status --all --change . 'glob:content1_*_content[23]-tracked' |
|
322 | 348 | M content1_content1_content3-tracked |
|
323 | 349 | M content1_content2_content2-tracked |
|
324 | 350 | M content1_content2_content3-tracked |
|
325 | 351 | M content1_missing_content3-tracked |
|
326 | 352 | $ hg status --all --change . 'glob:content1_*_missing-tracked' |
|
327 | 353 | M content1_content2_missing-tracked |
|
328 | 354 | R content1_missing_missing-tracked |
|
329 | 355 | C content1_content1_missing-tracked |
|
330 | 356 | $ hg status --all --change . 'glob:content1_*_*-untracked' |
|
331 | 357 | R content1_content1_content1-untracked |
|
332 | 358 | R content1_content1_content3-untracked |
|
333 | 359 | R content1_content1_missing-untracked |
|
334 | 360 | R content1_content2_content1-untracked |
|
335 | 361 | R content1_content2_content2-untracked |
|
336 | 362 | R content1_content2_content3-untracked |
|
337 | 363 | R content1_content2_missing-untracked |
|
338 | 364 | R content1_missing_content1-untracked |
|
339 | 365 | R content1_missing_content3-untracked |
|
340 | 366 | R content1_missing_missing-untracked |
|
341 | 367 | $ hg status --all --change . 'glob:missing_content2_*' |
|
342 | 368 | A missing_content2_content2-tracked |
|
343 | 369 | A missing_content2_content3-tracked |
|
344 | 370 | A missing_content2_missing-tracked |
|
345 | 371 | $ hg status --all --change . 'glob:missing_missing_*' |
|
346 | 372 | A missing_missing_content3-tracked |
|
347 | 373 | |
|
348 | 374 | working directory should be all clean (with some missing/untracked files) |
|
349 | 375 | |
|
350 | 376 | $ hg status --all 'glob:*_content?-tracked' |
|
351 | 377 | C content1_content1_content1-tracked |
|
352 | 378 | C content1_content1_content3-tracked |
|
353 | 379 | C content1_content2_content1-tracked |
|
354 | 380 | C content1_content2_content2-tracked |
|
355 | 381 | C content1_content2_content3-tracked |
|
356 | 382 | C content1_missing_content1-tracked |
|
357 | 383 | C content1_missing_content3-tracked |
|
358 | 384 | C missing_content2_content2-tracked |
|
359 | 385 | C missing_content2_content3-tracked |
|
360 | 386 | C missing_missing_content3-tracked |
|
361 | 387 | $ hg status --all 'glob:*_missing-tracked' |
|
362 | 388 | ! content1_content1_missing-tracked |
|
363 | 389 | ! content1_content2_missing-tracked |
|
364 | 390 | ! content1_missing_missing-tracked |
|
365 | 391 | ! missing_content2_missing-tracked |
|
366 | 392 | ! missing_missing_missing-tracked |
|
367 | 393 | $ hg status --all 'glob:*-untracked' |
|
368 | 394 | ? content1_content1_content1-untracked |
|
369 | 395 | ? content1_content1_content3-untracked |
|
370 | 396 | ? content1_content2_content1-untracked |
|
371 | 397 | ? content1_content2_content2-untracked |
|
372 | 398 | ? content1_content2_content3-untracked |
|
373 | 399 | ? content1_missing_content1-untracked |
|
374 | 400 | ? content1_missing_content3-untracked |
|
375 | 401 | ? missing_content2_content2-untracked |
|
376 | 402 | ? missing_content2_content3-untracked |
|
377 | 403 | ? missing_missing_content3-untracked |
|
378 | 404 | |
|
379 | 405 | ================================= |
|
380 | 406 | Test backup-bundle config option| |
|
381 | 407 | ================================= |
|
382 | 408 | $ hg init $TESTTMP/repo4 |
|
383 | 409 | $ cd $TESTTMP/repo4 |
|
384 | 410 | $ echo a>a |
|
385 | 411 | $ hg ci -Aqma |
|
386 | 412 | $ echo oops>b |
|
387 | 413 | $ hg ci -Aqm "b" |
|
388 | 414 | $ echo partiallyfixed > b |
|
389 | 415 | |
|
390 | 416 | #if obsstore-off |
|
391 | 417 | $ hg amend |
|
392 | 418 | saved backup bundle to $TESTTMP/repo4/.hg/strip-backup/95e899acf2ce-f11cb050-amend.hg |
|
393 | 419 | When backup-bundle config option is set: |
|
394 | 420 | $ cat << EOF >> $HGRCPATH |
|
395 | 421 | > [rewrite] |
|
396 | 422 | > backup-bundle = False |
|
397 | 423 | > EOF |
|
398 | 424 | $ echo fixed > b |
|
399 | 425 | $ hg amend |
|
400 | 426 | |
|
401 | 427 | #else |
|
402 | 428 | $ hg amend |
|
403 | 429 | When backup-bundle config option is set: |
|
404 | 430 | $ cat << EOF >> $HGRCPATH |
|
405 | 431 | > [rewrite] |
|
406 | 432 | > backup-bundle = False |
|
407 | 433 | > EOF |
|
408 | 434 | $ echo fixed > b |
|
409 | 435 | $ hg amend |
|
410 | 436 | |
|
411 | 437 | #endif |
|
412 | 438 | ========================================== |
|
413 | 439 | Test update-timestamp config option| |
|
414 | 440 | ========================================== |
|
415 | 441 | |
|
416 | 442 | $ cat >> $HGRCPATH << EOF |
|
417 | 443 | > [extensions] |
|
418 | 444 | > amend= |
|
419 | 445 | > mockmakedate = $TESTDIR/mockmakedate.py |
|
420 | 446 | > EOF |
|
421 | 447 | |
|
422 | 448 | $ hg init $TESTTMP/repo5 |
|
423 | 449 | $ cd $TESTTMP/repo5 |
|
424 | 450 | $ cat <<'EOF' >> .hg/hgrc |
|
425 | 451 | > [command-templates] |
|
426 | 452 | > log = 'user: {user} |
|
427 | 453 | > date: {date|date} |
|
428 | 454 | > summary: {desc|firstline}\n' |
|
429 | 455 | > EOF |
|
430 | 456 | |
|
431 | 457 | $ echo a>a |
|
432 | 458 | $ hg ci -Am 'commit 1' |
|
433 | 459 | adding a |
|
434 | 460 | |
|
435 | 461 | When updatetimestamp is False |
|
436 | 462 | |
|
437 | 463 | $ hg amend --date '1997-1-1 0:1' |
|
438 | 464 | $ hg log --limit 1 |
|
439 | 465 | user: test |
|
440 | 466 | date: Wed Jan 01 00:01:00 1997 +0000 |
|
441 | 467 | summary: commit 1 |
|
442 | 468 | |
|
443 | 469 | When update-timestamp is True and no other change than the date |
|
444 | 470 | |
|
445 | 471 | $ hg amend --config rewrite.update-timestamp=True |
|
446 | 472 | nothing changed |
|
447 | 473 | [1] |
|
448 | 474 | $ hg log --limit 1 |
|
449 | 475 | user: test |
|
450 | 476 | date: Wed Jan 01 00:01:00 1997 +0000 |
|
451 | 477 | summary: commit 1 |
|
452 | 478 | |
|
453 | 479 | When update-timestamp is True and there is other change than the date |
|
454 | 480 | $ hg amend --user foobar --config rewrite.update-timestamp=True |
|
455 | 481 | $ hg log --limit 1 |
|
456 | 482 | user: foobar |
|
457 | 483 | date: Thu Jan 01 00:00:02 1970 +0000 |
|
458 | 484 | summary: commit 1 |
|
459 | 485 | |
|
460 | 486 | When date option is applicable and update-timestamp is True |
|
461 | 487 | $ hg amend --date '1998-1-1 0:1' --config rewrite.update-timestamp=True |
|
462 | 488 | $ hg log --limit 1 |
|
463 | 489 | user: foobar |
|
464 | 490 | date: Thu Jan 01 00:01:00 1998 +0000 |
|
465 | 491 | summary: commit 1 |
|
466 | 492 | |
|
467 | 493 | Unlike rewrite.update-timestamp, -D/--currentdate always updates the timestamp |
|
468 | 494 | |
|
469 | 495 | $ hg amend -D |
|
470 | 496 | $ hg log --limit 1 |
|
471 | 497 | user: foobar |
|
472 | 498 | date: Thu Jan 01 00:00:04 1970 +0000 |
|
473 | 499 | summary: commit 1 |
|
474 | 500 | |
|
475 | 501 | $ hg amend -D --config rewrite.update-timestamp=True |
|
476 | 502 | $ hg log --limit 1 |
|
477 | 503 | user: foobar |
|
478 | 504 | date: Thu Jan 01 00:00:05 1970 +0000 |
|
479 | 505 | summary: commit 1 |
|
480 | 506 | |
|
481 | 507 | rewrite.update-timestamp can be negated by --no-currentdate |
|
482 | 508 | |
|
483 | 509 | $ hg amend --config rewrite.update-timestamp=True --no-currentdate -u baz |
|
484 | 510 | $ hg log --limit 1 |
|
485 | 511 | user: baz |
|
486 | 512 | date: Thu Jan 01 00:00:05 1970 +0000 |
|
487 | 513 | summary: commit 1 |
|
488 | 514 | |
|
489 | 515 | Bad combination of date options: |
|
490 | 516 | |
|
491 | 517 | $ hg amend -D --date '0 0' |
|
492 | 518 | abort: cannot specify both --date and --currentdate |
|
493 | 519 | [10] |
|
494 | 520 | |
|
495 | 521 | Close branch |
|
496 | 522 | |
|
497 | 523 | $ hg amend --secret --close-branch |
|
498 | 524 | $ hg log --limit 1 -T 'close={get(extras, "close")}\nphase={phase}\n' |
|
499 | 525 | close=1 |
|
500 | 526 | phase=secret |
|
501 | 527 | |
|
502 | 528 | $ cd .. |
|
503 | 529 | |
|
504 | 530 | Corner case of amend from issue6157: |
|
505 | 531 | - working copy parent has a change to file `a` |
|
506 | 532 | - working copy has the inverse change |
|
507 | 533 | - we amend the working copy parent for files other than `a` |
|
508 | 534 | hg used to include the changes to `a` anyway. |
|
509 | 535 | |
|
510 | 536 | $ hg init 6157; cd 6157 |
|
511 | 537 | $ echo a > a; echo b > b; hg commit -qAm_ |
|
512 | 538 | $ echo a2 > a; hg commit -qm_ |
|
513 | 539 | $ hg diff --stat -c . |
|
514 | 540 | a | 2 +- |
|
515 | 541 | 1 files changed, 1 insertions(+), 1 deletions(-) |
|
516 | 542 | $ echo a > a; echo b2 > b; hg amend -q b |
|
517 | 543 | $ hg diff --stat -c . |
|
518 | 544 | a | 2 +- |
|
519 | 545 | b | 2 +- |
|
520 | 546 | 2 files changed, 2 insertions(+), 2 deletions(-) |
|
521 | 547 | |
|
522 | 548 | Modifying a file while the editor is open can cause dirstate corruption |
|
523 | 549 | (issue6233) |
|
524 | 550 | |
|
525 | 551 | $ cd $TESTTMP |
|
526 | 552 | $ hg init modify-during-amend; cd modify-during-amend |
|
527 | 553 | $ echo r0 > foo; hg commit -qAm "r0" |
|
528 | 554 | $ echo alpha > foo; hg commit -qm "alpha" |
|
529 | 555 | $ echo beta >> foo |
|
530 | 556 | $ cat > $TESTTMP/touchy_editor.sh <<EOF |
|
531 | 557 | > sleep 1 |
|
532 | 558 | > echo delta >> "$TESTTMP/modify-during-amend/foo" |
|
533 | 559 | > sleep 1 |
|
534 | 560 | > echo hi > "\$1" |
|
535 | 561 | > sleep 1 |
|
536 | 562 | > EOF |
|
537 | 563 | $ HGEDITOR="sh $TESTTMP/touchy_editor.sh" hg commit --amend |
|
538 | 564 | $ if (hg diff -c . | grep 'delta' >/dev/null) || [ -n "$(hg status)" ]; then |
|
539 | 565 | > echo "OK." |
|
540 | 566 | > else |
|
541 | 567 | > echo "Bug detected. 'delta' is not part of the commit OR the wdir" |
|
542 | 568 | > echo "Diff and status before rebuild:" |
|
543 | 569 | > hg diff |
|
544 | 570 | > hg status |
|
545 | 571 | > hg debugrebuilddirstate |
|
546 | 572 | > echo "Diff and status after rebuild:" |
|
547 | 573 | > hg diff |
|
548 | 574 | > hg status |
|
549 | 575 | > fi |
|
550 | 576 | OK. |
General Comments 0
You need to be logged in to leave comments.
Login now