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