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