##// END OF EJS Templates
test-amend: remove uninteresting fields from log output to deduplicate tests...
Yuya Nishihara -
r41157:14271b52 default
parent child Browse files
Show More
@@ -1,492 +1,440 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: options --message and --logfile are mutually exclusive
132 abort: options --message and --logfile are mutually exclusive
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'? [Ynesfdaq?] y
149 examine changes to 'F'? [Ynesfdaq?] y
150
150
151 diff --git a/G b/G
151 diff --git a/G b/G
152 new file mode 100644
152 new file mode 100644
153 examine changes to 'G'? [Ynesfdaq?] n
153 examine changes to 'G'? [Ynesfdaq?] n
154
154
155 saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/507be9bdac71-c8077452-amend.hg (obsstore-off !)
155 saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/507be9bdac71-c8077452-amend.hg (obsstore-off !)
156 $ hg log -r . -T '{files}\n'
156 $ hg log -r . -T '{files}\n'
157 B D F
157 B D F
158
158
159 Amend in the middle of a stack
159 Amend in the middle of a stack
160
160
161 $ hg init $TESTTMP/repo2
161 $ hg init $TESTTMP/repo2
162 $ cd $TESTTMP/repo2
162 $ cd $TESTTMP/repo2
163 $ hg debugdrawdag <<'EOS'
163 $ hg debugdrawdag <<'EOS'
164 > C
164 > C
165 > |
165 > |
166 > B
166 > B
167 > |
167 > |
168 > A
168 > A
169 > EOS
169 > EOS
170
170
171 $ hg update -q B
171 $ hg update -q B
172 $ echo 2 >> B
172 $ echo 2 >> B
173 $ hg amend
173 $ hg amend
174 abort: cannot amend changeset with children
174 abort: cannot amend changeset with children
175 [255]
175 [255]
176
176
177 #if obsstore-on
177 #if obsstore-on
178
178
179 With allowunstable, amend could work in the middle of a stack
179 With allowunstable, amend could work in the middle of a stack
180
180
181 $ cat >> $HGRCPATH <<EOF
181 $ cat >> $HGRCPATH <<EOF
182 > [experimental]
182 > [experimental]
183 > evolution.createmarkers=True
183 > evolution.createmarkers=True
184 > evolution.allowunstable=True
184 > evolution.allowunstable=True
185 > EOF
185 > EOF
186
186
187 $ hg amend
187 $ hg amend
188 1 new orphan changesets
188 1 new orphan changesets
189 $ hg log -T '{rev} {node|short} {desc}\n' -G
189 $ hg log -T '{rev} {node|short} {desc}\n' -G
190 @ 3 be169c7e8dbe B
190 @ 3 be169c7e8dbe B
191 |
191 |
192 | * 2 26805aba1e60 C
192 | * 2 26805aba1e60 C
193 | |
193 | |
194 | x 1 112478962961 B
194 | x 1 112478962961 B
195 |/
195 |/
196 o 0 426bada5c675 A
196 o 0 426bada5c675 A
197
197
198 Checking the note stored in the obsmarker
198 Checking the note stored in the obsmarker
199
199
200 $ echo foo > bar
200 $ echo foo > bar
201 $ hg add bar
201 $ hg add bar
202 $ hg amend --note 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
202 $ hg amend --note 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
203 abort: cannot store a note of more than 255 bytes
203 abort: cannot store a note of more than 255 bytes
204 [255]
204 [255]
205 $ hg amend --note "adding bar"
205 $ hg amend --note "adding bar"
206 $ hg debugobsolete -r .
206 $ hg debugobsolete -r .
207 112478962961147124edd43549aedd1a335e44bf be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'}
207 112478962961147124edd43549aedd1a335e44bf be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'}
208 be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 16084da537dd8f84cfdb3055c633772269d62e1b 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'note': 'adding bar', 'operation': 'amend', 'user': 'test'}
208 be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 16084da537dd8f84cfdb3055c633772269d62e1b 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'note': 'adding bar', 'operation': 'amend', 'user': 'test'}
209 #endif
209 #endif
210
210
211 Cannot amend public changeset
211 Cannot amend public changeset
212
212
213 $ hg phase -r A --public
213 $ hg phase -r A --public
214 $ hg update -C -q A
214 $ hg update -C -q A
215 $ hg amend -m AMEND
215 $ hg amend -m AMEND
216 abort: cannot amend public changesets
216 abort: cannot amend public changesets
217 (see 'hg help phases' for details)
217 (see 'hg help phases' for details)
218 [255]
218 [255]
219
219
220 Amend a merge changeset
220 Amend a merge changeset
221
221
222 $ hg init $TESTTMP/repo3
222 $ hg init $TESTTMP/repo3
223 $ cd $TESTTMP/repo3
223 $ cd $TESTTMP/repo3
224 $ hg debugdrawdag <<'EOS'
224 $ hg debugdrawdag <<'EOS'
225 > C
225 > C
226 > /|
226 > /|
227 > A B
227 > A B
228 > EOS
228 > EOS
229 $ hg update -q C
229 $ hg update -q C
230 $ hg amend -m FOO
230 $ hg amend -m FOO
231 saved backup bundle to $TESTTMP/repo3/.hg/strip-backup/a35c07e8a2a4-15ff4612-amend.hg (obsstore-off !)
231 saved backup bundle to $TESTTMP/repo3/.hg/strip-backup/a35c07e8a2a4-15ff4612-amend.hg (obsstore-off !)
232 $ rm .hg/localtags
232 $ rm .hg/localtags
233 $ hg log -G -T '{desc}\n'
233 $ hg log -G -T '{desc}\n'
234 @ FOO
234 @ FOO
235 |\
235 |\
236 | o B
236 | o B
237 |
237 |
238 o A
238 o A
239
239
240
240
241 More complete test for status changes (issue5732)
241 More complete test for status changes (issue5732)
242 -------------------------------------------------
242 -------------------------------------------------
243
243
244 Generates history of files having 3 states, r0_r1_wc:
244 Generates history of files having 3 states, r0_r1_wc:
245
245
246 r0: ground (content/missing)
246 r0: ground (content/missing)
247 r1: old state to be amended (content/missing, where missing means removed)
247 r1: old state to be amended (content/missing, where missing means removed)
248 wc: changes to be included in r1 (content/missing-tracked/untracked)
248 wc: changes to be included in r1 (content/missing-tracked/untracked)
249
249
250 $ hg init $TESTTMP/wcstates
250 $ hg init $TESTTMP/wcstates
251 $ cd $TESTTMP/wcstates
251 $ cd $TESTTMP/wcstates
252
252
253 $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 1
253 $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 1
254 $ hg addremove -q --similarity 0
254 $ hg addremove -q --similarity 0
255 $ hg commit -m0
255 $ hg commit -m0
256
256
257 $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 2
257 $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 2
258 $ hg addremove -q --similarity 0
258 $ hg addremove -q --similarity 0
259 $ hg commit -m1
259 $ hg commit -m1
260
260
261 $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 wc
261 $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 wc
262 $ hg addremove -q --similarity 0
262 $ hg addremove -q --similarity 0
263 $ hg forget *_*_*-untracked
263 $ hg forget *_*_*-untracked
264 $ rm *_*_missing-*
264 $ rm *_*_missing-*
265
265
266 amend r1 to include wc changes
266 amend r1 to include wc changes
267
267
268 $ hg amend
268 $ hg amend
269 saved backup bundle to * (glob) (obsstore-off !)
269 saved backup bundle to * (glob) (obsstore-off !)
270
270
271 clean/modified/removed/added states of the amended revision
271 clean/modified/removed/added states of the amended revision
272
272
273 $ hg status --all --change . 'glob:content1_*_content1-tracked'
273 $ hg status --all --change . 'glob:content1_*_content1-tracked'
274 C content1_content1_content1-tracked
274 C content1_content1_content1-tracked
275 C content1_content2_content1-tracked
275 C content1_content2_content1-tracked
276 C content1_missing_content1-tracked
276 C content1_missing_content1-tracked
277 $ hg status --all --change . 'glob:content1_*_content[23]-tracked'
277 $ hg status --all --change . 'glob:content1_*_content[23]-tracked'
278 M content1_content1_content3-tracked
278 M content1_content1_content3-tracked
279 M content1_content2_content2-tracked
279 M content1_content2_content2-tracked
280 M content1_content2_content3-tracked
280 M content1_content2_content3-tracked
281 M content1_missing_content3-tracked
281 M content1_missing_content3-tracked
282 $ hg status --all --change . 'glob:content1_*_missing-tracked'
282 $ hg status --all --change . 'glob:content1_*_missing-tracked'
283 M content1_content2_missing-tracked
283 M content1_content2_missing-tracked
284 R content1_missing_missing-tracked
284 R content1_missing_missing-tracked
285 C content1_content1_missing-tracked
285 C content1_content1_missing-tracked
286 $ hg status --all --change . 'glob:content1_*_*-untracked'
286 $ hg status --all --change . 'glob:content1_*_*-untracked'
287 R content1_content1_content1-untracked
287 R content1_content1_content1-untracked
288 R content1_content1_content3-untracked
288 R content1_content1_content3-untracked
289 R content1_content1_missing-untracked
289 R content1_content1_missing-untracked
290 R content1_content2_content1-untracked
290 R content1_content2_content1-untracked
291 R content1_content2_content2-untracked
291 R content1_content2_content2-untracked
292 R content1_content2_content3-untracked
292 R content1_content2_content3-untracked
293 R content1_content2_missing-untracked
293 R content1_content2_missing-untracked
294 R content1_missing_content1-untracked
294 R content1_missing_content1-untracked
295 R content1_missing_content3-untracked
295 R content1_missing_content3-untracked
296 R content1_missing_missing-untracked
296 R content1_missing_missing-untracked
297 $ hg status --all --change . 'glob:missing_content2_*'
297 $ hg status --all --change . 'glob:missing_content2_*'
298 A missing_content2_content2-tracked
298 A missing_content2_content2-tracked
299 A missing_content2_content3-tracked
299 A missing_content2_content3-tracked
300 A missing_content2_missing-tracked
300 A missing_content2_missing-tracked
301 $ hg status --all --change . 'glob:missing_missing_*'
301 $ hg status --all --change . 'glob:missing_missing_*'
302 A missing_missing_content3-tracked
302 A missing_missing_content3-tracked
303
303
304 working directory should be all clean (with some missing/untracked files)
304 working directory should be all clean (with some missing/untracked files)
305
305
306 $ hg status --all 'glob:*_content?-tracked'
306 $ hg status --all 'glob:*_content?-tracked'
307 C content1_content1_content1-tracked
307 C content1_content1_content1-tracked
308 C content1_content1_content3-tracked
308 C content1_content1_content3-tracked
309 C content1_content2_content1-tracked
309 C content1_content2_content1-tracked
310 C content1_content2_content2-tracked
310 C content1_content2_content2-tracked
311 C content1_content2_content3-tracked
311 C content1_content2_content3-tracked
312 C content1_missing_content1-tracked
312 C content1_missing_content1-tracked
313 C content1_missing_content3-tracked
313 C content1_missing_content3-tracked
314 C missing_content2_content2-tracked
314 C missing_content2_content2-tracked
315 C missing_content2_content3-tracked
315 C missing_content2_content3-tracked
316 C missing_missing_content3-tracked
316 C missing_missing_content3-tracked
317 $ hg status --all 'glob:*_missing-tracked'
317 $ hg status --all 'glob:*_missing-tracked'
318 ! content1_content1_missing-tracked
318 ! content1_content1_missing-tracked
319 ! content1_content2_missing-tracked
319 ! content1_content2_missing-tracked
320 ! content1_missing_missing-tracked
320 ! content1_missing_missing-tracked
321 ! missing_content2_missing-tracked
321 ! missing_content2_missing-tracked
322 ! missing_missing_missing-tracked
322 ! missing_missing_missing-tracked
323 $ hg status --all 'glob:*-untracked'
323 $ hg status --all 'glob:*-untracked'
324 ? content1_content1_content1-untracked
324 ? content1_content1_content1-untracked
325 ? content1_content1_content3-untracked
325 ? content1_content1_content3-untracked
326 ? content1_content2_content1-untracked
326 ? content1_content2_content1-untracked
327 ? content1_content2_content2-untracked
327 ? content1_content2_content2-untracked
328 ? content1_content2_content3-untracked
328 ? content1_content2_content3-untracked
329 ? content1_missing_content1-untracked
329 ? content1_missing_content1-untracked
330 ? content1_missing_content3-untracked
330 ? content1_missing_content3-untracked
331 ? missing_content2_content2-untracked
331 ? missing_content2_content2-untracked
332 ? missing_content2_content3-untracked
332 ? missing_content2_content3-untracked
333 ? missing_missing_content3-untracked
333 ? missing_missing_content3-untracked
334
334
335 ==========================================
335 ==========================================
336 Test history-editing-backup config option|
336 Test history-editing-backup config option|
337 ==========================================
337 ==========================================
338 $ hg init $TESTTMP/repo4
338 $ hg init $TESTTMP/repo4
339 $ cd $TESTTMP/repo4
339 $ cd $TESTTMP/repo4
340 $ echo a>a
340 $ echo a>a
341 $ hg ci -Aqma
341 $ hg ci -Aqma
342 $ echo oops>b
342 $ echo oops>b
343 $ hg ci -Aqm "b"
343 $ hg ci -Aqm "b"
344 $ echo partiallyfixed > b
344 $ echo partiallyfixed > b
345
345
346 #if obsstore-off
346 #if obsstore-off
347 $ hg amend
347 $ hg amend
348 saved backup bundle to $TESTTMP/repo4/.hg/strip-backup/95e899acf2ce-f11cb050-amend.hg
348 saved backup bundle to $TESTTMP/repo4/.hg/strip-backup/95e899acf2ce-f11cb050-amend.hg
349 When history-editing-backup config option is set:
349 When history-editing-backup config option is set:
350 $ cat << EOF >> $HGRCPATH
350 $ cat << EOF >> $HGRCPATH
351 > [ui]
351 > [ui]
352 > history-editing-backup = False
352 > history-editing-backup = False
353 > EOF
353 > EOF
354 $ echo fixed > b
354 $ echo fixed > b
355 $ hg amend
355 $ hg amend
356
356
357 #else
357 #else
358 $ hg amend
358 $ hg amend
359 When history-editing-backup config option is set:
359 When history-editing-backup config option is set:
360 $ cat << EOF >> $HGRCPATH
360 $ cat << EOF >> $HGRCPATH
361 > [ui]
361 > [ui]
362 > history-editing-backup = False
362 > history-editing-backup = False
363 > EOF
363 > EOF
364 $ echo fixed > b
364 $ echo fixed > b
365 $ hg amend
365 $ hg amend
366
366
367 #endif
367 #endif
368 ==========================================
368 ==========================================
369 Test update-timestamp config option|
369 Test update-timestamp config option|
370 ==========================================
370 ==========================================
371 $ cat >> testmocks.py << EOF
371 $ cat >> testmocks.py << EOF
372 > # mock out util.makedate() to supply testable values
372 > # mock out util.makedate() to supply testable values
373 > import os
373 > import os
374 > from mercurial import pycompat, util
374 > from mercurial import pycompat, util
375 > from mercurial.utils import dateutil
375 > from mercurial.utils import dateutil
376 >
376 >
377 > def mockmakedate():
377 > def mockmakedate():
378 > filename = os.path.join(os.environ['TESTTMP'], 'testtime')
378 > filename = os.path.join(os.environ['TESTTMP'], 'testtime')
379 > try:
379 > try:
380 > with open(filename, 'rb') as timef:
380 > with open(filename, 'rb') as timef:
381 > time = float(timef.read()) + 1
381 > time = float(timef.read()) + 1
382 > except IOError:
382 > except IOError:
383 > time = 0.0
383 > time = 0.0
384 > with open(filename, 'wb') as timef:
384 > with open(filename, 'wb') as timef:
385 > timef.write(pycompat.bytestr(time))
385 > timef.write(pycompat.bytestr(time))
386 > return (time, 0)
386 > return (time, 0)
387 >
387 >
388 > dateutil.makedate = mockmakedate
388 > dateutil.makedate = mockmakedate
389 > EOF
389 > EOF
390
390
391 $ cat >> $HGRCPATH << EOF
391 $ cat >> $HGRCPATH << EOF
392 > [extensions]
392 > [extensions]
393 > amend=
393 > amend=
394 > testmocks=`pwd`/testmocks.py
394 > testmocks=`pwd`/testmocks.py
395 > EOF
395 > EOF
396
396
397 $ hg init $TESTTMP/repo5
397 $ hg init $TESTTMP/repo5
398 $ cd $TESTTMP/repo5
398 $ cd $TESTTMP/repo5
399 $ cat <<'EOF' >> .hg/hgrc
400 > [ui]
401 > logtemplate = 'user: {user}
402 > date: {date|date}
403 > summary: {desc|firstline}\n'
404 > EOF
405
399 $ echo a>a
406 $ echo a>a
400 $ hg ci -Am 'commit 1'
407 $ hg ci -Am 'commit 1'
401 adding a
408 adding a
402 #if obsstore-on
403
409
404 When updatetimestamp is False
410 When updatetimestamp is False
405
411
406 $ hg amend --date '1997-1-1 0:1'
412 $ hg amend --date '1997-1-1 0:1'
407 $ hg log --limit 1
413 $ hg log --limit 1
408 changeset: 1:036a159be19d
409 tag: tip
410 parent: -1:000000000000
411 user: test
414 user: test
412 date: Wed Jan 01 00:01:00 1997 +0000
415 date: Wed Jan 01 00:01:00 1997 +0000
413 summary: commit 1
416 summary: commit 1
414
417
415 When update-timestamp is True and no other change than the date
418 When update-timestamp is True and no other change than the date
416
419
417 $ hg amend --config rewrite.update-timestamp=True
420 $ hg amend --config rewrite.update-timestamp=True
418 nothing changed
421 nothing changed
419 [1]
422 [1]
420 $ hg log --limit 1
423 $ hg log --limit 1
421 changeset: 1:036a159be19d
422 tag: tip
423 parent: -1:000000000000
424 user: test
424 user: test
425 date: Wed Jan 01 00:01:00 1997 +0000
425 date: Wed Jan 01 00:01:00 1997 +0000
426 summary: commit 1
426 summary: commit 1
427
427
428 When update-timestamp is True and there is other change than the date
428 When update-timestamp is True and there is other change than the date
429 $ hg amend --user foobar --config rewrite.update-timestamp=True
429 $ hg amend --user foobar --config rewrite.update-timestamp=True
430 $ hg log --limit 1
430 $ hg log --limit 1
431 changeset: 2:3ba48b892280
432 tag: tip
433 parent: -1:000000000000
434 user: foobar
431 user: foobar
435 date: Thu Jan 01 00:00:02 1970 +0000
432 date: Thu Jan 01 00:00:02 1970 +0000
436 summary: commit 1
433 summary: commit 1
437
438
434
439 When date option is applicable and update-timestamp is True
435 When date option is applicable and update-timestamp is True
440 $ hg amend --date '1998-1-1 0:1' --config rewrite.update-timestamp=True
436 $ hg amend --date '1998-1-1 0:1' --config rewrite.update-timestamp=True
441 $ hg log --limit 1
437 $ hg log --limit 1
442 changeset: 3:626aee031885
443 tag: tip
444 parent: -1:000000000000
445 user: foobar
438 user: foobar
446 date: Thu Jan 01 00:01:00 1998 +0000
439 date: Thu Jan 01 00:01:00 1998 +0000
447 summary: commit 1
440 summary: commit 1
448
449 #else
450
451 When updatetimestamp is False
452
453 $ hg amend --date '1997-1-1 0:1'
454 $ hg log --limit 1
455 changeset: 0:036a159be19d
456 tag: tip
457 user: test
458 date: Wed Jan 01 00:01:00 1997 +0000
459 summary: commit 1
460
461 When update-timestamp is True and no other change than the date
462
463 $ hg amend --config rewrite.update-timestamp=True
464 nothing changed
465 [1]
466 $ hg log --limit 1
467 changeset: 0:036a159be19d
468 tag: tip
469 user: test
470 date: Wed Jan 01 00:01:00 1997 +0000
471 summary: commit 1
472
473 When update-timestamp is True and there is other change than the date
474 $ hg amend --user foobar --config rewrite.update-timestamp=True
475 $ hg log --limit 1
476 changeset: 0:3ba48b892280
477 tag: tip
478 user: foobar
479 date: Thu Jan 01 00:00:02 1970 +0000
480 summary: commit 1
481
482
483 When date option is applicable and update-timestamp is True
484 $ hg amend --date '1998-1-1 0:1' --config rewrite.update-timestamp=True
485 $ hg log --limit 1
486 changeset: 0:626aee031885
487 tag: tip
488 user: foobar
489 date: Thu Jan 01 00:01:00 1998 +0000
490 summary: commit 1
491
492 #endif
General Comments 0
You need to be logged in to leave comments. Login now