##// END OF EJS Templates
errors: raise StateError when there are unresolves merge conflicts...
Martin von Zweigbergk -
r46528:fa87536d default
parent child Browse files
Show More
@@ -1,19 +1,19 b''
1 # mergeutil.py - help for merge processing in mercurial
1 # mergeutil.py - help for merge processing in mercurial
2 #
2 #
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 from .i18n import _
10 from .i18n import _
11
11
12 from . import error
12 from . import error
13
13
14
14
15 def checkunresolved(ms):
15 def checkunresolved(ms):
16 if list(ms.unresolved()):
16 if list(ms.unresolved()):
17 raise error.Abort(
17 raise error.StateError(
18 _(b"unresolved merge conflicts (see 'hg help resolve')")
18 _(b"unresolved merge conflicts (see 'hg help resolve')")
19 )
19 )
@@ -1,1319 +1,1319 b''
1 $ hg init
1 $ hg init
2
2
3 Setup:
3 Setup:
4
4
5 $ echo a >> a
5 $ echo a >> a
6 $ hg ci -Am 'base'
6 $ hg ci -Am 'base'
7 adding a
7 adding a
8
8
9 Refuse to amend public csets:
9 Refuse to amend public csets:
10
10
11 $ hg phase -r . -p
11 $ hg phase -r . -p
12 $ hg ci --amend
12 $ hg ci --amend
13 abort: cannot amend public changesets
13 abort: cannot amend public changesets
14 (see 'hg help phases' for details)
14 (see 'hg help phases' for details)
15 [10]
15 [10]
16 $ hg phase -r . -f -d
16 $ hg phase -r . -f -d
17
17
18 $ echo a >> a
18 $ echo a >> a
19 $ hg ci -Am 'base1'
19 $ hg ci -Am 'base1'
20
20
21 Nothing to amend:
21 Nothing to amend:
22
22
23 $ hg ci --amend -m 'base1'
23 $ hg ci --amend -m 'base1'
24 nothing changed
24 nothing changed
25 [1]
25 [1]
26
26
27 $ cat >> $HGRCPATH <<EOF
27 $ cat >> $HGRCPATH <<EOF
28 > [hooks]
28 > [hooks]
29 > pretxncommit.foo = sh -c "echo \\"pretxncommit \$HG_NODE\\"; hg id -r \$HG_NODE"
29 > pretxncommit.foo = sh -c "echo \\"pretxncommit \$HG_NODE\\"; hg id -r \$HG_NODE"
30 > EOF
30 > EOF
31
31
32 Amending changeset with changes in working dir:
32 Amending changeset with changes in working dir:
33 (and check that --message does not trigger an editor)
33 (and check that --message does not trigger an editor)
34
34
35 $ echo a >> a
35 $ echo a >> a
36 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -m 'amend base1'
36 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -m 'amend base1'
37 pretxncommit 43f1ba15f28a50abf0aae529cf8a16bfced7b149
37 pretxncommit 43f1ba15f28a50abf0aae529cf8a16bfced7b149
38 43f1ba15f28a tip
38 43f1ba15f28a tip
39 saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-5ab4f721-amend.hg
39 saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-5ab4f721-amend.hg
40 $ echo 'pretxncommit.foo = ' >> $HGRCPATH
40 $ echo 'pretxncommit.foo = ' >> $HGRCPATH
41 $ hg diff -c .
41 $ hg diff -c .
42 diff -r ad120869acf0 -r 43f1ba15f28a a
42 diff -r ad120869acf0 -r 43f1ba15f28a a
43 --- a/a Thu Jan 01 00:00:00 1970 +0000
43 --- a/a Thu Jan 01 00:00:00 1970 +0000
44 +++ b/a Thu Jan 01 00:00:00 1970 +0000
44 +++ b/a Thu Jan 01 00:00:00 1970 +0000
45 @@ -1,1 +1,3 @@
45 @@ -1,1 +1,3 @@
46 a
46 a
47 +a
47 +a
48 +a
48 +a
49 $ hg log
49 $ hg log
50 changeset: 1:43f1ba15f28a
50 changeset: 1:43f1ba15f28a
51 tag: tip
51 tag: tip
52 user: test
52 user: test
53 date: Thu Jan 01 00:00:00 1970 +0000
53 date: Thu Jan 01 00:00:00 1970 +0000
54 summary: amend base1
54 summary: amend base1
55
55
56 changeset: 0:ad120869acf0
56 changeset: 0:ad120869acf0
57 user: test
57 user: test
58 date: Thu Jan 01 00:00:00 1970 +0000
58 date: Thu Jan 01 00:00:00 1970 +0000
59 summary: base
59 summary: base
60
60
61
61
62 Check proper abort for empty message
62 Check proper abort for empty message
63
63
64 $ cat > editor.sh << '__EOF__'
64 $ cat > editor.sh << '__EOF__'
65 > #!/bin/sh
65 > #!/bin/sh
66 > echo "" > "$1"
66 > echo "" > "$1"
67 > __EOF__
67 > __EOF__
68
68
69 Update the existing file to ensure that the dirstate is not in pending state
69 Update the existing file to ensure that the dirstate is not in pending state
70 (where the status of some files in the working copy is not known yet). This in
70 (where the status of some files in the working copy is not known yet). This in
71 turn ensures that when the transaction is aborted due to an empty message during
71 turn ensures that when the transaction is aborted due to an empty message during
72 the amend, there should be no rollback.
72 the amend, there should be no rollback.
73 $ echo a >> a
73 $ echo a >> a
74
74
75 $ echo b > b
75 $ echo b > b
76 $ hg add b
76 $ hg add b
77 $ hg summary
77 $ hg summary
78 parent: 1:43f1ba15f28a tip
78 parent: 1:43f1ba15f28a tip
79 amend base1
79 amend base1
80 branch: default
80 branch: default
81 commit: 1 modified, 1 added, 1 unknown
81 commit: 1 modified, 1 added, 1 unknown
82 update: (current)
82 update: (current)
83 phases: 2 draft
83 phases: 2 draft
84 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
84 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
85 abort: empty commit message
85 abort: empty commit message
86 [10]
86 [10]
87 $ hg summary
87 $ hg summary
88 parent: 1:43f1ba15f28a tip
88 parent: 1:43f1ba15f28a tip
89 amend base1
89 amend base1
90 branch: default
90 branch: default
91 commit: 1 modified, 1 added, 1 unknown
91 commit: 1 modified, 1 added, 1 unknown
92 update: (current)
92 update: (current)
93 phases: 2 draft
93 phases: 2 draft
94
94
95 Add new file along with modified existing file:
95 Add new file along with modified existing file:
96 $ hg ci --amend -m 'amend base1 new file'
96 $ hg ci --amend -m 'amend base1 new file'
97 saved backup bundle to $TESTTMP/.hg/strip-backup/43f1ba15f28a-007467c2-amend.hg
97 saved backup bundle to $TESTTMP/.hg/strip-backup/43f1ba15f28a-007467c2-amend.hg
98
98
99 Remove file that was added in amended commit:
99 Remove file that was added in amended commit:
100 (and test logfile option)
100 (and test logfile option)
101 (and test that logfile option do not trigger an editor)
101 (and test that logfile option do not trigger an editor)
102
102
103 $ hg rm b
103 $ hg rm b
104 $ echo 'amend base1 remove new file' > ../logfile
104 $ echo 'amend base1 remove new file' > ../logfile
105 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg ci --amend --logfile ../logfile
105 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg ci --amend --logfile ../logfile
106 saved backup bundle to $TESTTMP/.hg/strip-backup/c16295aaf401-1ada9901-amend.hg
106 saved backup bundle to $TESTTMP/.hg/strip-backup/c16295aaf401-1ada9901-amend.hg
107
107
108 $ hg cat b
108 $ hg cat b
109 b: no such file in rev 47343646fa3d
109 b: no such file in rev 47343646fa3d
110 [1]
110 [1]
111
111
112 No changes, just a different message:
112 No changes, just a different message:
113
113
114 $ hg ci -v --amend -m 'no changes, new message'
114 $ hg ci -v --amend -m 'no changes, new message'
115 amending changeset 47343646fa3d
115 amending changeset 47343646fa3d
116 copying changeset 47343646fa3d to ad120869acf0
116 copying changeset 47343646fa3d to ad120869acf0
117 committing files:
117 committing files:
118 a
118 a
119 committing manifest
119 committing manifest
120 committing changelog
120 committing changelog
121 1 changesets found
121 1 changesets found
122 uncompressed size of bundle content:
122 uncompressed size of bundle content:
123 254 (changelog)
123 254 (changelog)
124 163 (manifests)
124 163 (manifests)
125 131 a
125 131 a
126 saved backup bundle to $TESTTMP/.hg/strip-backup/47343646fa3d-c2758885-amend.hg
126 saved backup bundle to $TESTTMP/.hg/strip-backup/47343646fa3d-c2758885-amend.hg
127 1 changesets found
127 1 changesets found
128 uncompressed size of bundle content:
128 uncompressed size of bundle content:
129 250 (changelog)
129 250 (changelog)
130 163 (manifests)
130 163 (manifests)
131 131 a
131 131 a
132 adding branch
132 adding branch
133 adding changesets
133 adding changesets
134 adding manifests
134 adding manifests
135 adding file changes
135 adding file changes
136 added 1 changesets with 1 changes to 1 files
136 added 1 changesets with 1 changes to 1 files
137 committed changeset 1:401431e913a1
137 committed changeset 1:401431e913a1
138 $ hg diff -c .
138 $ hg diff -c .
139 diff -r ad120869acf0 -r 401431e913a1 a
139 diff -r ad120869acf0 -r 401431e913a1 a
140 --- a/a Thu Jan 01 00:00:00 1970 +0000
140 --- a/a Thu Jan 01 00:00:00 1970 +0000
141 +++ b/a Thu Jan 01 00:00:00 1970 +0000
141 +++ b/a Thu Jan 01 00:00:00 1970 +0000
142 @@ -1,1 +1,4 @@
142 @@ -1,1 +1,4 @@
143 a
143 a
144 +a
144 +a
145 +a
145 +a
146 +a
146 +a
147 $ hg log
147 $ hg log
148 changeset: 1:401431e913a1
148 changeset: 1:401431e913a1
149 tag: tip
149 tag: tip
150 user: test
150 user: test
151 date: Thu Jan 01 00:00:00 1970 +0000
151 date: Thu Jan 01 00:00:00 1970 +0000
152 summary: no changes, new message
152 summary: no changes, new message
153
153
154 changeset: 0:ad120869acf0
154 changeset: 0:ad120869acf0
155 user: test
155 user: test
156 date: Thu Jan 01 00:00:00 1970 +0000
156 date: Thu Jan 01 00:00:00 1970 +0000
157 summary: base
157 summary: base
158
158
159
159
160 Disable default date on commit so when -d isn't given, the old date is preserved:
160 Disable default date on commit so when -d isn't given, the old date is preserved:
161
161
162 $ echo '[defaults]' >> $HGRCPATH
162 $ echo '[defaults]' >> $HGRCPATH
163 $ echo 'commit=' >> $HGRCPATH
163 $ echo 'commit=' >> $HGRCPATH
164
164
165 Test -u/-d:
165 Test -u/-d:
166
166
167 $ cat > .hg/checkeditform.sh <<EOF
167 $ cat > .hg/checkeditform.sh <<EOF
168 > env | grep HGEDITFORM
168 > env | grep HGEDITFORM
169 > true
169 > true
170 > EOF
170 > EOF
171 $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -u foo -d '1 0'
171 $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -u foo -d '1 0'
172 HGEDITFORM=commit.amend.normal
172 HGEDITFORM=commit.amend.normal
173 saved backup bundle to $TESTTMP/.hg/strip-backup/401431e913a1-5e8e532c-amend.hg
173 saved backup bundle to $TESTTMP/.hg/strip-backup/401431e913a1-5e8e532c-amend.hg
174 $ echo a >> a
174 $ echo a >> a
175 $ hg ci --amend -u foo -d '1 0'
175 $ hg ci --amend -u foo -d '1 0'
176 saved backup bundle to $TESTTMP/.hg/strip-backup/d96b1d28ae33-677e0afb-amend.hg
176 saved backup bundle to $TESTTMP/.hg/strip-backup/d96b1d28ae33-677e0afb-amend.hg
177 $ hg log -r .
177 $ hg log -r .
178 changeset: 1:a9a13940fc03
178 changeset: 1:a9a13940fc03
179 tag: tip
179 tag: tip
180 user: foo
180 user: foo
181 date: Thu Jan 01 00:00:01 1970 +0000
181 date: Thu Jan 01 00:00:01 1970 +0000
182 summary: no changes, new message
182 summary: no changes, new message
183
183
184
184
185 Open editor with old commit message if a message isn't given otherwise:
185 Open editor with old commit message if a message isn't given otherwise:
186
186
187 $ cat > editor.sh << '__EOF__'
187 $ cat > editor.sh << '__EOF__'
188 > #!/bin/sh
188 > #!/bin/sh
189 > cat $1
189 > cat $1
190 > echo "another precious commit message" > "$1"
190 > echo "another precious commit message" > "$1"
191 > __EOF__
191 > __EOF__
192
192
193 at first, test saving last-message.txt
193 at first, test saving last-message.txt
194
194
195 $ cat > .hg/hgrc << '__EOF__'
195 $ cat > .hg/hgrc << '__EOF__'
196 > [hooks]
196 > [hooks]
197 > pretxncommit.test-saving-last-message = false
197 > pretxncommit.test-saving-last-message = false
198 > __EOF__
198 > __EOF__
199
199
200 $ rm -f .hg/last-message.txt
200 $ rm -f .hg/last-message.txt
201 $ hg commit --amend -v -m "message given from command line"
201 $ hg commit --amend -v -m "message given from command line"
202 amending changeset a9a13940fc03
202 amending changeset a9a13940fc03
203 copying changeset a9a13940fc03 to ad120869acf0
203 copying changeset a9a13940fc03 to ad120869acf0
204 committing files:
204 committing files:
205 a
205 a
206 committing manifest
206 committing manifest
207 committing changelog
207 committing changelog
208 running hook pretxncommit.test-saving-last-message: false
208 running hook pretxncommit.test-saving-last-message: false
209 transaction abort!
209 transaction abort!
210 rollback completed
210 rollback completed
211 abort: pretxncommit.test-saving-last-message hook exited with status 1
211 abort: pretxncommit.test-saving-last-message hook exited with status 1
212 [255]
212 [255]
213 $ cat .hg/last-message.txt
213 $ cat .hg/last-message.txt
214 message given from command line (no-eol)
214 message given from command line (no-eol)
215
215
216 $ rm -f .hg/last-message.txt
216 $ rm -f .hg/last-message.txt
217 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
217 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
218 amending changeset a9a13940fc03
218 amending changeset a9a13940fc03
219 copying changeset a9a13940fc03 to ad120869acf0
219 copying changeset a9a13940fc03 to ad120869acf0
220 no changes, new message
220 no changes, new message
221
221
222
222
223 HG: Enter commit message. Lines beginning with 'HG:' are removed.
223 HG: Enter commit message. Lines beginning with 'HG:' are removed.
224 HG: Leave message empty to abort commit.
224 HG: Leave message empty to abort commit.
225 HG: --
225 HG: --
226 HG: user: foo
226 HG: user: foo
227 HG: branch 'default'
227 HG: branch 'default'
228 HG: changed a
228 HG: changed a
229 committing files:
229 committing files:
230 a
230 a
231 committing manifest
231 committing manifest
232 committing changelog
232 committing changelog
233 running hook pretxncommit.test-saving-last-message: false
233 running hook pretxncommit.test-saving-last-message: false
234 transaction abort!
234 transaction abort!
235 rollback completed
235 rollback completed
236 abort: pretxncommit.test-saving-last-message hook exited with status 1
236 abort: pretxncommit.test-saving-last-message hook exited with status 1
237 [255]
237 [255]
238
238
239 $ cat .hg/last-message.txt
239 $ cat .hg/last-message.txt
240 another precious commit message
240 another precious commit message
241
241
242 $ cat > .hg/hgrc << '__EOF__'
242 $ cat > .hg/hgrc << '__EOF__'
243 > [hooks]
243 > [hooks]
244 > pretxncommit.test-saving-last-message =
244 > pretxncommit.test-saving-last-message =
245 > __EOF__
245 > __EOF__
246
246
247 then, test editing custom commit message
247 then, test editing custom commit message
248
248
249 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
249 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
250 amending changeset a9a13940fc03
250 amending changeset a9a13940fc03
251 copying changeset a9a13940fc03 to ad120869acf0
251 copying changeset a9a13940fc03 to ad120869acf0
252 no changes, new message
252 no changes, new message
253
253
254
254
255 HG: Enter commit message. Lines beginning with 'HG:' are removed.
255 HG: Enter commit message. Lines beginning with 'HG:' are removed.
256 HG: Leave message empty to abort commit.
256 HG: Leave message empty to abort commit.
257 HG: --
257 HG: --
258 HG: user: foo
258 HG: user: foo
259 HG: branch 'default'
259 HG: branch 'default'
260 HG: changed a
260 HG: changed a
261 committing files:
261 committing files:
262 a
262 a
263 committing manifest
263 committing manifest
264 committing changelog
264 committing changelog
265 1 changesets found
265 1 changesets found
266 uncompressed size of bundle content:
266 uncompressed size of bundle content:
267 249 (changelog)
267 249 (changelog)
268 163 (manifests)
268 163 (manifests)
269 133 a
269 133 a
270 saved backup bundle to $TESTTMP/.hg/strip-backup/a9a13940fc03-7c2e8674-amend.hg
270 saved backup bundle to $TESTTMP/.hg/strip-backup/a9a13940fc03-7c2e8674-amend.hg
271 1 changesets found
271 1 changesets found
272 uncompressed size of bundle content:
272 uncompressed size of bundle content:
273 257 (changelog)
273 257 (changelog)
274 163 (manifests)
274 163 (manifests)
275 133 a
275 133 a
276 adding branch
276 adding branch
277 adding changesets
277 adding changesets
278 adding manifests
278 adding manifests
279 adding file changes
279 adding file changes
280 added 1 changesets with 1 changes to 1 files
280 added 1 changesets with 1 changes to 1 files
281 committed changeset 1:64a124ba1b44
281 committed changeset 1:64a124ba1b44
282
282
283 Same, but with changes in working dir (different code path):
283 Same, but with changes in working dir (different code path):
284
284
285 $ echo a >> a
285 $ echo a >> a
286 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
286 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
287 amending changeset 64a124ba1b44
287 amending changeset 64a124ba1b44
288 another precious commit message
288 another precious commit message
289
289
290
290
291 HG: Enter commit message. Lines beginning with 'HG:' are removed.
291 HG: Enter commit message. Lines beginning with 'HG:' are removed.
292 HG: Leave message empty to abort commit.
292 HG: Leave message empty to abort commit.
293 HG: --
293 HG: --
294 HG: user: foo
294 HG: user: foo
295 HG: branch 'default'
295 HG: branch 'default'
296 HG: changed a
296 HG: changed a
297 committing files:
297 committing files:
298 a
298 a
299 committing manifest
299 committing manifest
300 committing changelog
300 committing changelog
301 1 changesets found
301 1 changesets found
302 uncompressed size of bundle content:
302 uncompressed size of bundle content:
303 257 (changelog)
303 257 (changelog)
304 163 (manifests)
304 163 (manifests)
305 133 a
305 133 a
306 saved backup bundle to $TESTTMP/.hg/strip-backup/64a124ba1b44-10374b8f-amend.hg
306 saved backup bundle to $TESTTMP/.hg/strip-backup/64a124ba1b44-10374b8f-amend.hg
307 1 changesets found
307 1 changesets found
308 uncompressed size of bundle content:
308 uncompressed size of bundle content:
309 257 (changelog)
309 257 (changelog)
310 163 (manifests)
310 163 (manifests)
311 135 a
311 135 a
312 adding branch
312 adding branch
313 adding changesets
313 adding changesets
314 adding manifests
314 adding manifests
315 adding file changes
315 adding file changes
316 added 1 changesets with 1 changes to 1 files
316 added 1 changesets with 1 changes to 1 files
317 committed changeset 1:7892795b8e38
317 committed changeset 1:7892795b8e38
318
318
319 $ rm editor.sh
319 $ rm editor.sh
320 $ hg log -r .
320 $ hg log -r .
321 changeset: 1:7892795b8e38
321 changeset: 1:7892795b8e38
322 tag: tip
322 tag: tip
323 user: foo
323 user: foo
324 date: Thu Jan 01 00:00:01 1970 +0000
324 date: Thu Jan 01 00:00:01 1970 +0000
325 summary: another precious commit message
325 summary: another precious commit message
326
326
327
327
328 Moving bookmarks, preserve active bookmark:
328 Moving bookmarks, preserve active bookmark:
329
329
330 $ hg book book1
330 $ hg book book1
331 $ hg book book2
331 $ hg book book2
332 $ hg ci --amend -m 'move bookmarks'
332 $ hg ci --amend -m 'move bookmarks'
333 saved backup bundle to $TESTTMP/.hg/strip-backup/7892795b8e38-3fb46217-amend.hg
333 saved backup bundle to $TESTTMP/.hg/strip-backup/7892795b8e38-3fb46217-amend.hg
334 $ hg book
334 $ hg book
335 book1 1:8311f17e2616
335 book1 1:8311f17e2616
336 * book2 1:8311f17e2616
336 * book2 1:8311f17e2616
337 $ echo a >> a
337 $ echo a >> a
338 $ hg ci --amend -m 'move bookmarks'
338 $ hg ci --amend -m 'move bookmarks'
339 saved backup bundle to $TESTTMP/.hg/strip-backup/8311f17e2616-f0504fe3-amend.hg
339 saved backup bundle to $TESTTMP/.hg/strip-backup/8311f17e2616-f0504fe3-amend.hg
340 $ hg book
340 $ hg book
341 book1 1:a3b65065808c
341 book1 1:a3b65065808c
342 * book2 1:a3b65065808c
342 * book2 1:a3b65065808c
343
343
344 abort does not loose bookmarks
344 abort does not loose bookmarks
345
345
346 $ cat > editor.sh << '__EOF__'
346 $ cat > editor.sh << '__EOF__'
347 > #!/bin/sh
347 > #!/bin/sh
348 > echo "" > "$1"
348 > echo "" > "$1"
349 > __EOF__
349 > __EOF__
350 $ echo a >> a
350 $ echo a >> a
351 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
351 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
352 abort: empty commit message
352 abort: empty commit message
353 [10]
353 [10]
354 $ hg book
354 $ hg book
355 book1 1:a3b65065808c
355 book1 1:a3b65065808c
356 * book2 1:a3b65065808c
356 * book2 1:a3b65065808c
357 $ hg revert -Caq
357 $ hg revert -Caq
358 $ rm editor.sh
358 $ rm editor.sh
359
359
360 $ echo '[defaults]' >> $HGRCPATH
360 $ echo '[defaults]' >> $HGRCPATH
361 $ echo "commit=-d '0 0'" >> $HGRCPATH
361 $ echo "commit=-d '0 0'" >> $HGRCPATH
362
362
363 Moving branches:
363 Moving branches:
364
364
365 $ hg branch foo
365 $ hg branch foo
366 marked working directory as branch foo
366 marked working directory as branch foo
367 (branches are permanent and global, did you want a bookmark?)
367 (branches are permanent and global, did you want a bookmark?)
368 $ echo a >> a
368 $ echo a >> a
369 $ hg ci -m 'branch foo'
369 $ hg ci -m 'branch foo'
370 $ hg branch default -f
370 $ hg branch default -f
371 marked working directory as branch default
371 marked working directory as branch default
372 $ hg ci --amend -m 'back to default'
372 $ hg ci --amend -m 'back to default'
373 saved backup bundle to $TESTTMP/.hg/strip-backup/f8339a38efe1-c18453c9-amend.hg
373 saved backup bundle to $TESTTMP/.hg/strip-backup/f8339a38efe1-c18453c9-amend.hg
374 $ hg branches
374 $ hg branches
375 default 2:9c07515f2650
375 default 2:9c07515f2650
376
376
377 Close branch:
377 Close branch:
378
378
379 $ hg up -q 0
379 $ hg up -q 0
380 $ echo b >> b
380 $ echo b >> b
381 $ hg branch foo
381 $ hg branch foo
382 marked working directory as branch foo
382 marked working directory as branch foo
383 (branches are permanent and global, did you want a bookmark?)
383 (branches are permanent and global, did you want a bookmark?)
384 $ hg ci -Am 'fork'
384 $ hg ci -Am 'fork'
385 adding b
385 adding b
386 $ echo b >> b
386 $ echo b >> b
387 $ hg ci -mb
387 $ hg ci -mb
388 $ hg ci --amend --close-branch -m 'closing branch foo'
388 $ hg ci --amend --close-branch -m 'closing branch foo'
389 saved backup bundle to $TESTTMP/.hg/strip-backup/c962248fa264-54245dc7-amend.hg
389 saved backup bundle to $TESTTMP/.hg/strip-backup/c962248fa264-54245dc7-amend.hg
390
390
391 Same thing, different code path:
391 Same thing, different code path:
392
392
393 $ echo b >> b
393 $ echo b >> b
394 $ hg ci -m 'reopen branch'
394 $ hg ci -m 'reopen branch'
395 reopening closed branch head 4
395 reopening closed branch head 4
396 $ echo b >> b
396 $ echo b >> b
397 $ hg ci --amend --close-branch
397 $ hg ci --amend --close-branch
398 saved backup bundle to $TESTTMP/.hg/strip-backup/027371728205-b900d9fa-amend.hg
398 saved backup bundle to $TESTTMP/.hg/strip-backup/027371728205-b900d9fa-amend.hg
399 $ hg branches
399 $ hg branches
400 default 2:9c07515f2650
400 default 2:9c07515f2650
401
401
402 Refuse to amend during a merge:
402 Refuse to amend during a merge:
403
403
404 $ hg up -q default
404 $ hg up -q default
405 $ hg merge foo
405 $ hg merge foo
406 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
406 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
407 (branch merge, don't forget to commit)
407 (branch merge, don't forget to commit)
408 $ hg ci --amend
408 $ hg ci --amend
409 abort: cannot amend while merging
409 abort: cannot amend while merging
410 [20]
410 [20]
411 $ hg ci -m 'merge'
411 $ hg ci -m 'merge'
412
412
413 Refuse to amend if there is a merge conflict (issue5805):
413 Refuse to amend if there is a merge conflict (issue5805):
414
414
415 $ hg up -q foo
415 $ hg up -q foo
416 $ echo c > a
416 $ echo c > a
417 $ hg up default -t :fail
417 $ hg up default -t :fail
418 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
418 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
419 use 'hg resolve' to retry unresolved file merges
419 use 'hg resolve' to retry unresolved file merges
420 [1]
420 [1]
421 $ hg resolve -l
421 $ hg resolve -l
422 U a
422 U a
423
423
424 $ hg ci --amend
424 $ hg ci --amend
425 abort: unresolved merge conflicts (see 'hg help resolve')
425 abort: unresolved merge conflicts (see 'hg help resolve')
426 [255]
426 [20]
427
427
428 $ hg up -qC .
428 $ hg up -qC .
429
429
430 Follow copies/renames:
430 Follow copies/renames:
431
431
432 $ hg mv b c
432 $ hg mv b c
433 $ hg ci -m 'b -> c'
433 $ hg ci -m 'b -> c'
434 $ hg mv c d
434 $ hg mv c d
435 $ hg ci --amend -m 'b -> d'
435 $ hg ci --amend -m 'b -> d'
436 saved backup bundle to $TESTTMP/.hg/strip-backup/42f3f27a067d-f23cc9f7-amend.hg
436 saved backup bundle to $TESTTMP/.hg/strip-backup/42f3f27a067d-f23cc9f7-amend.hg
437 $ hg st --rev '.^' --copies d
437 $ hg st --rev '.^' --copies d
438 A d
438 A d
439 b
439 b
440 $ hg cp d e
440 $ hg cp d e
441 $ hg ci -m 'e = d'
441 $ hg ci -m 'e = d'
442 $ hg cp e f
442 $ hg cp e f
443 $ hg ci --amend -m 'f = d'
443 $ hg ci --amend -m 'f = d'
444 saved backup bundle to $TESTTMP/.hg/strip-backup/9198f73182d5-251d584a-amend.hg
444 saved backup bundle to $TESTTMP/.hg/strip-backup/9198f73182d5-251d584a-amend.hg
445 $ hg st --rev '.^' --copies f
445 $ hg st --rev '.^' --copies f
446 A f
446 A f
447 d
447 d
448
448
449 $ mv f f.orig
449 $ mv f f.orig
450 $ hg rm -A f
450 $ hg rm -A f
451 $ hg ci -m removef
451 $ hg ci -m removef
452 $ hg cp a f
452 $ hg cp a f
453 $ mv f.orig f
453 $ mv f.orig f
454 $ hg ci --amend -m replacef
454 $ hg ci --amend -m replacef
455 saved backup bundle to $TESTTMP/.hg/strip-backup/f0993ab6b482-eda301bf-amend.hg
455 saved backup bundle to $TESTTMP/.hg/strip-backup/f0993ab6b482-eda301bf-amend.hg
456 $ hg st --change . --copies
456 $ hg st --change . --copies
457 $ hg log -r . --template "{file_copies}\n"
457 $ hg log -r . --template "{file_copies}\n"
458
458
459
459
460 Move added file (issue3410):
460 Move added file (issue3410):
461
461
462 $ echo g >> g
462 $ echo g >> g
463 $ hg ci -Am g
463 $ hg ci -Am g
464 adding g
464 adding g
465 $ hg mv g h
465 $ hg mv g h
466 $ hg ci --amend
466 $ hg ci --amend
467 saved backup bundle to $TESTTMP/.hg/strip-backup/58585e3f095c-0f5ebcda-amend.hg
467 saved backup bundle to $TESTTMP/.hg/strip-backup/58585e3f095c-0f5ebcda-amend.hg
468 $ hg st --change . --copies h
468 $ hg st --change . --copies h
469 A h
469 A h
470 $ hg log -r . --template "{file_copies}\n"
470 $ hg log -r . --template "{file_copies}\n"
471
471
472
472
473 Can't rollback an amend:
473 Can't rollback an amend:
474
474
475 $ hg rollback
475 $ hg rollback
476 no rollback information available
476 no rollback information available
477 [1]
477 [1]
478
478
479 Preserve extra dict (issue3430):
479 Preserve extra dict (issue3430):
480
480
481 $ hg branch a
481 $ hg branch a
482 marked working directory as branch a
482 marked working directory as branch a
483 (branches are permanent and global, did you want a bookmark?)
483 (branches are permanent and global, did you want a bookmark?)
484 $ echo a >> a
484 $ echo a >> a
485 $ hg ci -ma
485 $ hg ci -ma
486 $ hg ci --amend -m "a'"
486 $ hg ci --amend -m "a'"
487 saved backup bundle to $TESTTMP/.hg/strip-backup/39a162f1d65e-9dfe13d8-amend.hg
487 saved backup bundle to $TESTTMP/.hg/strip-backup/39a162f1d65e-9dfe13d8-amend.hg
488 $ hg log -r . --template "{branch}\n"
488 $ hg log -r . --template "{branch}\n"
489 a
489 a
490 $ hg ci --amend -m "a''"
490 $ hg ci --amend -m "a''"
491 saved backup bundle to $TESTTMP/.hg/strip-backup/d5ca7b1ac72b-0b4c1a34-amend.hg
491 saved backup bundle to $TESTTMP/.hg/strip-backup/d5ca7b1ac72b-0b4c1a34-amend.hg
492 $ hg log -r . --template "{branch}\n"
492 $ hg log -r . --template "{branch}\n"
493 a
493 a
494
494
495 Also preserve other entries in the dict that are in the old commit,
495 Also preserve other entries in the dict that are in the old commit,
496 first graft something so there's an additional entry:
496 first graft something so there's an additional entry:
497
497
498 $ hg up 0 -q
498 $ hg up 0 -q
499 $ echo z > z
499 $ echo z > z
500 $ hg ci -Am 'fork'
500 $ hg ci -Am 'fork'
501 adding z
501 adding z
502 created new head
502 created new head
503 $ hg up 11
503 $ hg up 11
504 5 files updated, 0 files merged, 1 files removed, 0 files unresolved
504 5 files updated, 0 files merged, 1 files removed, 0 files unresolved
505 $ hg graft 12
505 $ hg graft 12
506 grafting 12:2647734878ef "fork" (tip)
506 grafting 12:2647734878ef "fork" (tip)
507 $ hg ci --amend -m 'graft amend'
507 $ hg ci --amend -m 'graft amend'
508 saved backup bundle to $TESTTMP/.hg/strip-backup/fe8c6f7957ca-25638666-amend.hg
508 saved backup bundle to $TESTTMP/.hg/strip-backup/fe8c6f7957ca-25638666-amend.hg
509 $ hg log -r . --debug | grep extra
509 $ hg log -r . --debug | grep extra
510 extra: amend_source=fe8c6f7957ca1665ed77496ed7a07657d469ac60
510 extra: amend_source=fe8c6f7957ca1665ed77496ed7a07657d469ac60
511 extra: branch=a
511 extra: branch=a
512 extra: source=2647734878ef0236dda712fae9c1651cf694ea8a
512 extra: source=2647734878ef0236dda712fae9c1651cf694ea8a
513
513
514 Preserve phase
514 Preserve phase
515
515
516 $ hg phase '.^::.'
516 $ hg phase '.^::.'
517 11: draft
517 11: draft
518 13: draft
518 13: draft
519 $ hg phase --secret --force .
519 $ hg phase --secret --force .
520 $ hg phase '.^::.'
520 $ hg phase '.^::.'
521 11: draft
521 11: draft
522 13: secret
522 13: secret
523 $ hg commit --amend -m 'amend for phase' -q
523 $ hg commit --amend -m 'amend for phase' -q
524 $ hg phase '.^::.'
524 $ hg phase '.^::.'
525 11: draft
525 11: draft
526 13: secret
526 13: secret
527
527
528 Test amend with obsolete
528 Test amend with obsolete
529 ---------------------------
529 ---------------------------
530
530
531 Enable obsolete
531 Enable obsolete
532
532
533 $ cat >> $HGRCPATH << EOF
533 $ cat >> $HGRCPATH << EOF
534 > [experimental]
534 > [experimental]
535 > evolution.createmarkers=True
535 > evolution.createmarkers=True
536 > evolution.allowunstable=True
536 > evolution.allowunstable=True
537 > EOF
537 > EOF
538
538
539 Amend with no files changes
539 Amend with no files changes
540
540
541 $ hg id -n
541 $ hg id -n
542 13
542 13
543 $ hg ci --amend -m 'babar'
543 $ hg ci --amend -m 'babar'
544 $ hg id -n
544 $ hg id -n
545 14
545 14
546 $ hg log -Gl 3 --style=compact
546 $ hg log -Gl 3 --style=compact
547 @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test
547 @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test
548 | babar
548 | babar
549 |
549 |
550 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
550 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
551 | | fork
551 | | fork
552 | ~
552 | ~
553 o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test
553 o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test
554 | a''
554 | a''
555 ~
555 ~
556 $ hg log -Gl 4 --hidden --style=compact
556 $ hg log -Gl 4 --hidden --style=compact
557 @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test
557 @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test
558 | babar
558 | babar
559 |
559 |
560 | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test
560 | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test
561 |/ amend for phase
561 |/ amend for phase
562 |
562 |
563 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
563 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
564 | | fork
564 | | fork
565 | ~
565 | ~
566 o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test
566 o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test
567 | a''
567 | a''
568 ~
568 ~
569
569
570 Amend with files changes
570 Amend with files changes
571
571
572 (note: the extra commit over 15 is a temporary junk I would be happy to get
572 (note: the extra commit over 15 is a temporary junk I would be happy to get
573 ride of)
573 ride of)
574
574
575 $ echo 'babar' >> a
575 $ echo 'babar' >> a
576 $ hg commit --amend
576 $ hg commit --amend
577 $ hg log -Gl 6 --hidden --style=compact
577 $ hg log -Gl 6 --hidden --style=compact
578 @ 15[tip]:11 a5b42b49b0d5 1970-01-01 00:00 +0000 test
578 @ 15[tip]:11 a5b42b49b0d5 1970-01-01 00:00 +0000 test
579 | babar
579 | babar
580 |
580 |
581 | x 14:11 682950e85999 1970-01-01 00:00 +0000 test
581 | x 14:11 682950e85999 1970-01-01 00:00 +0000 test
582 |/ babar
582 |/ babar
583 |
583 |
584 | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test
584 | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test
585 |/ amend for phase
585 |/ amend for phase
586 |
586 |
587 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
587 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
588 | | fork
588 | | fork
589 | ~
589 | ~
590 o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test
590 o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test
591 | a''
591 | a''
592 |
592 |
593 o 10 5fa75032e226 1970-01-01 00:00 +0000 test
593 o 10 5fa75032e226 1970-01-01 00:00 +0000 test
594 | g
594 | g
595 ~
595 ~
596
596
597
597
598 Test that amend does not make it easy to create obsolescence cycle
598 Test that amend does not make it easy to create obsolescence cycle
599 ---------------------------------------------------------------------
599 ---------------------------------------------------------------------
600
600
601 $ hg id -r 14 --hidden
601 $ hg id -r 14 --hidden
602 682950e85999 (a)
602 682950e85999 (a)
603 $ hg revert -ar 14 --hidden
603 $ hg revert -ar 14 --hidden
604 reverting a
604 reverting a
605 $ hg commit --amend
605 $ hg commit --amend
606 $ hg id
606 $ hg id
607 37973c7e0b61 (a) tip
607 37973c7e0b61 (a) tip
608
608
609 Test that rewriting leaving instability behind is allowed
609 Test that rewriting leaving instability behind is allowed
610 ---------------------------------------------------------------------
610 ---------------------------------------------------------------------
611
611
612 $ hg up '.^'
612 $ hg up '.^'
613 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
613 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
614 $ echo 'b' >> a
614 $ echo 'b' >> a
615 $ hg log --style compact -r 'children(.)'
615 $ hg log --style compact -r 'children(.)'
616 16[tip]:11 37973c7e0b61 1970-01-01 00:00 +0000 test
616 16[tip]:11 37973c7e0b61 1970-01-01 00:00 +0000 test
617 babar
617 babar
618
618
619 $ hg commit --amend
619 $ hg commit --amend
620 1 new orphan changesets
620 1 new orphan changesets
621 $ hg log -r 'orphan()'
621 $ hg log -r 'orphan()'
622 changeset: 16:37973c7e0b61
622 changeset: 16:37973c7e0b61
623 branch: a
623 branch: a
624 parent: 11:0ddb275cfad1
624 parent: 11:0ddb275cfad1
625 user: test
625 user: test
626 date: Thu Jan 01 00:00:00 1970 +0000
626 date: Thu Jan 01 00:00:00 1970 +0000
627 instability: orphan
627 instability: orphan
628 summary: babar
628 summary: babar
629
629
630
630
631 Amend a merge changeset (with renames and conflicts from the second parent):
631 Amend a merge changeset (with renames and conflicts from the second parent):
632
632
633 $ hg up -q default
633 $ hg up -q default
634 $ hg branch -q bar
634 $ hg branch -q bar
635 $ hg cp a aa
635 $ hg cp a aa
636 $ hg mv z zz
636 $ hg mv z zz
637 $ echo cc > cc
637 $ echo cc > cc
638 $ hg add cc
638 $ hg add cc
639 $ hg ci -m aazzcc
639 $ hg ci -m aazzcc
640 $ hg up -q default
640 $ hg up -q default
641 $ echo a >> a
641 $ echo a >> a
642 $ echo dd > cc
642 $ echo dd > cc
643 $ hg add cc
643 $ hg add cc
644 $ hg ci -m aa
644 $ hg ci -m aa
645 $ hg merge -q bar
645 $ hg merge -q bar
646 warning: conflicts while merging cc! (edit, then use 'hg resolve --mark')
646 warning: conflicts while merging cc! (edit, then use 'hg resolve --mark')
647 [1]
647 [1]
648 $ hg resolve -m cc
648 $ hg resolve -m cc
649 (no more unresolved files)
649 (no more unresolved files)
650 $ hg ci -m 'merge bar'
650 $ hg ci -m 'merge bar'
651 $ hg log --config diff.git=1 -pr .
651 $ hg log --config diff.git=1 -pr .
652 changeset: 20:5aba7f3726e6
652 changeset: 20:5aba7f3726e6
653 tag: tip
653 tag: tip
654 parent: 19:30d96aeaf27b
654 parent: 19:30d96aeaf27b
655 parent: 18:1aa437659d19
655 parent: 18:1aa437659d19
656 user: test
656 user: test
657 date: Thu Jan 01 00:00:00 1970 +0000
657 date: Thu Jan 01 00:00:00 1970 +0000
658 summary: merge bar
658 summary: merge bar
659
659
660 diff --git a/a b/aa
660 diff --git a/a b/aa
661 copy from a
661 copy from a
662 copy to aa
662 copy to aa
663 diff --git a/cc b/cc
663 diff --git a/cc b/cc
664 --- a/cc
664 --- a/cc
665 +++ b/cc
665 +++ b/cc
666 @@ -1,1 +1,5 @@
666 @@ -1,1 +1,5 @@
667 +<<<<<<< working copy: 30d96aeaf27b - test: aa
667 +<<<<<<< working copy: 30d96aeaf27b - test: aa
668 dd
668 dd
669 +=======
669 +=======
670 +cc
670 +cc
671 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
671 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
672 diff --git a/z b/zz
672 diff --git a/z b/zz
673 rename from z
673 rename from z
674 rename to zz
674 rename to zz
675
675
676 $ hg debugrename aa
676 $ hg debugrename aa
677 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
677 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
678 $ hg debugrename zz
678 $ hg debugrename zz
679 zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a
679 zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a
680 $ hg debugrename cc
680 $ hg debugrename cc
681 cc not renamed
681 cc not renamed
682 $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -m 'merge bar (amend message)' --edit
682 $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -m 'merge bar (amend message)' --edit
683 HGEDITFORM=commit.amend.merge
683 HGEDITFORM=commit.amend.merge
684 $ hg log --config diff.git=1 -pr .
684 $ hg log --config diff.git=1 -pr .
685 changeset: 21:4b0631ef043e
685 changeset: 21:4b0631ef043e
686 tag: tip
686 tag: tip
687 parent: 19:30d96aeaf27b
687 parent: 19:30d96aeaf27b
688 parent: 18:1aa437659d19
688 parent: 18:1aa437659d19
689 user: test
689 user: test
690 date: Thu Jan 01 00:00:00 1970 +0000
690 date: Thu Jan 01 00:00:00 1970 +0000
691 summary: merge bar (amend message)
691 summary: merge bar (amend message)
692
692
693 diff --git a/a b/aa
693 diff --git a/a b/aa
694 copy from a
694 copy from a
695 copy to aa
695 copy to aa
696 diff --git a/cc b/cc
696 diff --git a/cc b/cc
697 --- a/cc
697 --- a/cc
698 +++ b/cc
698 +++ b/cc
699 @@ -1,1 +1,5 @@
699 @@ -1,1 +1,5 @@
700 +<<<<<<< working copy: 30d96aeaf27b - test: aa
700 +<<<<<<< working copy: 30d96aeaf27b - test: aa
701 dd
701 dd
702 +=======
702 +=======
703 +cc
703 +cc
704 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
704 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
705 diff --git a/z b/zz
705 diff --git a/z b/zz
706 rename from z
706 rename from z
707 rename to zz
707 rename to zz
708
708
709 $ hg debugrename aa
709 $ hg debugrename aa
710 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
710 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
711 $ hg debugrename zz
711 $ hg debugrename zz
712 zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a
712 zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a
713 $ hg debugrename cc
713 $ hg debugrename cc
714 cc not renamed
714 cc not renamed
715 $ hg mv zz z
715 $ hg mv zz z
716 $ hg ci --amend -m 'merge bar (undo rename)'
716 $ hg ci --amend -m 'merge bar (undo rename)'
717 $ hg log --config diff.git=1 -pr .
717 $ hg log --config diff.git=1 -pr .
718 changeset: 22:06423be42d60
718 changeset: 22:06423be42d60
719 tag: tip
719 tag: tip
720 parent: 19:30d96aeaf27b
720 parent: 19:30d96aeaf27b
721 parent: 18:1aa437659d19
721 parent: 18:1aa437659d19
722 user: test
722 user: test
723 date: Thu Jan 01 00:00:00 1970 +0000
723 date: Thu Jan 01 00:00:00 1970 +0000
724 summary: merge bar (undo rename)
724 summary: merge bar (undo rename)
725
725
726 diff --git a/a b/aa
726 diff --git a/a b/aa
727 copy from a
727 copy from a
728 copy to aa
728 copy to aa
729 diff --git a/cc b/cc
729 diff --git a/cc b/cc
730 --- a/cc
730 --- a/cc
731 +++ b/cc
731 +++ b/cc
732 @@ -1,1 +1,5 @@
732 @@ -1,1 +1,5 @@
733 +<<<<<<< working copy: 30d96aeaf27b - test: aa
733 +<<<<<<< working copy: 30d96aeaf27b - test: aa
734 dd
734 dd
735 +=======
735 +=======
736 +cc
736 +cc
737 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
737 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
738
738
739 $ hg debugrename z
739 $ hg debugrename z
740 z not renamed
740 z not renamed
741
741
742 Amend a merge changeset (with renames during the merge):
742 Amend a merge changeset (with renames during the merge):
743
743
744 $ hg up -q bar
744 $ hg up -q bar
745 $ echo x > x
745 $ echo x > x
746 $ hg add x
746 $ hg add x
747 $ hg ci -m x
747 $ hg ci -m x
748 $ hg up -q default
748 $ hg up -q default
749 $ hg merge -q bar
749 $ hg merge -q bar
750 $ hg mv aa aaa
750 $ hg mv aa aaa
751 $ echo aa >> aaa
751 $ echo aa >> aaa
752 $ hg ci -m 'merge bar again'
752 $ hg ci -m 'merge bar again'
753 $ hg log --config diff.git=1 -pr .
753 $ hg log --config diff.git=1 -pr .
754 changeset: 24:a89974a20457
754 changeset: 24:a89974a20457
755 tag: tip
755 tag: tip
756 parent: 22:06423be42d60
756 parent: 22:06423be42d60
757 parent: 23:4c94d5bc65f5
757 parent: 23:4c94d5bc65f5
758 user: test
758 user: test
759 date: Thu Jan 01 00:00:00 1970 +0000
759 date: Thu Jan 01 00:00:00 1970 +0000
760 summary: merge bar again
760 summary: merge bar again
761
761
762 diff --git a/aa b/aa
762 diff --git a/aa b/aa
763 deleted file mode 100644
763 deleted file mode 100644
764 --- a/aa
764 --- a/aa
765 +++ /dev/null
765 +++ /dev/null
766 @@ -1,2 +0,0 @@
766 @@ -1,2 +0,0 @@
767 -a
767 -a
768 -a
768 -a
769 diff --git a/aaa b/aaa
769 diff --git a/aaa b/aaa
770 new file mode 100644
770 new file mode 100644
771 --- /dev/null
771 --- /dev/null
772 +++ b/aaa
772 +++ b/aaa
773 @@ -0,0 +1,3 @@
773 @@ -0,0 +1,3 @@
774 +a
774 +a
775 +a
775 +a
776 +aa
776 +aa
777 diff --git a/x b/x
777 diff --git a/x b/x
778 new file mode 100644
778 new file mode 100644
779 --- /dev/null
779 --- /dev/null
780 +++ b/x
780 +++ b/x
781 @@ -0,0 +1,1 @@
781 @@ -0,0 +1,1 @@
782 +x
782 +x
783
783
784 $ hg debugrename aaa
784 $ hg debugrename aaa
785 aaa renamed from aa:37d9b5d994eab34eda9c16b195ace52c7b129980
785 aaa renamed from aa:37d9b5d994eab34eda9c16b195ace52c7b129980
786
786
787 Update to p1 with 'aaa' modified. 'aaa' was renamed from 'aa' in p2. 'aa' exists
787 Update to p1 with 'aaa' modified. 'aaa' was renamed from 'aa' in p2. 'aa' exists
788 in p1 too, but it was recorded as copied from p2.
788 in p1 too, but it was recorded as copied from p2.
789 $ echo modified >> aaa
789 $ echo modified >> aaa
790 $ hg co -m '.^' -t :merge3
790 $ hg co -m '.^' -t :merge3
791 file 'aaa' was deleted in other [destination] but was modified in local [working copy].
791 file 'aaa' was deleted in other [destination] but was modified in local [working copy].
792 You can use (c)hanged version, (d)elete, or leave (u)nresolved.
792 You can use (c)hanged version, (d)elete, or leave (u)nresolved.
793 What do you want to do? u
793 What do you want to do? u
794 1 files updated, 0 files merged, 1 files removed, 1 files unresolved
794 1 files updated, 0 files merged, 1 files removed, 1 files unresolved
795 use 'hg resolve' to retry unresolved file merges
795 use 'hg resolve' to retry unresolved file merges
796 [1]
796 [1]
797 $ hg co -C tip
797 $ hg co -C tip
798 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
798 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
799
799
800 $ hg mv aaa aa
800 $ hg mv aaa aa
801 $ hg ci --amend -m 'merge bar again (undo rename)'
801 $ hg ci --amend -m 'merge bar again (undo rename)'
802 $ hg log --config diff.git=1 -pr .
802 $ hg log --config diff.git=1 -pr .
803 changeset: 25:282080768800
803 changeset: 25:282080768800
804 tag: tip
804 tag: tip
805 parent: 22:06423be42d60
805 parent: 22:06423be42d60
806 parent: 23:4c94d5bc65f5
806 parent: 23:4c94d5bc65f5
807 user: test
807 user: test
808 date: Thu Jan 01 00:00:00 1970 +0000
808 date: Thu Jan 01 00:00:00 1970 +0000
809 summary: merge bar again (undo rename)
809 summary: merge bar again (undo rename)
810
810
811 diff --git a/aa b/aa
811 diff --git a/aa b/aa
812 --- a/aa
812 --- a/aa
813 +++ b/aa
813 +++ b/aa
814 @@ -1,2 +1,3 @@
814 @@ -1,2 +1,3 @@
815 a
815 a
816 a
816 a
817 +aa
817 +aa
818 diff --git a/x b/x
818 diff --git a/x b/x
819 new file mode 100644
819 new file mode 100644
820 --- /dev/null
820 --- /dev/null
821 +++ b/x
821 +++ b/x
822 @@ -0,0 +1,1 @@
822 @@ -0,0 +1,1 @@
823 +x
823 +x
824
824
825 $ hg debugrename aa
825 $ hg debugrename aa
826 aa not renamed
826 aa not renamed
827 $ hg debugrename -r '.^' aa
827 $ hg debugrename -r '.^' aa
828 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
828 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
829
829
830 Amend a merge changeset (with manifest-level conflicts):
830 Amend a merge changeset (with manifest-level conflicts):
831
831
832 $ hg up -q bar
832 $ hg up -q bar
833 $ hg rm aa
833 $ hg rm aa
834 $ hg ci -m 'rm aa'
834 $ hg ci -m 'rm aa'
835 $ hg up -q default
835 $ hg up -q default
836 $ echo aa >> aa
836 $ echo aa >> aa
837 $ hg ci -m aa
837 $ hg ci -m aa
838 $ hg merge -q bar --config ui.interactive=True << EOF
838 $ hg merge -q bar --config ui.interactive=True << EOF
839 > c
839 > c
840 > EOF
840 > EOF
841 file 'aa' was deleted in other [merge rev] but was modified in local [working copy].
841 file 'aa' was deleted in other [merge rev] but was modified in local [working copy].
842 You can use (c)hanged version, (d)elete, or leave (u)nresolved.
842 You can use (c)hanged version, (d)elete, or leave (u)nresolved.
843 What do you want to do? c
843 What do you want to do? c
844 $ hg ci -m 'merge bar (with conflicts)'
844 $ hg ci -m 'merge bar (with conflicts)'
845 $ hg log --config diff.git=1 -pr .
845 $ hg log --config diff.git=1 -pr .
846 changeset: 28:ed15db12298d
846 changeset: 28:ed15db12298d
847 tag: tip
847 tag: tip
848 parent: 27:eb5adec0b43b
848 parent: 27:eb5adec0b43b
849 parent: 26:67db8847a540
849 parent: 26:67db8847a540
850 user: test
850 user: test
851 date: Thu Jan 01 00:00:00 1970 +0000
851 date: Thu Jan 01 00:00:00 1970 +0000
852 summary: merge bar (with conflicts)
852 summary: merge bar (with conflicts)
853
853
854
854
855 $ hg rm aa
855 $ hg rm aa
856 $ hg ci --amend -m 'merge bar (with conflicts, amended)'
856 $ hg ci --amend -m 'merge bar (with conflicts, amended)'
857 $ hg log --config diff.git=1 -pr .
857 $ hg log --config diff.git=1 -pr .
858 changeset: 29:0eeafd043f63
858 changeset: 29:0eeafd043f63
859 tag: tip
859 tag: tip
860 parent: 27:eb5adec0b43b
860 parent: 27:eb5adec0b43b
861 parent: 26:67db8847a540
861 parent: 26:67db8847a540
862 user: test
862 user: test
863 date: Thu Jan 01 00:00:00 1970 +0000
863 date: Thu Jan 01 00:00:00 1970 +0000
864 summary: merge bar (with conflicts, amended)
864 summary: merge bar (with conflicts, amended)
865
865
866 diff --git a/aa b/aa
866 diff --git a/aa b/aa
867 deleted file mode 100644
867 deleted file mode 100644
868 --- a/aa
868 --- a/aa
869 +++ /dev/null
869 +++ /dev/null
870 @@ -1,4 +0,0 @@
870 @@ -1,4 +0,0 @@
871 -a
871 -a
872 -a
872 -a
873 -aa
873 -aa
874 -aa
874 -aa
875
875
876 Issue 3445: amending with --close-branch a commit that created a new head should fail
876 Issue 3445: amending with --close-branch a commit that created a new head should fail
877 This shouldn't be possible:
877 This shouldn't be possible:
878
878
879 $ hg up -q default
879 $ hg up -q default
880 $ hg branch closewithamend
880 $ hg branch closewithamend
881 marked working directory as branch closewithamend
881 marked working directory as branch closewithamend
882 $ echo foo > foo
882 $ echo foo > foo
883 $ hg add foo
883 $ hg add foo
884 $ hg ci -m..
884 $ hg ci -m..
885 $ hg ci --amend --close-branch -m 'closing'
885 $ hg ci --amend --close-branch -m 'closing'
886 abort: can only close branch heads
886 abort: can only close branch heads
887 [10]
887 [10]
888
888
889 This silliness fails:
889 This silliness fails:
890
890
891 $ hg branch silliness
891 $ hg branch silliness
892 marked working directory as branch silliness
892 marked working directory as branch silliness
893 $ echo b >> b
893 $ echo b >> b
894 $ hg ci --close-branch -m'open and close'
894 $ hg ci --close-branch -m'open and close'
895 abort: branch "silliness" has no heads to close
895 abort: branch "silliness" has no heads to close
896 [10]
896 [10]
897
897
898 Test that amend with --secret creates new secret changeset forcibly
898 Test that amend with --secret creates new secret changeset forcibly
899 ---------------------------------------------------------------------
899 ---------------------------------------------------------------------
900
900
901 $ hg phase '.^::.'
901 $ hg phase '.^::.'
902 29: draft
902 29: draft
903 30: draft
903 30: draft
904 $ hg commit --amend --secret -m 'amend as secret' -q
904 $ hg commit --amend --secret -m 'amend as secret' -q
905 $ hg phase '.^::.'
905 $ hg phase '.^::.'
906 29: draft
906 29: draft
907 31: secret
907 31: secret
908
908
909 Test that amend with --edit invokes editor forcibly
909 Test that amend with --edit invokes editor forcibly
910 ---------------------------------------------------
910 ---------------------------------------------------
911
911
912 $ hg parents --template "{desc}\n"
912 $ hg parents --template "{desc}\n"
913 amend as secret
913 amend as secret
914 $ HGEDITOR=cat hg commit --amend -m "editor should be suppressed"
914 $ HGEDITOR=cat hg commit --amend -m "editor should be suppressed"
915 $ hg parents --template "{desc}\n"
915 $ hg parents --template "{desc}\n"
916 editor should be suppressed
916 editor should be suppressed
917
917
918 $ hg status --rev '.^1::.'
918 $ hg status --rev '.^1::.'
919 A foo
919 A foo
920 $ HGEDITOR=cat hg commit --amend -m "editor should be invoked" --edit
920 $ HGEDITOR=cat hg commit --amend -m "editor should be invoked" --edit
921 editor should be invoked
921 editor should be invoked
922
922
923
923
924 HG: Enter commit message. Lines beginning with 'HG:' are removed.
924 HG: Enter commit message. Lines beginning with 'HG:' are removed.
925 HG: Leave message empty to abort commit.
925 HG: Leave message empty to abort commit.
926 HG: --
926 HG: --
927 HG: user: test
927 HG: user: test
928 HG: branch 'silliness'
928 HG: branch 'silliness'
929 HG: added foo
929 HG: added foo
930 $ hg parents --template "{desc}\n"
930 $ hg parents --template "{desc}\n"
931 editor should be invoked
931 editor should be invoked
932
932
933 Test that amend with --no-edit avoids the editor
933 Test that amend with --no-edit avoids the editor
934 ------------------------------------------------
934 ------------------------------------------------
935
935
936 $ hg commit --amend -m "before anything happens"
936 $ hg commit --amend -m "before anything happens"
937 $ hg parents --template "{desc}\n"
937 $ hg parents --template "{desc}\n"
938 before anything happens
938 before anything happens
939 $ HGEDITOR=cat hg commit --amend --no-edit -m "editor should be suppressed"
939 $ HGEDITOR=cat hg commit --amend --no-edit -m "editor should be suppressed"
940 $ hg parents --template "{desc}\n"
940 $ hg parents --template "{desc}\n"
941 editor should be suppressed
941 editor should be suppressed
942
942
943 (We need a file change here since we won't have a message change)
943 (We need a file change here since we won't have a message change)
944 $ cp foo foo.orig
944 $ cp foo foo.orig
945 $ echo hi >> foo
945 $ echo hi >> foo
946 $ HGEDITOR=cat hg commit --amend --no-edit
946 $ HGEDITOR=cat hg commit --amend --no-edit
947 $ hg parents --template "{desc}\n"
947 $ hg parents --template "{desc}\n"
948 editor should be suppressed
948 editor should be suppressed
949 $ hg status -mar
949 $ hg status -mar
950 (Let's undo adding that "hi" so later tests don't need to be adjusted)
950 (Let's undo adding that "hi" so later tests don't need to be adjusted)
951 $ mv foo.orig foo
951 $ mv foo.orig foo
952 $ hg commit --amend --no-edit
952 $ hg commit --amend --no-edit
953
953
954 Test that "diff()" in committemplate works correctly for amending
954 Test that "diff()" in committemplate works correctly for amending
955 -----------------------------------------------------------------
955 -----------------------------------------------------------------
956
956
957 $ cat >> .hg/hgrc <<EOF
957 $ cat >> .hg/hgrc <<EOF
958 > [committemplate]
958 > [committemplate]
959 > changeset.commit.amend = {desc}\n
959 > changeset.commit.amend = {desc}\n
960 > HG: M: {file_mods}
960 > HG: M: {file_mods}
961 > HG: A: {file_adds}
961 > HG: A: {file_adds}
962 > HG: R: {file_dels}
962 > HG: R: {file_dels}
963 > {splitlines(diff()) % 'HG: {line}\n'}
963 > {splitlines(diff()) % 'HG: {line}\n'}
964 > EOF
964 > EOF
965
965
966 $ hg parents --template "M: {file_mods}\nA: {file_adds}\nR: {file_dels}\n"
966 $ hg parents --template "M: {file_mods}\nA: {file_adds}\nR: {file_dels}\n"
967 M:
967 M:
968 A: foo
968 A: foo
969 R:
969 R:
970 $ hg status -amr
970 $ hg status -amr
971 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo"
971 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo"
972 expecting diff of foo
972 expecting diff of foo
973
973
974 HG: M:
974 HG: M:
975 HG: A: foo
975 HG: A: foo
976 HG: R:
976 HG: R:
977 HG: diff -r 0eeafd043f63 foo
977 HG: diff -r 0eeafd043f63 foo
978 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
978 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
979 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
979 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
980 HG: @@ -0,0 +1,1 @@
980 HG: @@ -0,0 +1,1 @@
981 HG: +foo
981 HG: +foo
982
982
983 $ echo y > y
983 $ echo y > y
984 $ hg add y
984 $ hg add y
985 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo and y"
985 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo and y"
986 expecting diff of foo and y
986 expecting diff of foo and y
987
987
988 HG: M:
988 HG: M:
989 HG: A: foo y
989 HG: A: foo y
990 HG: R:
990 HG: R:
991 HG: diff -r 0eeafd043f63 foo
991 HG: diff -r 0eeafd043f63 foo
992 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
992 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
993 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
993 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
994 HG: @@ -0,0 +1,1 @@
994 HG: @@ -0,0 +1,1 @@
995 HG: +foo
995 HG: +foo
996 HG: diff -r 0eeafd043f63 y
996 HG: diff -r 0eeafd043f63 y
997 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
997 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
998 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
998 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
999 HG: @@ -0,0 +1,1 @@
999 HG: @@ -0,0 +1,1 @@
1000 HG: +y
1000 HG: +y
1001
1001
1002 $ hg rm a
1002 $ hg rm a
1003 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo and y"
1003 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo and y"
1004 expecting diff of a, foo and y
1004 expecting diff of a, foo and y
1005
1005
1006 HG: M:
1006 HG: M:
1007 HG: A: foo y
1007 HG: A: foo y
1008 HG: R: a
1008 HG: R: a
1009 HG: diff -r 0eeafd043f63 a
1009 HG: diff -r 0eeafd043f63 a
1010 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
1010 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
1011 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1011 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1012 HG: @@ -1,2 +0,0 @@
1012 HG: @@ -1,2 +0,0 @@
1013 HG: -a
1013 HG: -a
1014 HG: -a
1014 HG: -a
1015 HG: diff -r 0eeafd043f63 foo
1015 HG: diff -r 0eeafd043f63 foo
1016 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1016 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1017 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
1017 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
1018 HG: @@ -0,0 +1,1 @@
1018 HG: @@ -0,0 +1,1 @@
1019 HG: +foo
1019 HG: +foo
1020 HG: diff -r 0eeafd043f63 y
1020 HG: diff -r 0eeafd043f63 y
1021 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1021 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1022 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1022 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1023 HG: @@ -0,0 +1,1 @@
1023 HG: @@ -0,0 +1,1 @@
1024 HG: +y
1024 HG: +y
1025
1025
1026 $ hg rm x
1026 $ hg rm x
1027 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo, x and y"
1027 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo, x and y"
1028 expecting diff of a, foo, x and y
1028 expecting diff of a, foo, x and y
1029
1029
1030 HG: M:
1030 HG: M:
1031 HG: A: foo y
1031 HG: A: foo y
1032 HG: R: a x
1032 HG: R: a x
1033 HG: diff -r 0eeafd043f63 a
1033 HG: diff -r 0eeafd043f63 a
1034 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
1034 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
1035 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1035 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1036 HG: @@ -1,2 +0,0 @@
1036 HG: @@ -1,2 +0,0 @@
1037 HG: -a
1037 HG: -a
1038 HG: -a
1038 HG: -a
1039 HG: diff -r 0eeafd043f63 foo
1039 HG: diff -r 0eeafd043f63 foo
1040 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1040 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1041 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
1041 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
1042 HG: @@ -0,0 +1,1 @@
1042 HG: @@ -0,0 +1,1 @@
1043 HG: +foo
1043 HG: +foo
1044 HG: diff -r 0eeafd043f63 x
1044 HG: diff -r 0eeafd043f63 x
1045 HG: --- a/x Thu Jan 01 00:00:00 1970 +0000
1045 HG: --- a/x Thu Jan 01 00:00:00 1970 +0000
1046 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1046 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1047 HG: @@ -1,1 +0,0 @@
1047 HG: @@ -1,1 +0,0 @@
1048 HG: -x
1048 HG: -x
1049 HG: diff -r 0eeafd043f63 y
1049 HG: diff -r 0eeafd043f63 y
1050 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1050 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1051 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1051 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1052 HG: @@ -0,0 +1,1 @@
1052 HG: @@ -0,0 +1,1 @@
1053 HG: +y
1053 HG: +y
1054
1054
1055 $ echo cccc >> cc
1055 $ echo cccc >> cc
1056 $ hg status -amr
1056 $ hg status -amr
1057 M cc
1057 M cc
1058 $ HGEDITOR=cat hg commit --amend -e -m "cc should be excluded" -X cc
1058 $ HGEDITOR=cat hg commit --amend -e -m "cc should be excluded" -X cc
1059 cc should be excluded
1059 cc should be excluded
1060
1060
1061 HG: M:
1061 HG: M:
1062 HG: A: foo y
1062 HG: A: foo y
1063 HG: R: a x
1063 HG: R: a x
1064 HG: diff -r 0eeafd043f63 a
1064 HG: diff -r 0eeafd043f63 a
1065 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
1065 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
1066 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1066 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1067 HG: @@ -1,2 +0,0 @@
1067 HG: @@ -1,2 +0,0 @@
1068 HG: -a
1068 HG: -a
1069 HG: -a
1069 HG: -a
1070 HG: diff -r 0eeafd043f63 foo
1070 HG: diff -r 0eeafd043f63 foo
1071 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1071 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1072 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
1072 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
1073 HG: @@ -0,0 +1,1 @@
1073 HG: @@ -0,0 +1,1 @@
1074 HG: +foo
1074 HG: +foo
1075 HG: diff -r 0eeafd043f63 x
1075 HG: diff -r 0eeafd043f63 x
1076 HG: --- a/x Thu Jan 01 00:00:00 1970 +0000
1076 HG: --- a/x Thu Jan 01 00:00:00 1970 +0000
1077 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1077 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1078 HG: @@ -1,1 +0,0 @@
1078 HG: @@ -1,1 +0,0 @@
1079 HG: -x
1079 HG: -x
1080 HG: diff -r 0eeafd043f63 y
1080 HG: diff -r 0eeafd043f63 y
1081 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1081 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1082 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1082 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1083 HG: @@ -0,0 +1,1 @@
1083 HG: @@ -0,0 +1,1 @@
1084 HG: +y
1084 HG: +y
1085
1085
1086 Check for issue4405
1086 Check for issue4405
1087 -------------------
1087 -------------------
1088
1088
1089 Setup the repo with a file that gets moved in a second commit.
1089 Setup the repo with a file that gets moved in a second commit.
1090 $ hg init repo
1090 $ hg init repo
1091 $ cd repo
1091 $ cd repo
1092 $ touch a0
1092 $ touch a0
1093 $ hg add a0
1093 $ hg add a0
1094 $ hg commit -m a0
1094 $ hg commit -m a0
1095 $ hg mv a0 a1
1095 $ hg mv a0 a1
1096 $ hg commit -m a1
1096 $ hg commit -m a1
1097 $ hg up -q 0
1097 $ hg up -q 0
1098 $ hg log -G --template '{rev} {desc}'
1098 $ hg log -G --template '{rev} {desc}'
1099 o 1 a1
1099 o 1 a1
1100 |
1100 |
1101 @ 0 a0
1101 @ 0 a0
1102
1102
1103
1103
1104 Now we branch the repro, but re-use the file contents, so we have a divergence
1104 Now we branch the repro, but re-use the file contents, so we have a divergence
1105 in the file revlog topology and the changelog topology.
1105 in the file revlog topology and the changelog topology.
1106 $ hg revert --rev 1 --all
1106 $ hg revert --rev 1 --all
1107 removing a0
1107 removing a0
1108 adding a1
1108 adding a1
1109 $ hg ci -qm 'a1-amend'
1109 $ hg ci -qm 'a1-amend'
1110 $ hg log -G --template '{rev} {desc}'
1110 $ hg log -G --template '{rev} {desc}'
1111 @ 2 a1-amend
1111 @ 2 a1-amend
1112 |
1112 |
1113 | o 1 a1
1113 | o 1 a1
1114 |/
1114 |/
1115 o 0 a0
1115 o 0 a0
1116
1116
1117
1117
1118 The way mercurial does amends is by folding the working copy and old commit
1118 The way mercurial does amends is by folding the working copy and old commit
1119 together into another commit (rev 3). During this process, _findlimit is called
1119 together into another commit (rev 3). During this process, _findlimit is called
1120 to check how far back to look for the transitive closure of file copy
1120 to check how far back to look for the transitive closure of file copy
1121 information, but due to the divergence of the filelog and changelog graph
1121 information, but due to the divergence of the filelog and changelog graph
1122 topologies, before _findlimit was fixed, it returned a rev which was not far
1122 topologies, before _findlimit was fixed, it returned a rev which was not far
1123 enough back in this case.
1123 enough back in this case.
1124 $ hg mv a1 a2
1124 $ hg mv a1 a2
1125 $ hg status --copies --rev 0
1125 $ hg status --copies --rev 0
1126 A a2
1126 A a2
1127 a0
1127 a0
1128 R a0
1128 R a0
1129 $ hg ci --amend -q
1129 $ hg ci --amend -q
1130 $ hg log -G --template '{rev} {desc}'
1130 $ hg log -G --template '{rev} {desc}'
1131 @ 3 a1-amend
1131 @ 3 a1-amend
1132 |
1132 |
1133 | o 1 a1
1133 | o 1 a1
1134 |/
1134 |/
1135 o 0 a0
1135 o 0 a0
1136
1136
1137
1137
1138 Before the fix, the copy information was lost.
1138 Before the fix, the copy information was lost.
1139 $ hg status --copies --rev 0
1139 $ hg status --copies --rev 0
1140 A a2
1140 A a2
1141 a0
1141 a0
1142 R a0
1142 R a0
1143 $ cd ..
1143 $ cd ..
1144
1144
1145 Check that amend properly preserve rename from directory rename (issue-4516)
1145 Check that amend properly preserve rename from directory rename (issue-4516)
1146
1146
1147 If a parent of the merge renames a full directory, any files added to the old
1147 If a parent of the merge renames a full directory, any files added to the old
1148 directory in the other parent will be renamed to the new directory. For some
1148 directory in the other parent will be renamed to the new directory. For some
1149 reason, the rename metadata was when amending such merge. This test ensure we
1149 reason, the rename metadata was when amending such merge. This test ensure we
1150 do not regress. We have a dedicated repo because it needs a setup with renamed
1150 do not regress. We have a dedicated repo because it needs a setup with renamed
1151 directory)
1151 directory)
1152
1152
1153 $ hg init issue4516
1153 $ hg init issue4516
1154 $ cd issue4516
1154 $ cd issue4516
1155 $ mkdir olddirname
1155 $ mkdir olddirname
1156 $ echo line1 > olddirname/commonfile.py
1156 $ echo line1 > olddirname/commonfile.py
1157 $ hg add olddirname/commonfile.py
1157 $ hg add olddirname/commonfile.py
1158 $ hg ci -m first
1158 $ hg ci -m first
1159
1159
1160 $ hg branch newdirname
1160 $ hg branch newdirname
1161 marked working directory as branch newdirname
1161 marked working directory as branch newdirname
1162 (branches are permanent and global, did you want a bookmark?)
1162 (branches are permanent and global, did you want a bookmark?)
1163 $ hg mv olddirname newdirname
1163 $ hg mv olddirname newdirname
1164 moving olddirname/commonfile.py to newdirname/commonfile.py
1164 moving olddirname/commonfile.py to newdirname/commonfile.py
1165 $ hg ci -m rename
1165 $ hg ci -m rename
1166
1166
1167 $ hg update default
1167 $ hg update default
1168 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1168 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1169 $ echo line1 > olddirname/newfile.py
1169 $ echo line1 > olddirname/newfile.py
1170 $ hg add olddirname/newfile.py
1170 $ hg add olddirname/newfile.py
1171 $ hg ci -m log
1171 $ hg ci -m log
1172
1172
1173 $ hg up newdirname
1173 $ hg up newdirname
1174 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1174 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1175 $ # create newdirname/newfile.py
1175 $ # create newdirname/newfile.py
1176 $ hg merge default
1176 $ hg merge default
1177 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1177 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1178 (branch merge, don't forget to commit)
1178 (branch merge, don't forget to commit)
1179 $ hg ci -m add
1179 $ hg ci -m add
1180 $
1180 $
1181 $ hg debugrename newdirname/newfile.py
1181 $ hg debugrename newdirname/newfile.py
1182 newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def
1182 newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def
1183 $ hg status -C --change .
1183 $ hg status -C --change .
1184 A newdirname/newfile.py
1184 A newdirname/newfile.py
1185 $ hg status -C --rev 1
1185 $ hg status -C --rev 1
1186 A newdirname/newfile.py
1186 A newdirname/newfile.py
1187 $ hg status -C --rev 2
1187 $ hg status -C --rev 2
1188 A newdirname/commonfile.py
1188 A newdirname/commonfile.py
1189 olddirname/commonfile.py
1189 olddirname/commonfile.py
1190 A newdirname/newfile.py
1190 A newdirname/newfile.py
1191 olddirname/newfile.py
1191 olddirname/newfile.py
1192 R olddirname/commonfile.py
1192 R olddirname/commonfile.py
1193 R olddirname/newfile.py
1193 R olddirname/newfile.py
1194 $ hg debugindex newdirname/newfile.py
1194 $ hg debugindex newdirname/newfile.py
1195 rev linkrev nodeid p1 p2
1195 rev linkrev nodeid p1 p2
1196 0 3 34a4d536c0c0 000000000000 000000000000
1196 0 3 34a4d536c0c0 000000000000 000000000000
1197
1197
1198 $ echo a >> newdirname/commonfile.py
1198 $ echo a >> newdirname/commonfile.py
1199 $ hg ci --amend -m bug
1199 $ hg ci --amend -m bug
1200 $ hg debugrename newdirname/newfile.py
1200 $ hg debugrename newdirname/newfile.py
1201 newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def
1201 newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def
1202 $ hg debugindex newdirname/newfile.py
1202 $ hg debugindex newdirname/newfile.py
1203 rev linkrev nodeid p1 p2
1203 rev linkrev nodeid p1 p2
1204 0 3 34a4d536c0c0 000000000000 000000000000
1204 0 3 34a4d536c0c0 000000000000 000000000000
1205
1205
1206 #if execbit
1206 #if execbit
1207
1207
1208 Test if amend preserves executable bit changes
1208 Test if amend preserves executable bit changes
1209 $ chmod +x newdirname/commonfile.py
1209 $ chmod +x newdirname/commonfile.py
1210 $ hg ci -m chmod
1210 $ hg ci -m chmod
1211 $ hg ci --amend -m "chmod amended"
1211 $ hg ci --amend -m "chmod amended"
1212 $ hg ci --amend -m "chmod amended second time"
1212 $ hg ci --amend -m "chmod amended second time"
1213 $ hg log -p --git -r .
1213 $ hg log -p --git -r .
1214 changeset: 7:b1326f52dddf
1214 changeset: 7:b1326f52dddf
1215 branch: newdirname
1215 branch: newdirname
1216 tag: tip
1216 tag: tip
1217 parent: 4:7fd235f7cb2f
1217 parent: 4:7fd235f7cb2f
1218 user: test
1218 user: test
1219 date: Thu Jan 01 00:00:00 1970 +0000
1219 date: Thu Jan 01 00:00:00 1970 +0000
1220 summary: chmod amended second time
1220 summary: chmod amended second time
1221
1221
1222 diff --git a/newdirname/commonfile.py b/newdirname/commonfile.py
1222 diff --git a/newdirname/commonfile.py b/newdirname/commonfile.py
1223 old mode 100644
1223 old mode 100644
1224 new mode 100755
1224 new mode 100755
1225
1225
1226 #endif
1226 #endif
1227
1227
1228 Test amend with file inclusion options
1228 Test amend with file inclusion options
1229 --------------------------------------
1229 --------------------------------------
1230
1230
1231 These tests ensure that we are always amending some files that were part of the
1231 These tests ensure that we are always amending some files that were part of the
1232 pre-amend commit. We want to test that the remaining files in the pre-amend
1232 pre-amend commit. We want to test that the remaining files in the pre-amend
1233 commit were not changed in the amended commit. We do so by performing a diff of
1233 commit were not changed in the amended commit. We do so by performing a diff of
1234 the amended commit against its parent commit.
1234 the amended commit against its parent commit.
1235 $ cd ..
1235 $ cd ..
1236 $ hg init testfileinclusions
1236 $ hg init testfileinclusions
1237 $ cd testfileinclusions
1237 $ cd testfileinclusions
1238 $ echo a > a
1238 $ echo a > a
1239 $ echo b > b
1239 $ echo b > b
1240 $ hg commit -Aqm "Adding a and b"
1240 $ hg commit -Aqm "Adding a and b"
1241
1241
1242 Only add changes to a particular file
1242 Only add changes to a particular file
1243 $ echo a >> a
1243 $ echo a >> a
1244 $ echo b >> b
1244 $ echo b >> b
1245 $ hg commit --amend -I a
1245 $ hg commit --amend -I a
1246 $ hg diff --git -r null -r .
1246 $ hg diff --git -r null -r .
1247 diff --git a/a b/a
1247 diff --git a/a b/a
1248 new file mode 100644
1248 new file mode 100644
1249 --- /dev/null
1249 --- /dev/null
1250 +++ b/a
1250 +++ b/a
1251 @@ -0,0 +1,2 @@
1251 @@ -0,0 +1,2 @@
1252 +a
1252 +a
1253 +a
1253 +a
1254 diff --git a/b b/b
1254 diff --git a/b b/b
1255 new file mode 100644
1255 new file mode 100644
1256 --- /dev/null
1256 --- /dev/null
1257 +++ b/b
1257 +++ b/b
1258 @@ -0,0 +1,1 @@
1258 @@ -0,0 +1,1 @@
1259 +b
1259 +b
1260
1260
1261 $ echo a >> a
1261 $ echo a >> a
1262 $ hg commit --amend b
1262 $ hg commit --amend b
1263 $ hg diff --git -r null -r .
1263 $ hg diff --git -r null -r .
1264 diff --git a/a b/a
1264 diff --git a/a b/a
1265 new file mode 100644
1265 new file mode 100644
1266 --- /dev/null
1266 --- /dev/null
1267 +++ b/a
1267 +++ b/a
1268 @@ -0,0 +1,2 @@
1268 @@ -0,0 +1,2 @@
1269 +a
1269 +a
1270 +a
1270 +a
1271 diff --git a/b b/b
1271 diff --git a/b b/b
1272 new file mode 100644
1272 new file mode 100644
1273 --- /dev/null
1273 --- /dev/null
1274 +++ b/b
1274 +++ b/b
1275 @@ -0,0 +1,2 @@
1275 @@ -0,0 +1,2 @@
1276 +b
1276 +b
1277 +b
1277 +b
1278
1278
1279 Exclude changes to a particular file
1279 Exclude changes to a particular file
1280 $ echo b >> b
1280 $ echo b >> b
1281 $ hg commit --amend -X a
1281 $ hg commit --amend -X a
1282 $ hg diff --git -r null -r .
1282 $ hg diff --git -r null -r .
1283 diff --git a/a b/a
1283 diff --git a/a b/a
1284 new file mode 100644
1284 new file mode 100644
1285 --- /dev/null
1285 --- /dev/null
1286 +++ b/a
1286 +++ b/a
1287 @@ -0,0 +1,2 @@
1287 @@ -0,0 +1,2 @@
1288 +a
1288 +a
1289 +a
1289 +a
1290 diff --git a/b b/b
1290 diff --git a/b b/b
1291 new file mode 100644
1291 new file mode 100644
1292 --- /dev/null
1292 --- /dev/null
1293 +++ b/b
1293 +++ b/b
1294 @@ -0,0 +1,3 @@
1294 @@ -0,0 +1,3 @@
1295 +b
1295 +b
1296 +b
1296 +b
1297 +b
1297 +b
1298
1298
1299 Check the addremove flag
1299 Check the addremove flag
1300 $ echo c > c
1300 $ echo c > c
1301 $ rm a
1301 $ rm a
1302 $ hg commit --amend -A
1302 $ hg commit --amend -A
1303 removing a
1303 removing a
1304 adding c
1304 adding c
1305 $ hg diff --git -r null -r .
1305 $ hg diff --git -r null -r .
1306 diff --git a/b b/b
1306 diff --git a/b b/b
1307 new file mode 100644
1307 new file mode 100644
1308 --- /dev/null
1308 --- /dev/null
1309 +++ b/b
1309 +++ b/b
1310 @@ -0,0 +1,3 @@
1310 @@ -0,0 +1,3 @@
1311 +b
1311 +b
1312 +b
1312 +b
1313 +b
1313 +b
1314 diff --git a/c b/c
1314 diff --git a/c b/c
1315 new file mode 100644
1315 new file mode 100644
1316 --- /dev/null
1316 --- /dev/null
1317 +++ b/c
1317 +++ b/c
1318 @@ -0,0 +1,1 @@
1318 @@ -0,0 +1,1 @@
1319 +c
1319 +c
@@ -1,157 +1,157 b''
1 #testcases abortcommand abortflag
1 #testcases abortcommand abortflag
2 #if abortflag
2 #if abortflag
3 $ cat >> $HGRCPATH <<EOF
3 $ cat >> $HGRCPATH <<EOF
4 > [alias]
4 > [alias]
5 > abort = merge --abort
5 > abort = merge --abort
6 > EOF
6 > EOF
7 #endif
7 #endif
8
8
9 $ addcommit () {
9 $ addcommit () {
10 > echo $1 > $1
10 > echo $1 > $1
11 > hg add $1
11 > hg add $1
12 > hg commit -d "${2} 0" -m $1
12 > hg commit -d "${2} 0" -m $1
13 > }
13 > }
14
14
15 $ commit () {
15 $ commit () {
16 > hg commit -d "${2} 0" -m $1
16 > hg commit -d "${2} 0" -m $1
17 > }
17 > }
18
18
19 $ hg init a
19 $ hg init a
20 $ cd a
20 $ cd a
21 $ addcommit "A" 0
21 $ addcommit "A" 0
22 $ addcommit "B" 1
22 $ addcommit "B" 1
23 $ echo "C" >> A
23 $ echo "C" >> A
24 $ commit "C" 2
24 $ commit "C" 2
25
25
26 $ hg update -C 0
26 $ hg update -C 0
27 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
27 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
28 $ echo "D" >> A
28 $ echo "D" >> A
29 $ commit "D" 3
29 $ commit "D" 3
30 created new head
30 created new head
31
31
32 State before the merge
32 State before the merge
33
33
34 $ hg status
34 $ hg status
35 $ hg id
35 $ hg id
36 e45016d2b3d3 tip
36 e45016d2b3d3 tip
37 $ hg summary
37 $ hg summary
38 parent: 3:e45016d2b3d3 tip
38 parent: 3:e45016d2b3d3 tip
39 D
39 D
40 branch: default
40 branch: default
41 commit: (clean)
41 commit: (clean)
42 update: 2 new changesets, 2 branch heads (merge)
42 update: 2 new changesets, 2 branch heads (merge)
43 phases: 4 draft
43 phases: 4 draft
44
44
45 Testing the abort functionality first in case of conflicts
45 Testing the abort functionality first in case of conflicts
46
46
47 $ hg abort
47 $ hg abort
48 abort: no merge in progress (abortflag !)
48 abort: no merge in progress (abortflag !)
49 abort: no operation in progress (abortcommand !)
49 abort: no operation in progress (abortcommand !)
50 [20]
50 [20]
51
51
52 $ hg merge
52 $ hg merge
53 merging A
53 merging A
54 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
54 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
55 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
55 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
56 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
56 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
57 [1]
57 [1]
58
58
59 $ hg merge --abort e4501
59 $ hg merge --abort e4501
60 abort: cannot specify a node with --abort
60 abort: cannot specify a node with --abort
61 [10]
61 [10]
62 $ hg merge --abort --rev e4501
62 $ hg merge --abort --rev e4501
63 abort: cannot specify both --abort and --rev
63 abort: cannot specify both --abort and --rev
64 [10]
64 [10]
65
65
66 #if abortcommand
66 #if abortcommand
67 when in dry-run mode
67 when in dry-run mode
68 $ hg abort --dry-run
68 $ hg abort --dry-run
69 merge in progress, will be aborted
69 merge in progress, will be aborted
70 #endif
70 #endif
71
71
72 $ hg abort
72 $ hg abort
73 aborting the merge, updating back to e45016d2b3d3
73 aborting the merge, updating back to e45016d2b3d3
74 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
74 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
75
75
76 Checking that we got back in the same state
76 Checking that we got back in the same state
77
77
78 $ hg status
78 $ hg status
79 ? A.orig
79 ? A.orig
80 $ hg id
80 $ hg id
81 e45016d2b3d3 tip
81 e45016d2b3d3 tip
82 $ hg summary
82 $ hg summary
83 parent: 3:e45016d2b3d3 tip
83 parent: 3:e45016d2b3d3 tip
84 D
84 D
85 branch: default
85 branch: default
86 commit: 1 unknown (clean)
86 commit: 1 unknown (clean)
87 update: 2 new changesets, 2 branch heads (merge)
87 update: 2 new changesets, 2 branch heads (merge)
88 phases: 4 draft
88 phases: 4 draft
89
89
90 Merging a conflict araises
90 Merging a conflict araises
91
91
92 $ hg merge
92 $ hg merge
93 merging A
93 merging A
94 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
94 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
95 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
95 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
96 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
96 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
97 [1]
97 [1]
98
98
99 Correct the conflict without marking the file as resolved
99 Correct the conflict without marking the file as resolved
100
100
101 $ echo "ABCD" > A
101 $ echo "ABCD" > A
102 $ hg commit -m "Merged"
102 $ hg commit -m "Merged"
103 abort: unresolved merge conflicts (see 'hg help resolve')
103 abort: unresolved merge conflicts (see 'hg help resolve')
104 [255]
104 [20]
105
105
106 Mark the conflict as resolved and commit
106 Mark the conflict as resolved and commit
107
107
108 $ hg resolve -m A
108 $ hg resolve -m A
109 (no more unresolved files)
109 (no more unresolved files)
110 $ hg commit -m "Merged"
110 $ hg commit -m "Merged"
111
111
112 Test that if a file is removed but not marked resolved, the commit still fails
112 Test that if a file is removed but not marked resolved, the commit still fails
113 (issue4972)
113 (issue4972)
114
114
115 $ hg up ".^"
115 $ hg up ".^"
116 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
116 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
117 $ hg merge 2
117 $ hg merge 2
118 merging A
118 merging A
119 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
119 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
120 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
120 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
121 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
121 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
122 [1]
122 [1]
123 $ hg rm --force A
123 $ hg rm --force A
124 $ hg commit -m merged
124 $ hg commit -m merged
125 abort: unresolved merge conflicts (see 'hg help resolve')
125 abort: unresolved merge conflicts (see 'hg help resolve')
126 [255]
126 [20]
127
127
128 $ hg resolve -ma
128 $ hg resolve -ma
129 (no more unresolved files)
129 (no more unresolved files)
130 $ hg commit -m merged
130 $ hg commit -m merged
131 created new head
131 created new head
132
132
133 Testing the abort functionality in case of no conflicts
133 Testing the abort functionality in case of no conflicts
134
134
135 $ hg update -C 0
135 $ hg update -C 0
136 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
136 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
137 $ addcommit "E" 4
137 $ addcommit "E" 4
138 created new head
138 created new head
139 $ hg id
139 $ hg id
140 68352a18a7c4 tip
140 68352a18a7c4 tip
141
141
142 $ hg merge -r 4
142 $ hg merge -r 4
143 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
143 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
144 (branch merge, don't forget to commit)
144 (branch merge, don't forget to commit)
145
145
146 $ hg merge --preview --abort
146 $ hg merge --preview --abort
147 abort: cannot specify both --abort and --preview
147 abort: cannot specify both --abort and --preview
148 [10]
148 [10]
149
149
150 $ hg abort
150 $ hg abort
151 aborting the merge, updating back to 68352a18a7c4
151 aborting the merge, updating back to 68352a18a7c4
152 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
152 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
153
153
154 $ hg id
154 $ hg id
155 68352a18a7c4 tip
155 68352a18a7c4 tip
156
156
157 $ cd ..
157 $ cd ..
@@ -1,934 +1,934 b''
1 $ cat >> $HGRCPATH <<EOF
1 $ cat >> $HGRCPATH <<EOF
2 > [extdiff]
2 > [extdiff]
3 > # for portability:
3 > # for portability:
4 > pdiff = sh "$RUNTESTDIR/pdiff"
4 > pdiff = sh "$RUNTESTDIR/pdiff"
5 > EOF
5 > EOF
6
6
7 Create a repo with some stuff in it:
7 Create a repo with some stuff in it:
8
8
9 $ hg init a
9 $ hg init a
10 $ cd a
10 $ cd a
11 $ echo a > a
11 $ echo a > a
12 $ echo a > d
12 $ echo a > d
13 $ echo a > e
13 $ echo a > e
14 $ hg ci -qAm0
14 $ hg ci -qAm0
15 $ echo b > a
15 $ echo b > a
16 $ hg ci -m1 -u bar
16 $ hg ci -m1 -u bar
17 $ hg mv a b
17 $ hg mv a b
18 $ hg ci -m2
18 $ hg ci -m2
19 $ hg cp b c
19 $ hg cp b c
20 $ hg ci -m3 -u baz
20 $ hg ci -m3 -u baz
21 $ echo b > d
21 $ echo b > d
22 $ echo f > e
22 $ echo f > e
23 $ hg ci -m4
23 $ hg ci -m4
24 $ hg up -q 3
24 $ hg up -q 3
25 $ echo b > e
25 $ echo b > e
26 $ hg branch -q stable
26 $ hg branch -q stable
27 $ hg ci -m5
27 $ hg ci -m5
28 $ hg merge -q default --tool internal:local # for conflicts in e, choose 5 and ignore 4
28 $ hg merge -q default --tool internal:local # for conflicts in e, choose 5 and ignore 4
29 $ hg branch -q default
29 $ hg branch -q default
30 $ hg ci -m6
30 $ hg ci -m6
31 $ hg phase --public 3
31 $ hg phase --public 3
32 $ hg phase --force --secret 6
32 $ hg phase --force --secret 6
33
33
34 $ hg log -G --template '{author}@{rev}.{phase}: {desc}\n'
34 $ hg log -G --template '{author}@{rev}.{phase}: {desc}\n'
35 @ test@6.secret: 6
35 @ test@6.secret: 6
36 |\
36 |\
37 | o test@5.draft: 5
37 | o test@5.draft: 5
38 | |
38 | |
39 o | test@4.draft: 4
39 o | test@4.draft: 4
40 |/
40 |/
41 o baz@3.public: 3
41 o baz@3.public: 3
42 |
42 |
43 o test@2.public: 2
43 o test@2.public: 2
44 |
44 |
45 o bar@1.public: 1
45 o bar@1.public: 1
46 |
46 |
47 o test@0.public: 0
47 o test@0.public: 0
48
48
49 Test --base for grafting the merge of 4 from the perspective of 5, thus only getting the change to d
49 Test --base for grafting the merge of 4 from the perspective of 5, thus only getting the change to d
50
50
51 $ hg up -cqr 3
51 $ hg up -cqr 3
52 $ hg graft -r 6 --base 5
52 $ hg graft -r 6 --base 5
53 grafting 6:25a2b029d3ae "6" (tip)
53 grafting 6:25a2b029d3ae "6" (tip)
54 merging e
54 merging e
55 $ hg st --change .
55 $ hg st --change .
56 M d
56 M d
57
57
58 $ hg -q strip . --config extensions.strip=
58 $ hg -q strip . --config extensions.strip=
59
59
60 Test --base for collapsing changesets 2 and 3, thus getting both b and c
60 Test --base for collapsing changesets 2 and 3, thus getting both b and c
61
61
62 $ hg up -cqr 0
62 $ hg up -cqr 0
63 $ hg graft -r 3 --base 1
63 $ hg graft -r 3 --base 1
64 grafting 3:4c60f11aa304 "3"
64 grafting 3:4c60f11aa304 "3"
65 merging a and b to b
65 merging a and b to b
66 merging a and c to c
66 merging a and c to c
67 $ hg st --change .
67 $ hg st --change .
68 A b
68 A b
69 A c
69 A c
70 R a
70 R a
71
71
72 $ hg -q strip . --config extensions.strip=
72 $ hg -q strip . --config extensions.strip=
73
73
74 Specifying child as --base revision fails safely (perhaps slightly confusing, but consistent)
74 Specifying child as --base revision fails safely (perhaps slightly confusing, but consistent)
75
75
76 $ hg graft -r 2 --base 3
76 $ hg graft -r 2 --base 3
77 grafting 2:5c095ad7e90f "2"
77 grafting 2:5c095ad7e90f "2"
78 note: possible conflict - c was deleted and renamed to:
78 note: possible conflict - c was deleted and renamed to:
79 a
79 a
80 note: graft of 2:5c095ad7e90f created no changes to commit
80 note: graft of 2:5c095ad7e90f created no changes to commit
81
81
82 Can't continue without starting:
82 Can't continue without starting:
83
83
84 $ hg -q up -cr tip
84 $ hg -q up -cr tip
85 $ hg rm -q e
85 $ hg rm -q e
86 $ hg graft --continue
86 $ hg graft --continue
87 abort: no graft in progress
87 abort: no graft in progress
88 [20]
88 [20]
89 $ hg revert -r . -q e
89 $ hg revert -r . -q e
90
90
91 Need to specify a rev:
91 Need to specify a rev:
92
92
93 $ hg graft
93 $ hg graft
94 abort: no revisions specified
94 abort: no revisions specified
95 [10]
95 [10]
96
96
97 Can't graft ancestor:
97 Can't graft ancestor:
98
98
99 $ hg graft 1 2
99 $ hg graft 1 2
100 skipping ancestor revision 1:5d205f8b35b6
100 skipping ancestor revision 1:5d205f8b35b6
101 skipping ancestor revision 2:5c095ad7e90f
101 skipping ancestor revision 2:5c095ad7e90f
102 [255]
102 [255]
103
103
104 Specify revisions with -r:
104 Specify revisions with -r:
105
105
106 $ hg graft -r 1 -r 2
106 $ hg graft -r 1 -r 2
107 skipping ancestor revision 1:5d205f8b35b6
107 skipping ancestor revision 1:5d205f8b35b6
108 skipping ancestor revision 2:5c095ad7e90f
108 skipping ancestor revision 2:5c095ad7e90f
109 [255]
109 [255]
110
110
111 $ hg graft -r 1 2
111 $ hg graft -r 1 2
112 warning: inconsistent use of --rev might give unexpected revision ordering!
112 warning: inconsistent use of --rev might give unexpected revision ordering!
113 skipping ancestor revision 2:5c095ad7e90f
113 skipping ancestor revision 2:5c095ad7e90f
114 skipping ancestor revision 1:5d205f8b35b6
114 skipping ancestor revision 1:5d205f8b35b6
115 [255]
115 [255]
116
116
117 Conflicting date/user options:
117 Conflicting date/user options:
118
118
119 $ hg up -q 0
119 $ hg up -q 0
120 $ hg graft -U --user foo 2
120 $ hg graft -U --user foo 2
121 abort: cannot specify both --user and --currentuser
121 abort: cannot specify both --user and --currentuser
122 [10]
122 [10]
123 $ hg graft -D --date '0 0' 2
123 $ hg graft -D --date '0 0' 2
124 abort: cannot specify both --date and --currentdate
124 abort: cannot specify both --date and --currentdate
125 [10]
125 [10]
126
126
127 Can't graft with dirty wd:
127 Can't graft with dirty wd:
128
128
129 $ hg up -q 0
129 $ hg up -q 0
130 $ echo foo > a
130 $ echo foo > a
131 $ hg graft 1
131 $ hg graft 1
132 abort: uncommitted changes
132 abort: uncommitted changes
133 [20]
133 [20]
134 $ hg revert a
134 $ hg revert a
135
135
136 Graft a rename:
136 Graft a rename:
137 (this also tests that editor is invoked if '--edit' is specified)
137 (this also tests that editor is invoked if '--edit' is specified)
138
138
139 $ hg status --rev "2^1" --rev 2
139 $ hg status --rev "2^1" --rev 2
140 A b
140 A b
141 R a
141 R a
142 $ HGEDITOR=cat hg graft 2 -u foo --edit
142 $ HGEDITOR=cat hg graft 2 -u foo --edit
143 grafting 2:5c095ad7e90f "2"
143 grafting 2:5c095ad7e90f "2"
144 merging a and b to b
144 merging a and b to b
145 2
145 2
146
146
147
147
148 HG: Enter commit message. Lines beginning with 'HG:' are removed.
148 HG: Enter commit message. Lines beginning with 'HG:' are removed.
149 HG: Leave message empty to abort commit.
149 HG: Leave message empty to abort commit.
150 HG: --
150 HG: --
151 HG: user: foo
151 HG: user: foo
152 HG: branch 'default'
152 HG: branch 'default'
153 HG: added b
153 HG: added b
154 HG: removed a
154 HG: removed a
155 $ hg export tip --git
155 $ hg export tip --git
156 # HG changeset patch
156 # HG changeset patch
157 # User foo
157 # User foo
158 # Date 0 0
158 # Date 0 0
159 # Thu Jan 01 00:00:00 1970 +0000
159 # Thu Jan 01 00:00:00 1970 +0000
160 # Node ID ef0ef43d49e79e81ddafdc7997401ba0041efc82
160 # Node ID ef0ef43d49e79e81ddafdc7997401ba0041efc82
161 # Parent 68795b066622ca79a25816a662041d8f78f3cd9e
161 # Parent 68795b066622ca79a25816a662041d8f78f3cd9e
162 2
162 2
163
163
164 diff --git a/a b/b
164 diff --git a/a b/b
165 rename from a
165 rename from a
166 rename to b
166 rename to b
167
167
168 Look for extra:source
168 Look for extra:source
169
169
170 $ hg log --debug -r tip
170 $ hg log --debug -r tip
171 changeset: 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82
171 changeset: 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82
172 tag: tip
172 tag: tip
173 phase: draft
173 phase: draft
174 parent: 0:68795b066622ca79a25816a662041d8f78f3cd9e
174 parent: 0:68795b066622ca79a25816a662041d8f78f3cd9e
175 parent: -1:0000000000000000000000000000000000000000
175 parent: -1:0000000000000000000000000000000000000000
176 manifest: 7:e59b6b228f9cbf9903d5e9abf996e083a1f533eb
176 manifest: 7:e59b6b228f9cbf9903d5e9abf996e083a1f533eb
177 user: foo
177 user: foo
178 date: Thu Jan 01 00:00:00 1970 +0000
178 date: Thu Jan 01 00:00:00 1970 +0000
179 files+: b
179 files+: b
180 files-: a
180 files-: a
181 extra: branch=default
181 extra: branch=default
182 extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4
182 extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4
183 description:
183 description:
184 2
184 2
185
185
186
186
187
187
188 Graft out of order, skipping a merge and a duplicate
188 Graft out of order, skipping a merge and a duplicate
189 (this also tests that editor is not invoked if '--edit' is not specified)
189 (this also tests that editor is not invoked if '--edit' is not specified)
190
190
191 $ hg graft 1 5 4 3 'merge()' 2 -n
191 $ hg graft 1 5 4 3 'merge()' 2 -n
192 skipping ungraftable merge revision 6
192 skipping ungraftable merge revision 6
193 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
193 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
194 grafting 1:5d205f8b35b6 "1"
194 grafting 1:5d205f8b35b6 "1"
195 grafting 5:97f8bfe72746 "5"
195 grafting 5:97f8bfe72746 "5"
196 grafting 4:9c233e8e184d "4"
196 grafting 4:9c233e8e184d "4"
197 grafting 3:4c60f11aa304 "3"
197 grafting 3:4c60f11aa304 "3"
198
198
199 $ HGEDITOR=cat hg graft 1 5 'merge()' 2 --debug
199 $ HGEDITOR=cat hg graft 1 5 'merge()' 2 --debug
200 skipping ungraftable merge revision 6
200 skipping ungraftable merge revision 6
201 scanning for duplicate grafts
201 scanning for duplicate grafts
202 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
202 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
203 grafting 1:5d205f8b35b6 "1"
203 grafting 1:5d205f8b35b6 "1"
204 unmatched files in local:
204 unmatched files in local:
205 b
205 b
206 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
206 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
207 on local side:
207 on local side:
208 src: 'a' -> dst: 'b' *
208 src: 'a' -> dst: 'b' *
209 checking for directory renames
209 checking for directory renames
210 resolving manifests
210 resolving manifests
211 branchmerge: True, force: True, partial: False
211 branchmerge: True, force: True, partial: False
212 ancestor: 68795b066622, local: ef0ef43d49e7+, remote: 5d205f8b35b6
212 ancestor: 68795b066622, local: ef0ef43d49e7+, remote: 5d205f8b35b6
213 preserving b for resolve of b
213 preserving b for resolve of b
214 starting 4 threads for background file closing (?)
214 starting 4 threads for background file closing (?)
215 b: local copied/moved from a -> m (premerge)
215 b: local copied/moved from a -> m (premerge)
216 picked tool ':merge' for b (binary False symlink False changedelete False)
216 picked tool ':merge' for b (binary False symlink False changedelete False)
217 merging b and a to b
217 merging b and a to b
218 my b@ef0ef43d49e7+ other a@5d205f8b35b6 ancestor a@68795b066622
218 my b@ef0ef43d49e7+ other a@5d205f8b35b6 ancestor a@68795b066622
219 premerge successful
219 premerge successful
220 committing files:
220 committing files:
221 b
221 b
222 committing manifest
222 committing manifest
223 committing changelog
223 committing changelog
224 updating the branch cache
224 updating the branch cache
225 grafting 5:97f8bfe72746 "5"
225 grafting 5:97f8bfe72746 "5"
226 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
226 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
227 on local side:
227 on local side:
228 src: 'c' -> dst: 'b'
228 src: 'c' -> dst: 'b'
229 checking for directory renames
229 checking for directory renames
230 resolving manifests
230 resolving manifests
231 branchmerge: True, force: True, partial: False
231 branchmerge: True, force: True, partial: False
232 ancestor: 4c60f11aa304, local: 6b9e5368ca4e+, remote: 97f8bfe72746
232 ancestor: 4c60f11aa304, local: 6b9e5368ca4e+, remote: 97f8bfe72746
233 e: remote is newer -> g
233 e: remote is newer -> g
234 getting e
234 getting e
235 committing files:
235 committing files:
236 e
236 e
237 committing manifest
237 committing manifest
238 committing changelog
238 committing changelog
239 updating the branch cache
239 updating the branch cache
240 $ HGEDITOR=cat hg graft 4 3 --log --debug
240 $ HGEDITOR=cat hg graft 4 3 --log --debug
241 scanning for duplicate grafts
241 scanning for duplicate grafts
242 grafting 4:9c233e8e184d "4"
242 grafting 4:9c233e8e184d "4"
243 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
243 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
244 on local side:
244 on local side:
245 src: 'c' -> dst: 'b'
245 src: 'c' -> dst: 'b'
246 checking for directory renames
246 checking for directory renames
247 resolving manifests
247 resolving manifests
248 branchmerge: True, force: True, partial: False
248 branchmerge: True, force: True, partial: False
249 ancestor: 4c60f11aa304, local: 1905859650ec+, remote: 9c233e8e184d
249 ancestor: 4c60f11aa304, local: 1905859650ec+, remote: 9c233e8e184d
250 d: remote is newer -> g
250 d: remote is newer -> g
251 getting d
251 getting d
252 preserving e for resolve of e
252 preserving e for resolve of e
253 e: versions differ -> m (premerge)
253 e: versions differ -> m (premerge)
254 picked tool ':merge' for e (binary False symlink False changedelete False)
254 picked tool ':merge' for e (binary False symlink False changedelete False)
255 merging e
255 merging e
256 my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304
256 my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304
257 e: versions differ -> m (merge)
257 e: versions differ -> m (merge)
258 picked tool ':merge' for e (binary False symlink False changedelete False)
258 picked tool ':merge' for e (binary False symlink False changedelete False)
259 my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304
259 my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304
260 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
260 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
261 abort: unresolved conflicts, can't continue
261 abort: unresolved conflicts, can't continue
262 (use 'hg resolve' and 'hg graft --continue')
262 (use 'hg resolve' and 'hg graft --continue')
263 [1]
263 [1]
264
264
265 Summary should mention graft:
265 Summary should mention graft:
266
266
267 $ hg summary |grep graft
267 $ hg summary |grep graft
268 commit: 2 modified, 2 unknown, 1 unresolved (graft in progress)
268 commit: 2 modified, 2 unknown, 1 unresolved (graft in progress)
269
269
270 Using status to get more context
270 Using status to get more context
271
271
272 $ hg status --verbose
272 $ hg status --verbose
273 M d
273 M d
274 M e
274 M e
275 ? a.orig
275 ? a.orig
276 ? e.orig
276 ? e.orig
277 # The repository is in an unfinished *graft* state.
277 # The repository is in an unfinished *graft* state.
278
278
279 # Unresolved merge conflicts:
279 # Unresolved merge conflicts:
280 #
280 #
281 # e
281 # e
282 #
282 #
283 # To mark files as resolved: hg resolve --mark FILE
283 # To mark files as resolved: hg resolve --mark FILE
284
284
285 # To continue: hg graft --continue
285 # To continue: hg graft --continue
286 # To abort: hg graft --abort
286 # To abort: hg graft --abort
287 # To stop: hg graft --stop
287 # To stop: hg graft --stop
288
288
289
289
290 Commit while interrupted should fail:
290 Commit while interrupted should fail:
291
291
292 $ hg ci -m 'commit interrupted graft'
292 $ hg ci -m 'commit interrupted graft'
293 abort: graft in progress
293 abort: graft in progress
294 (use 'hg graft --continue' or 'hg graft --stop' to stop)
294 (use 'hg graft --continue' or 'hg graft --stop' to stop)
295 [20]
295 [20]
296
296
297 Abort the graft and try committing:
297 Abort the graft and try committing:
298
298
299 $ hg up -C .
299 $ hg up -C .
300 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
300 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
301 $ echo c >> e
301 $ echo c >> e
302 $ hg ci -mtest
302 $ hg ci -mtest
303
303
304 $ hg strip . --config extensions.strip=
304 $ hg strip . --config extensions.strip=
305 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
305 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
306 saved backup bundle to $TESTTMP/a/.hg/strip-backup/*-backup.hg (glob)
306 saved backup bundle to $TESTTMP/a/.hg/strip-backup/*-backup.hg (glob)
307
307
308 Graft again:
308 Graft again:
309
309
310 $ hg graft 1 5 4 3 'merge()' 2
310 $ hg graft 1 5 4 3 'merge()' 2
311 skipping ungraftable merge revision 6
311 skipping ungraftable merge revision 6
312 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
312 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
313 skipping revision 1:5d205f8b35b6 (already grafted to 8:6b9e5368ca4e)
313 skipping revision 1:5d205f8b35b6 (already grafted to 8:6b9e5368ca4e)
314 skipping revision 5:97f8bfe72746 (already grafted to 9:1905859650ec)
314 skipping revision 5:97f8bfe72746 (already grafted to 9:1905859650ec)
315 grafting 4:9c233e8e184d "4"
315 grafting 4:9c233e8e184d "4"
316 merging e
316 merging e
317 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
317 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
318 abort: unresolved conflicts, can't continue
318 abort: unresolved conflicts, can't continue
319 (use 'hg resolve' and 'hg graft --continue')
319 (use 'hg resolve' and 'hg graft --continue')
320 [1]
320 [1]
321
321
322 Continue without resolve should fail:
322 Continue without resolve should fail:
323
323
324 $ hg graft -c
324 $ hg graft -c
325 grafting 4:9c233e8e184d "4"
325 grafting 4:9c233e8e184d "4"
326 abort: unresolved merge conflicts (see 'hg help resolve')
326 abort: unresolved merge conflicts (see 'hg help resolve')
327 [255]
327 [20]
328
328
329 Fix up:
329 Fix up:
330
330
331 $ echo b > e
331 $ echo b > e
332 $ hg resolve -m e
332 $ hg resolve -m e
333 (no more unresolved files)
333 (no more unresolved files)
334 continue: hg graft --continue
334 continue: hg graft --continue
335
335
336 Continue with a revision should fail:
336 Continue with a revision should fail:
337
337
338 $ hg graft -c 6
338 $ hg graft -c 6
339 abort: can't specify --continue and revisions
339 abort: can't specify --continue and revisions
340 [10]
340 [10]
341
341
342 $ hg graft -c -r 6
342 $ hg graft -c -r 6
343 abort: can't specify --continue and revisions
343 abort: can't specify --continue and revisions
344 [10]
344 [10]
345
345
346 Continue for real, clobber usernames
346 Continue for real, clobber usernames
347
347
348 $ hg graft -c -U
348 $ hg graft -c -U
349 grafting 4:9c233e8e184d "4"
349 grafting 4:9c233e8e184d "4"
350 grafting 3:4c60f11aa304 "3"
350 grafting 3:4c60f11aa304 "3"
351
351
352 Compare with original:
352 Compare with original:
353
353
354 $ hg diff -r 6
354 $ hg diff -r 6
355 $ hg status --rev 0:. -C
355 $ hg status --rev 0:. -C
356 M d
356 M d
357 M e
357 M e
358 A b
358 A b
359 a
359 a
360 A c
360 A c
361 a
361 a
362 R a
362 R a
363
363
364 View graph:
364 View graph:
365
365
366 $ hg log -G --template '{author}@{rev}.{phase}: {desc}\n'
366 $ hg log -G --template '{author}@{rev}.{phase}: {desc}\n'
367 @ test@11.draft: 3
367 @ test@11.draft: 3
368 |
368 |
369 o test@10.draft: 4
369 o test@10.draft: 4
370 |
370 |
371 o test@9.draft: 5
371 o test@9.draft: 5
372 |
372 |
373 o bar@8.draft: 1
373 o bar@8.draft: 1
374 |
374 |
375 o foo@7.draft: 2
375 o foo@7.draft: 2
376 |
376 |
377 | o test@6.secret: 6
377 | o test@6.secret: 6
378 | |\
378 | |\
379 | | o test@5.draft: 5
379 | | o test@5.draft: 5
380 | | |
380 | | |
381 | o | test@4.draft: 4
381 | o | test@4.draft: 4
382 | |/
382 | |/
383 | o baz@3.public: 3
383 | o baz@3.public: 3
384 | |
384 | |
385 | o test@2.public: 2
385 | o test@2.public: 2
386 | |
386 | |
387 | o bar@1.public: 1
387 | o bar@1.public: 1
388 |/
388 |/
389 o test@0.public: 0
389 o test@0.public: 0
390
390
391 Graft again onto another branch should preserve the original source
391 Graft again onto another branch should preserve the original source
392 $ hg up -q 0
392 $ hg up -q 0
393 $ echo 'g'>g
393 $ echo 'g'>g
394 $ hg add g
394 $ hg add g
395 $ hg ci -m 7
395 $ hg ci -m 7
396 created new head
396 created new head
397 $ hg graft 7
397 $ hg graft 7
398 grafting 7:ef0ef43d49e7 "2"
398 grafting 7:ef0ef43d49e7 "2"
399
399
400 $ hg log -r 7 --template '{rev}:{node}\n'
400 $ hg log -r 7 --template '{rev}:{node}\n'
401 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82
401 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82
402 $ hg log -r 2 --template '{rev}:{node}\n'
402 $ hg log -r 2 --template '{rev}:{node}\n'
403 2:5c095ad7e90f871700f02dd1fa5012cb4498a2d4
403 2:5c095ad7e90f871700f02dd1fa5012cb4498a2d4
404
404
405 $ hg log --debug -r tip
405 $ hg log --debug -r tip
406 changeset: 13:7a4785234d87ec1aa420ed6b11afe40fa73e12a9
406 changeset: 13:7a4785234d87ec1aa420ed6b11afe40fa73e12a9
407 tag: tip
407 tag: tip
408 phase: draft
408 phase: draft
409 parent: 12:b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
409 parent: 12:b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
410 parent: -1:0000000000000000000000000000000000000000
410 parent: -1:0000000000000000000000000000000000000000
411 manifest: 13:dc313617b8c32457c0d589e0dbbedfe71f3cd637
411 manifest: 13:dc313617b8c32457c0d589e0dbbedfe71f3cd637
412 user: foo
412 user: foo
413 date: Thu Jan 01 00:00:00 1970 +0000
413 date: Thu Jan 01 00:00:00 1970 +0000
414 files+: b
414 files+: b
415 files-: a
415 files-: a
416 extra: branch=default
416 extra: branch=default
417 extra: intermediate-source=ef0ef43d49e79e81ddafdc7997401ba0041efc82
417 extra: intermediate-source=ef0ef43d49e79e81ddafdc7997401ba0041efc82
418 extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4
418 extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4
419 description:
419 description:
420 2
420 2
421
421
422
422
423 Disallow grafting an already grafted cset onto its original branch
423 Disallow grafting an already grafted cset onto its original branch
424 $ hg up -q 6
424 $ hg up -q 6
425 $ hg graft 7
425 $ hg graft 7
426 skipping already grafted revision 7:ef0ef43d49e7 (was grafted from 2:5c095ad7e90f)
426 skipping already grafted revision 7:ef0ef43d49e7 (was grafted from 2:5c095ad7e90f)
427 [255]
427 [255]
428
428
429 $ hg pdiff --config extensions.extdiff= --patch -r 2 -r 13
429 $ hg pdiff --config extensions.extdiff= --patch -r 2 -r 13
430 --- */hg-5c095ad7e90f.patch * (glob)
430 --- */hg-5c095ad7e90f.patch * (glob)
431 +++ */hg-7a4785234d87.patch * (glob)
431 +++ */hg-7a4785234d87.patch * (glob)
432 @@ -1,18 +1,18 @@
432 @@ -1,18 +1,18 @@
433 # HG changeset patch
433 # HG changeset patch
434 -# User test
434 -# User test
435 +# User foo
435 +# User foo
436 # Date 0 0
436 # Date 0 0
437 # Thu Jan 01 00:00:00 1970 +0000
437 # Thu Jan 01 00:00:00 1970 +0000
438 -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4
438 -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4
439 -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04
439 -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04
440 +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9
440 +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9
441 +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
441 +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
442 2
442 2
443
443
444 -diff -r 5d205f8b35b6 -r 5c095ad7e90f a
444 -diff -r 5d205f8b35b6 -r 5c095ad7e90f a
445 +diff -r b592ea63bb0c -r 7a4785234d87 a
445 +diff -r b592ea63bb0c -r 7a4785234d87 a
446 --- a/a Thu Jan 01 00:00:00 1970 +0000
446 --- a/a Thu Jan 01 00:00:00 1970 +0000
447 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
447 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
448 @@ -1,1 +0,0 @@
448 @@ -1,1 +0,0 @@
449 --b
449 --b
450 -diff -r 5d205f8b35b6 -r 5c095ad7e90f b
450 -diff -r 5d205f8b35b6 -r 5c095ad7e90f b
451 +-a
451 +-a
452 +diff -r b592ea63bb0c -r 7a4785234d87 b
452 +diff -r b592ea63bb0c -r 7a4785234d87 b
453 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
453 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
454 +++ b/b Thu Jan 01 00:00:00 1970 +0000
454 +++ b/b Thu Jan 01 00:00:00 1970 +0000
455 @@ -0,0 +1,1 @@
455 @@ -0,0 +1,1 @@
456 -+b
456 -+b
457 ++a
457 ++a
458 [1]
458 [1]
459
459
460 $ hg pdiff --config extensions.extdiff= --patch -r 2 -r 13 -X .
460 $ hg pdiff --config extensions.extdiff= --patch -r 2 -r 13 -X .
461 --- */hg-5c095ad7e90f.patch * (glob)
461 --- */hg-5c095ad7e90f.patch * (glob)
462 +++ */hg-7a4785234d87.patch * (glob)
462 +++ */hg-7a4785234d87.patch * (glob)
463 @@ -1,8 +1,8 @@
463 @@ -1,8 +1,8 @@
464 # HG changeset patch
464 # HG changeset patch
465 -# User test
465 -# User test
466 +# User foo
466 +# User foo
467 # Date 0 0
467 # Date 0 0
468 # Thu Jan 01 00:00:00 1970 +0000
468 # Thu Jan 01 00:00:00 1970 +0000
469 -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4
469 -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4
470 -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04
470 -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04
471 +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9
471 +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9
472 +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
472 +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
473 2
473 2
474
474
475 [1]
475 [1]
476
476
477 Disallow grafting already grafted csets with the same origin onto each other
477 Disallow grafting already grafted csets with the same origin onto each other
478 $ hg up -q 13
478 $ hg up -q 13
479 $ hg graft 2
479 $ hg graft 2
480 skipping revision 2:5c095ad7e90f (already grafted to 13:7a4785234d87)
480 skipping revision 2:5c095ad7e90f (already grafted to 13:7a4785234d87)
481 [255]
481 [255]
482 $ hg graft 7
482 $ hg graft 7
483 skipping already grafted revision 7:ef0ef43d49e7 (13:7a4785234d87 also has origin 2:5c095ad7e90f)
483 skipping already grafted revision 7:ef0ef43d49e7 (13:7a4785234d87 also has origin 2:5c095ad7e90f)
484 [255]
484 [255]
485
485
486 $ hg up -q 7
486 $ hg up -q 7
487 $ hg graft 2
487 $ hg graft 2
488 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
488 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
489 [255]
489 [255]
490 $ hg graft tip
490 $ hg graft tip
491 skipping already grafted revision 13:7a4785234d87 (7:ef0ef43d49e7 also has origin 2:5c095ad7e90f)
491 skipping already grafted revision 13:7a4785234d87 (7:ef0ef43d49e7 also has origin 2:5c095ad7e90f)
492 [255]
492 [255]
493
493
494 Graft with --log
494 Graft with --log
495
495
496 $ hg up -Cq 1
496 $ hg up -Cq 1
497 $ hg graft 3 --log -u foo
497 $ hg graft 3 --log -u foo
498 grafting 3:4c60f11aa304 "3"
498 grafting 3:4c60f11aa304 "3"
499 $ hg log --template '{rev}:{node|short} {parents} {desc}\n' -r tip
499 $ hg log --template '{rev}:{node|short} {parents} {desc}\n' -r tip
500 14:0c921c65ef1e 1:5d205f8b35b6 3
500 14:0c921c65ef1e 1:5d205f8b35b6 3
501 (grafted from 4c60f11aa304a54ae1c199feb94e7fc771e51ed8)
501 (grafted from 4c60f11aa304a54ae1c199feb94e7fc771e51ed8)
502
502
503 Resolve conflicted graft
503 Resolve conflicted graft
504 $ hg up -q 0
504 $ hg up -q 0
505 $ echo b > a
505 $ echo b > a
506 $ hg ci -m 8
506 $ hg ci -m 8
507 created new head
507 created new head
508 $ echo c > a
508 $ echo c > a
509 $ hg ci -m 9
509 $ hg ci -m 9
510 $ hg graft 1 --tool internal:fail
510 $ hg graft 1 --tool internal:fail
511 grafting 1:5d205f8b35b6 "1"
511 grafting 1:5d205f8b35b6 "1"
512 abort: unresolved conflicts, can't continue
512 abort: unresolved conflicts, can't continue
513 (use 'hg resolve' and 'hg graft --continue')
513 (use 'hg resolve' and 'hg graft --continue')
514 [1]
514 [1]
515 $ hg resolve --all
515 $ hg resolve --all
516 merging a
516 merging a
517 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
517 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
518 [1]
518 [1]
519 $ cat a
519 $ cat a
520 <<<<<<< local: aaa4406d4f0a - test: 9
520 <<<<<<< local: aaa4406d4f0a - test: 9
521 c
521 c
522 =======
522 =======
523 b
523 b
524 >>>>>>> graft: 5d205f8b35b6 - bar: 1
524 >>>>>>> graft: 5d205f8b35b6 - bar: 1
525 $ echo b > a
525 $ echo b > a
526 $ hg resolve -m a
526 $ hg resolve -m a
527 (no more unresolved files)
527 (no more unresolved files)
528 continue: hg graft --continue
528 continue: hg graft --continue
529 $ hg graft -c
529 $ hg graft -c
530 grafting 1:5d205f8b35b6 "1"
530 grafting 1:5d205f8b35b6 "1"
531 $ hg export tip --git
531 $ hg export tip --git
532 # HG changeset patch
532 # HG changeset patch
533 # User bar
533 # User bar
534 # Date 0 0
534 # Date 0 0
535 # Thu Jan 01 00:00:00 1970 +0000
535 # Thu Jan 01 00:00:00 1970 +0000
536 # Node ID f67661df0c4804d301f064f332b57e7d5ddaf2be
536 # Node ID f67661df0c4804d301f064f332b57e7d5ddaf2be
537 # Parent aaa4406d4f0ae9befd6e58c82ec63706460cbca6
537 # Parent aaa4406d4f0ae9befd6e58c82ec63706460cbca6
538 1
538 1
539
539
540 diff --git a/a b/a
540 diff --git a/a b/a
541 --- a/a
541 --- a/a
542 +++ b/a
542 +++ b/a
543 @@ -1,1 +1,1 @@
543 @@ -1,1 +1,1 @@
544 -c
544 -c
545 +b
545 +b
546
546
547 Resolve conflicted graft with rename
547 Resolve conflicted graft with rename
548 $ echo c > a
548 $ echo c > a
549 $ hg ci -m 10
549 $ hg ci -m 10
550 $ hg graft 2 --tool internal:fail
550 $ hg graft 2 --tool internal:fail
551 grafting 2:5c095ad7e90f "2"
551 grafting 2:5c095ad7e90f "2"
552 abort: unresolved conflicts, can't continue
552 abort: unresolved conflicts, can't continue
553 (use 'hg resolve' and 'hg graft --continue')
553 (use 'hg resolve' and 'hg graft --continue')
554 [1]
554 [1]
555 $ hg resolve --all
555 $ hg resolve --all
556 merging a and b to b
556 merging a and b to b
557 (no more unresolved files)
557 (no more unresolved files)
558 continue: hg graft --continue
558 continue: hg graft --continue
559 $ hg graft -c
559 $ hg graft -c
560 grafting 2:5c095ad7e90f "2"
560 grafting 2:5c095ad7e90f "2"
561 $ hg export tip --git
561 $ hg export tip --git
562 # HG changeset patch
562 # HG changeset patch
563 # User test
563 # User test
564 # Date 0 0
564 # Date 0 0
565 # Thu Jan 01 00:00:00 1970 +0000
565 # Thu Jan 01 00:00:00 1970 +0000
566 # Node ID 9627f653b421c61fc1ea4c4e366745070fa3d2bc
566 # Node ID 9627f653b421c61fc1ea4c4e366745070fa3d2bc
567 # Parent ee295f490a40b97f3d18dd4c4f1c8936c233b612
567 # Parent ee295f490a40b97f3d18dd4c4f1c8936c233b612
568 2
568 2
569
569
570 diff --git a/a b/b
570 diff --git a/a b/b
571 rename from a
571 rename from a
572 rename to b
572 rename to b
573
573
574 Test simple origin(), with and without args
574 Test simple origin(), with and without args
575 $ hg log -r 'origin()'
575 $ hg log -r 'origin()'
576 changeset: 1:5d205f8b35b6
576 changeset: 1:5d205f8b35b6
577 user: bar
577 user: bar
578 date: Thu Jan 01 00:00:00 1970 +0000
578 date: Thu Jan 01 00:00:00 1970 +0000
579 summary: 1
579 summary: 1
580
580
581 changeset: 2:5c095ad7e90f
581 changeset: 2:5c095ad7e90f
582 user: test
582 user: test
583 date: Thu Jan 01 00:00:00 1970 +0000
583 date: Thu Jan 01 00:00:00 1970 +0000
584 summary: 2
584 summary: 2
585
585
586 changeset: 3:4c60f11aa304
586 changeset: 3:4c60f11aa304
587 user: baz
587 user: baz
588 date: Thu Jan 01 00:00:00 1970 +0000
588 date: Thu Jan 01 00:00:00 1970 +0000
589 summary: 3
589 summary: 3
590
590
591 changeset: 4:9c233e8e184d
591 changeset: 4:9c233e8e184d
592 user: test
592 user: test
593 date: Thu Jan 01 00:00:00 1970 +0000
593 date: Thu Jan 01 00:00:00 1970 +0000
594 summary: 4
594 summary: 4
595
595
596 changeset: 5:97f8bfe72746
596 changeset: 5:97f8bfe72746
597 branch: stable
597 branch: stable
598 parent: 3:4c60f11aa304
598 parent: 3:4c60f11aa304
599 user: test
599 user: test
600 date: Thu Jan 01 00:00:00 1970 +0000
600 date: Thu Jan 01 00:00:00 1970 +0000
601 summary: 5
601 summary: 5
602
602
603 $ hg log -r 'origin(7)'
603 $ hg log -r 'origin(7)'
604 changeset: 2:5c095ad7e90f
604 changeset: 2:5c095ad7e90f
605 user: test
605 user: test
606 date: Thu Jan 01 00:00:00 1970 +0000
606 date: Thu Jan 01 00:00:00 1970 +0000
607 summary: 2
607 summary: 2
608
608
609 Now transplant a graft to test following through copies
609 Now transplant a graft to test following through copies
610 $ hg up -q 0
610 $ hg up -q 0
611 $ hg branch -q dev
611 $ hg branch -q dev
612 $ hg ci -qm "dev branch"
612 $ hg ci -qm "dev branch"
613 $ hg --config extensions.transplant= transplant -q 7
613 $ hg --config extensions.transplant= transplant -q 7
614 $ hg log -r 'origin(.)'
614 $ hg log -r 'origin(.)'
615 changeset: 2:5c095ad7e90f
615 changeset: 2:5c095ad7e90f
616 user: test
616 user: test
617 date: Thu Jan 01 00:00:00 1970 +0000
617 date: Thu Jan 01 00:00:00 1970 +0000
618 summary: 2
618 summary: 2
619
619
620 Test that the graft and transplant markers in extra are converted, allowing
620 Test that the graft and transplant markers in extra are converted, allowing
621 origin() to still work. Note that these recheck the immediately preceeding two
621 origin() to still work. Note that these recheck the immediately preceeding two
622 tests.
622 tests.
623 $ hg --quiet --config extensions.convert= --config convert.hg.saverev=True convert . ../converted
623 $ hg --quiet --config extensions.convert= --config convert.hg.saverev=True convert . ../converted
624
624
625 The graft case
625 The graft case
626 $ hg -R ../converted log -r 7 --template "{rev}: {node}\n{join(extras, '\n')}\n"
626 $ hg -R ../converted log -r 7 --template "{rev}: {node}\n{join(extras, '\n')}\n"
627 7: 7ae846e9111fc8f57745634250c7b9ac0a60689b
627 7: 7ae846e9111fc8f57745634250c7b9ac0a60689b
628 branch=default
628 branch=default
629 convert_revision=ef0ef43d49e79e81ddafdc7997401ba0041efc82
629 convert_revision=ef0ef43d49e79e81ddafdc7997401ba0041efc82
630 source=e0213322b2c1a5d5d236c74e79666441bee67a7d
630 source=e0213322b2c1a5d5d236c74e79666441bee67a7d
631 $ hg -R ../converted log -r 'origin(7)'
631 $ hg -R ../converted log -r 'origin(7)'
632 changeset: 2:e0213322b2c1
632 changeset: 2:e0213322b2c1
633 user: test
633 user: test
634 date: Thu Jan 01 00:00:00 1970 +0000
634 date: Thu Jan 01 00:00:00 1970 +0000
635 summary: 2
635 summary: 2
636
636
637 Test that template correctly expands more than one 'extra' (issue4362), and that
637 Test that template correctly expands more than one 'extra' (issue4362), and that
638 'intermediate-source' is converted.
638 'intermediate-source' is converted.
639 $ hg -R ../converted log -r 13 --template "{extras % ' Extra: {extra}\n'}"
639 $ hg -R ../converted log -r 13 --template "{extras % ' Extra: {extra}\n'}"
640 Extra: branch=default
640 Extra: branch=default
641 Extra: convert_revision=7a4785234d87ec1aa420ed6b11afe40fa73e12a9
641 Extra: convert_revision=7a4785234d87ec1aa420ed6b11afe40fa73e12a9
642 Extra: intermediate-source=7ae846e9111fc8f57745634250c7b9ac0a60689b
642 Extra: intermediate-source=7ae846e9111fc8f57745634250c7b9ac0a60689b
643 Extra: source=e0213322b2c1a5d5d236c74e79666441bee67a7d
643 Extra: source=e0213322b2c1a5d5d236c74e79666441bee67a7d
644
644
645 The transplant case
645 The transplant case
646 $ hg -R ../converted log -r tip --template "{rev}: {node}\n{join(extras, '\n')}\n"
646 $ hg -R ../converted log -r tip --template "{rev}: {node}\n{join(extras, '\n')}\n"
647 21: fbb6c5cc81002f2b4b49c9d731404688bcae5ade
647 21: fbb6c5cc81002f2b4b49c9d731404688bcae5ade
648 branch=dev
648 branch=dev
649 convert_revision=7e61b508e709a11d28194a5359bc3532d910af21
649 convert_revision=7e61b508e709a11d28194a5359bc3532d910af21
650 transplant_source=z\xe8F\xe9\x11\x1f\xc8\xf5wEcBP\xc7\xb9\xac\n`h\x9b
650 transplant_source=z\xe8F\xe9\x11\x1f\xc8\xf5wEcBP\xc7\xb9\xac\n`h\x9b
651 $ hg -R ../converted log -r 'origin(tip)'
651 $ hg -R ../converted log -r 'origin(tip)'
652 changeset: 2:e0213322b2c1
652 changeset: 2:e0213322b2c1
653 user: test
653 user: test
654 date: Thu Jan 01 00:00:00 1970 +0000
654 date: Thu Jan 01 00:00:00 1970 +0000
655 summary: 2
655 summary: 2
656
656
657
657
658 Test simple destination
658 Test simple destination
659 $ hg log -r 'destination()'
659 $ hg log -r 'destination()'
660 changeset: 7:ef0ef43d49e7
660 changeset: 7:ef0ef43d49e7
661 parent: 0:68795b066622
661 parent: 0:68795b066622
662 user: foo
662 user: foo
663 date: Thu Jan 01 00:00:00 1970 +0000
663 date: Thu Jan 01 00:00:00 1970 +0000
664 summary: 2
664 summary: 2
665
665
666 changeset: 8:6b9e5368ca4e
666 changeset: 8:6b9e5368ca4e
667 user: bar
667 user: bar
668 date: Thu Jan 01 00:00:00 1970 +0000
668 date: Thu Jan 01 00:00:00 1970 +0000
669 summary: 1
669 summary: 1
670
670
671 changeset: 9:1905859650ec
671 changeset: 9:1905859650ec
672 user: test
672 user: test
673 date: Thu Jan 01 00:00:00 1970 +0000
673 date: Thu Jan 01 00:00:00 1970 +0000
674 summary: 5
674 summary: 5
675
675
676 changeset: 10:52dc0b4c6907
676 changeset: 10:52dc0b4c6907
677 user: test
677 user: test
678 date: Thu Jan 01 00:00:00 1970 +0000
678 date: Thu Jan 01 00:00:00 1970 +0000
679 summary: 4
679 summary: 4
680
680
681 changeset: 11:882b35362a6b
681 changeset: 11:882b35362a6b
682 user: test
682 user: test
683 date: Thu Jan 01 00:00:00 1970 +0000
683 date: Thu Jan 01 00:00:00 1970 +0000
684 summary: 3
684 summary: 3
685
685
686 changeset: 13:7a4785234d87
686 changeset: 13:7a4785234d87
687 user: foo
687 user: foo
688 date: Thu Jan 01 00:00:00 1970 +0000
688 date: Thu Jan 01 00:00:00 1970 +0000
689 summary: 2
689 summary: 2
690
690
691 changeset: 14:0c921c65ef1e
691 changeset: 14:0c921c65ef1e
692 parent: 1:5d205f8b35b6
692 parent: 1:5d205f8b35b6
693 user: foo
693 user: foo
694 date: Thu Jan 01 00:00:00 1970 +0000
694 date: Thu Jan 01 00:00:00 1970 +0000
695 summary: 3
695 summary: 3
696
696
697 changeset: 17:f67661df0c48
697 changeset: 17:f67661df0c48
698 user: bar
698 user: bar
699 date: Thu Jan 01 00:00:00 1970 +0000
699 date: Thu Jan 01 00:00:00 1970 +0000
700 summary: 1
700 summary: 1
701
701
702 changeset: 19:9627f653b421
702 changeset: 19:9627f653b421
703 user: test
703 user: test
704 date: Thu Jan 01 00:00:00 1970 +0000
704 date: Thu Jan 01 00:00:00 1970 +0000
705 summary: 2
705 summary: 2
706
706
707 changeset: 21:7e61b508e709
707 changeset: 21:7e61b508e709
708 branch: dev
708 branch: dev
709 tag: tip
709 tag: tip
710 user: foo
710 user: foo
711 date: Thu Jan 01 00:00:00 1970 +0000
711 date: Thu Jan 01 00:00:00 1970 +0000
712 summary: 2
712 summary: 2
713
713
714 $ hg log -r 'destination(2)'
714 $ hg log -r 'destination(2)'
715 changeset: 7:ef0ef43d49e7
715 changeset: 7:ef0ef43d49e7
716 parent: 0:68795b066622
716 parent: 0:68795b066622
717 user: foo
717 user: foo
718 date: Thu Jan 01 00:00:00 1970 +0000
718 date: Thu Jan 01 00:00:00 1970 +0000
719 summary: 2
719 summary: 2
720
720
721 changeset: 13:7a4785234d87
721 changeset: 13:7a4785234d87
722 user: foo
722 user: foo
723 date: Thu Jan 01 00:00:00 1970 +0000
723 date: Thu Jan 01 00:00:00 1970 +0000
724 summary: 2
724 summary: 2
725
725
726 changeset: 19:9627f653b421
726 changeset: 19:9627f653b421
727 user: test
727 user: test
728 date: Thu Jan 01 00:00:00 1970 +0000
728 date: Thu Jan 01 00:00:00 1970 +0000
729 summary: 2
729 summary: 2
730
730
731 changeset: 21:7e61b508e709
731 changeset: 21:7e61b508e709
732 branch: dev
732 branch: dev
733 tag: tip
733 tag: tip
734 user: foo
734 user: foo
735 date: Thu Jan 01 00:00:00 1970 +0000
735 date: Thu Jan 01 00:00:00 1970 +0000
736 summary: 2
736 summary: 2
737
737
738 Transplants of grafts can find a destination...
738 Transplants of grafts can find a destination...
739 $ hg log -r 'destination(7)'
739 $ hg log -r 'destination(7)'
740 changeset: 21:7e61b508e709
740 changeset: 21:7e61b508e709
741 branch: dev
741 branch: dev
742 tag: tip
742 tag: tip
743 user: foo
743 user: foo
744 date: Thu Jan 01 00:00:00 1970 +0000
744 date: Thu Jan 01 00:00:00 1970 +0000
745 summary: 2
745 summary: 2
746
746
747 ... grafts of grafts unfortunately can't
747 ... grafts of grafts unfortunately can't
748 $ hg graft -q 13 --debug
748 $ hg graft -q 13 --debug
749 scanning for duplicate grafts
749 scanning for duplicate grafts
750 grafting 13:7a4785234d87 "2"
750 grafting 13:7a4785234d87 "2"
751 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
751 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
752 on local side:
752 on local side:
753 src: 'a' -> dst: 'b' *
753 src: 'a' -> dst: 'b' *
754 on remote side:
754 on remote side:
755 src: 'a' -> dst: 'b' *
755 src: 'a' -> dst: 'b' *
756 checking for directory renames
756 checking for directory renames
757 resolving manifests
757 resolving manifests
758 branchmerge: True, force: True, partial: False
758 branchmerge: True, force: True, partial: False
759 ancestor: b592ea63bb0c, local: 7e61b508e709+, remote: 7a4785234d87
759 ancestor: b592ea63bb0c, local: 7e61b508e709+, remote: 7a4785234d87
760 starting 4 threads for background file closing (?)
760 starting 4 threads for background file closing (?)
761 nothing to commit, clearing merge state
761 nothing to commit, clearing merge state
762 note: graft of 13:7a4785234d87 created no changes to commit
762 note: graft of 13:7a4785234d87 created no changes to commit
763 $ hg log -r 'destination(13)'
763 $ hg log -r 'destination(13)'
764 All copies of a cset
764 All copies of a cset
765 $ hg log -r 'origin(13) or destination(origin(13))'
765 $ hg log -r 'origin(13) or destination(origin(13))'
766 changeset: 2:5c095ad7e90f
766 changeset: 2:5c095ad7e90f
767 user: test
767 user: test
768 date: Thu Jan 01 00:00:00 1970 +0000
768 date: Thu Jan 01 00:00:00 1970 +0000
769 summary: 2
769 summary: 2
770
770
771 changeset: 7:ef0ef43d49e7
771 changeset: 7:ef0ef43d49e7
772 parent: 0:68795b066622
772 parent: 0:68795b066622
773 user: foo
773 user: foo
774 date: Thu Jan 01 00:00:00 1970 +0000
774 date: Thu Jan 01 00:00:00 1970 +0000
775 summary: 2
775 summary: 2
776
776
777 changeset: 13:7a4785234d87
777 changeset: 13:7a4785234d87
778 user: foo
778 user: foo
779 date: Thu Jan 01 00:00:00 1970 +0000
779 date: Thu Jan 01 00:00:00 1970 +0000
780 summary: 2
780 summary: 2
781
781
782 changeset: 19:9627f653b421
782 changeset: 19:9627f653b421
783 user: test
783 user: test
784 date: Thu Jan 01 00:00:00 1970 +0000
784 date: Thu Jan 01 00:00:00 1970 +0000
785 summary: 2
785 summary: 2
786
786
787 changeset: 21:7e61b508e709
787 changeset: 21:7e61b508e709
788 branch: dev
788 branch: dev
789 tag: tip
789 tag: tip
790 user: foo
790 user: foo
791 date: Thu Jan 01 00:00:00 1970 +0000
791 date: Thu Jan 01 00:00:00 1970 +0000
792 summary: 2
792 summary: 2
793
793
794
794
795 graft skips ancestors
795 graft skips ancestors
796
796
797 $ hg graft 21 3
797 $ hg graft 21 3
798 skipping ancestor revision 21:7e61b508e709
798 skipping ancestor revision 21:7e61b508e709
799 grafting 3:4c60f11aa304 "3"
799 grafting 3:4c60f11aa304 "3"
800 merging b and c to c
800 merging b and c to c
801
801
802 graft with --force (still doesn't graft merges)
802 graft with --force (still doesn't graft merges)
803
803
804 $ hg graft 19 0 6
804 $ hg graft 19 0 6
805 skipping ungraftable merge revision 6
805 skipping ungraftable merge revision 6
806 skipping ancestor revision 0:68795b066622
806 skipping ancestor revision 0:68795b066622
807 grafting 19:9627f653b421 "2"
807 grafting 19:9627f653b421 "2"
808 merging b
808 merging b
809 note: graft of 19:9627f653b421 created no changes to commit
809 note: graft of 19:9627f653b421 created no changes to commit
810 $ hg graft 19 0 6 --force
810 $ hg graft 19 0 6 --force
811 skipping ungraftable merge revision 6
811 skipping ungraftable merge revision 6
812 grafting 19:9627f653b421 "2"
812 grafting 19:9627f653b421 "2"
813 merging b
813 merging b
814 note: graft of 19:9627f653b421 created no changes to commit
814 note: graft of 19:9627f653b421 created no changes to commit
815 grafting 0:68795b066622 "0"
815 grafting 0:68795b066622 "0"
816
816
817 graft --force after backout. Do the backout with graft too, to make
817 graft --force after backout. Do the backout with graft too, to make
818 sure we support issue6248.
818 sure we support issue6248.
819
819
820 $ echo abc > a
820 $ echo abc > a
821 $ hg ci -m 24
821 $ hg ci -m 24
822 $ hg graft --base . -r ".^" --no-commit
822 $ hg graft --base . -r ".^" --no-commit
823 grafting 23:b1cac6de36a9 "0"
823 grafting 23:b1cac6de36a9 "0"
824 $ hg commit -m 'Backed out changeset 2e7ea477be26'
824 $ hg commit -m 'Backed out changeset 2e7ea477be26'
825 $ hg graft 24
825 $ hg graft 24
826 skipping ancestor revision 24:2e7ea477be26
826 skipping ancestor revision 24:2e7ea477be26
827 [255]
827 [255]
828 $ hg graft 24 --force
828 $ hg graft 24 --force
829 grafting 24:2e7ea477be26 "24"
829 grafting 24:2e7ea477be26 "24"
830 merging a
830 merging a
831 $ cat a
831 $ cat a
832 abc
832 abc
833
833
834 graft --continue after --force
834 graft --continue after --force
835
835
836 $ echo def > a
836 $ echo def > a
837 $ hg ci -m 27
837 $ hg ci -m 27
838 $ hg graft 24 --force --tool internal:fail
838 $ hg graft 24 --force --tool internal:fail
839 grafting 24:2e7ea477be26 "24"
839 grafting 24:2e7ea477be26 "24"
840 abort: unresolved conflicts, can't continue
840 abort: unresolved conflicts, can't continue
841 (use 'hg resolve' and 'hg graft --continue')
841 (use 'hg resolve' and 'hg graft --continue')
842 [1]
842 [1]
843 $ hg resolve --all
843 $ hg resolve --all
844 merging a
844 merging a
845 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
845 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
846 [1]
846 [1]
847 $ echo abc > a
847 $ echo abc > a
848 $ hg resolve -m a
848 $ hg resolve -m a
849 (no more unresolved files)
849 (no more unresolved files)
850 continue: hg graft --continue
850 continue: hg graft --continue
851 $ hg graft -c
851 $ hg graft -c
852 grafting 24:2e7ea477be26 "24"
852 grafting 24:2e7ea477be26 "24"
853 $ cat a
853 $ cat a
854 abc
854 abc
855
855
856 graft --continue after --base with conflits
856 graft --continue after --base with conflits
857
857
858 $ echo base > d
858 $ echo base > d
859 $ hg ci -m _
859 $ hg ci -m _
860 $ hg graft -r 6
860 $ hg graft -r 6
861 skipping ungraftable merge revision 6
861 skipping ungraftable merge revision 6
862 [255]
862 [255]
863 $ hg graft -r 6 --base 5
863 $ hg graft -r 6 --base 5
864 grafting 6:25a2b029d3ae "6"
864 grafting 6:25a2b029d3ae "6"
865 merging d
865 merging d
866 merging e
866 merging e
867 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
867 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
868 abort: unresolved conflicts, can't continue
868 abort: unresolved conflicts, can't continue
869 (use 'hg resolve' and 'hg graft --continue')
869 (use 'hg resolve' and 'hg graft --continue')
870 [1]
870 [1]
871 $ echo a > d && hg resolve -qm
871 $ echo a > d && hg resolve -qm
872 continue: hg graft --continue
872 continue: hg graft --continue
873 $ hg graft --continue
873 $ hg graft --continue
874 grafting 6:25a2b029d3ae "6"
874 grafting 6:25a2b029d3ae "6"
875
875
876 Continue testing same origin policy, using revision numbers from test above
876 Continue testing same origin policy, using revision numbers from test above
877 but do some destructive editing of the repo:
877 but do some destructive editing of the repo:
878
878
879 $ hg up -qC 7
879 $ hg up -qC 7
880 $ hg tag -l -r 13 tmp
880 $ hg tag -l -r 13 tmp
881 $ hg --config extensions.strip= strip 2
881 $ hg --config extensions.strip= strip 2
882 saved backup bundle to $TESTTMP/a/.hg/strip-backup/5c095ad7e90f-d323a1e4-backup.hg
882 saved backup bundle to $TESTTMP/a/.hg/strip-backup/5c095ad7e90f-d323a1e4-backup.hg
883 $ hg graft tmp
883 $ hg graft tmp
884 skipping already grafted revision 8:7a4785234d87 (2:ef0ef43d49e7 also has unknown origin 5c095ad7e90f)
884 skipping already grafted revision 8:7a4785234d87 (2:ef0ef43d49e7 also has unknown origin 5c095ad7e90f)
885 [255]
885 [255]
886
886
887 Empty graft
887 Empty graft
888
888
889 $ hg up -qr 22
889 $ hg up -qr 22
890 $ hg tag -f something
890 $ hg tag -f something
891 $ hg graft -qr 23
891 $ hg graft -qr 23
892 $ hg graft -f 23
892 $ hg graft -f 23
893 grafting 23:72d9c7c75bcc "24"
893 grafting 23:72d9c7c75bcc "24"
894 note: graft of 23:72d9c7c75bcc created no changes to commit
894 note: graft of 23:72d9c7c75bcc created no changes to commit
895
895
896 $ cd ..
896 $ cd ..
897
897
898 Graft to duplicate a commit
898 Graft to duplicate a commit
899
899
900 $ hg init graftsibling
900 $ hg init graftsibling
901 $ cd graftsibling
901 $ cd graftsibling
902 $ touch a
902 $ touch a
903 $ hg commit -qAm a
903 $ hg commit -qAm a
904 $ touch b
904 $ touch b
905 $ hg commit -qAm b
905 $ hg commit -qAm b
906 $ hg log -G -T '{rev}\n'
906 $ hg log -G -T '{rev}\n'
907 @ 1
907 @ 1
908 |
908 |
909 o 0
909 o 0
910
910
911 $ hg up -q 0
911 $ hg up -q 0
912 $ hg graft -r 1
912 $ hg graft -r 1
913 grafting 1:0e067c57feba "b" (tip)
913 grafting 1:0e067c57feba "b" (tip)
914 $ hg log -G -T '{rev}\n'
914 $ hg log -G -T '{rev}\n'
915 @ 2
915 @ 2
916 |
916 |
917 | o 1
917 | o 1
918 |/
918 |/
919 o 0
919 o 0
920
920
921 Graft to duplicate a commit twice
921 Graft to duplicate a commit twice
922
922
923 $ hg up -q 0
923 $ hg up -q 0
924 $ hg graft -r 2
924 $ hg graft -r 2
925 grafting 2:044ec77f6389 "b" (tip)
925 grafting 2:044ec77f6389 "b" (tip)
926 $ hg log -G -T '{rev}\n'
926 $ hg log -G -T '{rev}\n'
927 @ 3
927 @ 3
928 |
928 |
929 | o 2
929 | o 2
930 |/
930 |/
931 | o 1
931 | o 1
932 |/
932 |/
933 o 0
933 o 0
934
934
@@ -1,500 +1,500 b''
1 $ cat >> $HGRCPATH <<EOF
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
2 > [extensions]
3 > rebase=
3 > rebase=
4 > drawdag=$TESTDIR/drawdag.py
4 > drawdag=$TESTDIR/drawdag.py
5 >
5 >
6 > [phases]
6 > [phases]
7 > publish=False
7 > publish=False
8 >
8 >
9 > [alias]
9 > [alias]
10 > tglog = log -G --template "{rev}:{phase} '{desc}' {branches} {bookmarks}\n"
10 > tglog = log -G --template "{rev}:{phase} '{desc}' {branches} {bookmarks}\n"
11 > EOF
11 > EOF
12
12
13 $ hg init a
13 $ hg init a
14 $ cd a
14 $ cd a
15 $ echo c1 >common
15 $ echo c1 >common
16 $ hg add common
16 $ hg add common
17 $ hg ci -m C1
17 $ hg ci -m C1
18
18
19 $ echo c2 >>common
19 $ echo c2 >>common
20 $ hg ci -m C2
20 $ hg ci -m C2
21
21
22 $ echo c3 >>common
22 $ echo c3 >>common
23 $ hg ci -m C3
23 $ hg ci -m C3
24
24
25 $ hg up -q -C 1
25 $ hg up -q -C 1
26
26
27 $ echo l1 >>extra
27 $ echo l1 >>extra
28 $ hg add extra
28 $ hg add extra
29 $ hg ci -m L1
29 $ hg ci -m L1
30 created new head
30 created new head
31
31
32 $ sed -e 's/c2/l2/' common > common.new
32 $ sed -e 's/c2/l2/' common > common.new
33 $ mv common.new common
33 $ mv common.new common
34 $ hg ci -m L2
34 $ hg ci -m L2
35
35
36 $ echo l3 >> extra2
36 $ echo l3 >> extra2
37 $ hg add extra2
37 $ hg add extra2
38 $ hg ci -m L3
38 $ hg ci -m L3
39 $ hg bookmark mybook
39 $ hg bookmark mybook
40
40
41 $ hg phase --force --secret 4
41 $ hg phase --force --secret 4
42
42
43 $ hg tglog
43 $ hg tglog
44 @ 5:secret 'L3' mybook
44 @ 5:secret 'L3' mybook
45 |
45 |
46 o 4:secret 'L2'
46 o 4:secret 'L2'
47 |
47 |
48 o 3:draft 'L1'
48 o 3:draft 'L1'
49 |
49 |
50 | o 2:draft 'C3'
50 | o 2:draft 'C3'
51 |/
51 |/
52 o 1:draft 'C2'
52 o 1:draft 'C2'
53 |
53 |
54 o 0:draft 'C1'
54 o 0:draft 'C1'
55
55
56 Try to call --continue:
56 Try to call --continue:
57
57
58 $ hg rebase --continue
58 $ hg rebase --continue
59 abort: no rebase in progress
59 abort: no rebase in progress
60 [20]
60 [20]
61
61
62 Conflicting rebase:
62 Conflicting rebase:
63
63
64 $ hg rebase -s 3 -d 2
64 $ hg rebase -s 3 -d 2
65 rebasing 3:3163e20567cc "L1"
65 rebasing 3:3163e20567cc "L1"
66 rebasing 4:46f0b057b5c0 "L2"
66 rebasing 4:46f0b057b5c0 "L2"
67 merging common
67 merging common
68 warning: conflicts while merging common! (edit, then use 'hg resolve --mark')
68 warning: conflicts while merging common! (edit, then use 'hg resolve --mark')
69 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
69 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
70 [240]
70 [240]
71
71
72 $ hg status --config commands.status.verbose=1
72 $ hg status --config commands.status.verbose=1
73 M common
73 M common
74 ? common.orig
74 ? common.orig
75 # The repository is in an unfinished *rebase* state.
75 # The repository is in an unfinished *rebase* state.
76
76
77 # Unresolved merge conflicts:
77 # Unresolved merge conflicts:
78 #
78 #
79 # common
79 # common
80 #
80 #
81 # To mark files as resolved: hg resolve --mark FILE
81 # To mark files as resolved: hg resolve --mark FILE
82
82
83 # To continue: hg rebase --continue
83 # To continue: hg rebase --continue
84 # To abort: hg rebase --abort
84 # To abort: hg rebase --abort
85 # To stop: hg rebase --stop
85 # To stop: hg rebase --stop
86
86
87
87
88 Try to continue without solving the conflict:
88 Try to continue without solving the conflict:
89
89
90 $ hg rebase --continue
90 $ hg rebase --continue
91 abort: unresolved merge conflicts (see 'hg help resolve')
91 abort: unresolved merge conflicts (see 'hg help resolve')
92 [255]
92 [20]
93
93
94 Conclude rebase:
94 Conclude rebase:
95
95
96 $ echo 'resolved merge' >common
96 $ echo 'resolved merge' >common
97 $ hg resolve -m common
97 $ hg resolve -m common
98 (no more unresolved files)
98 (no more unresolved files)
99 continue: hg rebase --continue
99 continue: hg rebase --continue
100 $ hg rebase --continue
100 $ hg rebase --continue
101 already rebased 3:3163e20567cc "L1" as 3e046f2ecedb
101 already rebased 3:3163e20567cc "L1" as 3e046f2ecedb
102 rebasing 4:46f0b057b5c0 "L2"
102 rebasing 4:46f0b057b5c0 "L2"
103 rebasing 5:8029388f38dc mybook "L3"
103 rebasing 5:8029388f38dc mybook "L3"
104 saved backup bundle to $TESTTMP/a/.hg/strip-backup/3163e20567cc-5ca4656e-rebase.hg
104 saved backup bundle to $TESTTMP/a/.hg/strip-backup/3163e20567cc-5ca4656e-rebase.hg
105
105
106 $ hg tglog
106 $ hg tglog
107 @ 5:secret 'L3' mybook
107 @ 5:secret 'L3' mybook
108 |
108 |
109 o 4:secret 'L2'
109 o 4:secret 'L2'
110 |
110 |
111 o 3:draft 'L1'
111 o 3:draft 'L1'
112 |
112 |
113 o 2:draft 'C3'
113 o 2:draft 'C3'
114 |
114 |
115 o 1:draft 'C2'
115 o 1:draft 'C2'
116 |
116 |
117 o 0:draft 'C1'
117 o 0:draft 'C1'
118
118
119 Check correctness:
119 Check correctness:
120
120
121 $ hg cat -r 0 common
121 $ hg cat -r 0 common
122 c1
122 c1
123
123
124 $ hg cat -r 1 common
124 $ hg cat -r 1 common
125 c1
125 c1
126 c2
126 c2
127
127
128 $ hg cat -r 2 common
128 $ hg cat -r 2 common
129 c1
129 c1
130 c2
130 c2
131 c3
131 c3
132
132
133 $ hg cat -r 3 common
133 $ hg cat -r 3 common
134 c1
134 c1
135 c2
135 c2
136 c3
136 c3
137
137
138 $ hg cat -r 4 common
138 $ hg cat -r 4 common
139 resolved merge
139 resolved merge
140
140
141 $ hg cat -r 5 common
141 $ hg cat -r 5 common
142 resolved merge
142 resolved merge
143
143
144 Bookmark stays active after --continue
144 Bookmark stays active after --continue
145 $ hg bookmarks
145 $ hg bookmarks
146 * mybook 5:d67b21408fc0
146 * mybook 5:d67b21408fc0
147
147
148 $ cd ..
148 $ cd ..
149
149
150 Check that the right ancestors is used while rebasing a merge (issue4041)
150 Check that the right ancestors is used while rebasing a merge (issue4041)
151
151
152 $ hg init issue4041
152 $ hg init issue4041
153 $ cd issue4041
153 $ cd issue4041
154 $ hg unbundle "$TESTDIR/bundles/issue4041.hg"
154 $ hg unbundle "$TESTDIR/bundles/issue4041.hg"
155 adding changesets
155 adding changesets
156 adding manifests
156 adding manifests
157 adding file changes
157 adding file changes
158 added 11 changesets with 8 changes to 3 files (+1 heads)
158 added 11 changesets with 8 changes to 3 files (+1 heads)
159 new changesets 24797d4f68de:2f2496ddf49d (11 drafts)
159 new changesets 24797d4f68de:2f2496ddf49d (11 drafts)
160 (run 'hg heads' to see heads)
160 (run 'hg heads' to see heads)
161 $ hg up default
161 $ hg up default
162 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
162 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
163 $ hg log -G
163 $ hg log -G
164 o changeset: 10:2f2496ddf49d
164 o changeset: 10:2f2496ddf49d
165 |\ branch: f1
165 |\ branch: f1
166 | | tag: tip
166 | | tag: tip
167 | | parent: 7:4c9fbe56a16f
167 | | parent: 7:4c9fbe56a16f
168 | | parent: 9:e31216eec445
168 | | parent: 9:e31216eec445
169 | | user: szhang
169 | | user: szhang
170 | | date: Thu Sep 05 12:59:39 2013 -0400
170 | | date: Thu Sep 05 12:59:39 2013 -0400
171 | | summary: merge
171 | | summary: merge
172 | |
172 | |
173 | o changeset: 9:e31216eec445
173 | o changeset: 9:e31216eec445
174 | | branch: f1
174 | | branch: f1
175 | | user: szhang
175 | | user: szhang
176 | | date: Thu Sep 05 12:59:10 2013 -0400
176 | | date: Thu Sep 05 12:59:10 2013 -0400
177 | | summary: more changes to f1
177 | | summary: more changes to f1
178 | |
178 | |
179 | o changeset: 8:8e4e2c1a07ae
179 | o changeset: 8:8e4e2c1a07ae
180 | |\ branch: f1
180 | |\ branch: f1
181 | | | parent: 2:4bc80088dc6b
181 | | | parent: 2:4bc80088dc6b
182 | | | parent: 6:400110238667
182 | | | parent: 6:400110238667
183 | | | user: szhang
183 | | | user: szhang
184 | | | date: Thu Sep 05 12:57:59 2013 -0400
184 | | | date: Thu Sep 05 12:57:59 2013 -0400
185 | | | summary: bad merge
185 | | | summary: bad merge
186 | | |
186 | | |
187 o | | changeset: 7:4c9fbe56a16f
187 o | | changeset: 7:4c9fbe56a16f
188 |/ / branch: f1
188 |/ / branch: f1
189 | | parent: 2:4bc80088dc6b
189 | | parent: 2:4bc80088dc6b
190 | | user: szhang
190 | | user: szhang
191 | | date: Thu Sep 05 12:54:00 2013 -0400
191 | | date: Thu Sep 05 12:54:00 2013 -0400
192 | | summary: changed f1
192 | | summary: changed f1
193 | |
193 | |
194 | o changeset: 6:400110238667
194 | o changeset: 6:400110238667
195 | | branch: f2
195 | | branch: f2
196 | | parent: 4:12e8ec6bb010
196 | | parent: 4:12e8ec6bb010
197 | | user: szhang
197 | | user: szhang
198 | | date: Tue Sep 03 13:58:02 2013 -0400
198 | | date: Tue Sep 03 13:58:02 2013 -0400
199 | | summary: changed f2 on f2
199 | | summary: changed f2 on f2
200 | |
200 | |
201 | | @ changeset: 5:d79e2059b5c0
201 | | @ changeset: 5:d79e2059b5c0
202 | | | parent: 3:8a951942e016
202 | | | parent: 3:8a951942e016
203 | | | user: szhang
203 | | | user: szhang
204 | | | date: Tue Sep 03 13:57:39 2013 -0400
204 | | | date: Tue Sep 03 13:57:39 2013 -0400
205 | | | summary: changed f2 on default
205 | | | summary: changed f2 on default
206 | | |
206 | | |
207 | o | changeset: 4:12e8ec6bb010
207 | o | changeset: 4:12e8ec6bb010
208 | |/ branch: f2
208 | |/ branch: f2
209 | | user: szhang
209 | | user: szhang
210 | | date: Tue Sep 03 13:57:18 2013 -0400
210 | | date: Tue Sep 03 13:57:18 2013 -0400
211 | | summary: created f2 branch
211 | | summary: created f2 branch
212 | |
212 | |
213 | o changeset: 3:8a951942e016
213 | o changeset: 3:8a951942e016
214 | | parent: 0:24797d4f68de
214 | | parent: 0:24797d4f68de
215 | | user: szhang
215 | | user: szhang
216 | | date: Tue Sep 03 13:57:11 2013 -0400
216 | | date: Tue Sep 03 13:57:11 2013 -0400
217 | | summary: added f2.txt
217 | | summary: added f2.txt
218 | |
218 | |
219 o | changeset: 2:4bc80088dc6b
219 o | changeset: 2:4bc80088dc6b
220 | | branch: f1
220 | | branch: f1
221 | | user: szhang
221 | | user: szhang
222 | | date: Tue Sep 03 13:56:20 2013 -0400
222 | | date: Tue Sep 03 13:56:20 2013 -0400
223 | | summary: added f1.txt
223 | | summary: added f1.txt
224 | |
224 | |
225 o | changeset: 1:ef53c9e6b608
225 o | changeset: 1:ef53c9e6b608
226 |/ branch: f1
226 |/ branch: f1
227 | user: szhang
227 | user: szhang
228 | date: Tue Sep 03 13:55:26 2013 -0400
228 | date: Tue Sep 03 13:55:26 2013 -0400
229 | summary: created f1 branch
229 | summary: created f1 branch
230 |
230 |
231 o changeset: 0:24797d4f68de
231 o changeset: 0:24797d4f68de
232 user: szhang
232 user: szhang
233 date: Tue Sep 03 13:55:08 2013 -0400
233 date: Tue Sep 03 13:55:08 2013 -0400
234 summary: added default.txt
234 summary: added default.txt
235
235
236 $ hg rebase -s9 -d2 --debug # use debug to really check merge base used
236 $ hg rebase -s9 -d2 --debug # use debug to really check merge base used
237 rebase onto 4bc80088dc6b starting from e31216eec445
237 rebase onto 4bc80088dc6b starting from e31216eec445
238 rebasing on disk
238 rebasing on disk
239 rebase status stored
239 rebase status stored
240 rebasing 9:e31216eec445 "more changes to f1"
240 rebasing 9:e31216eec445 "more changes to f1"
241 future parents are 2 and -1
241 future parents are 2 and -1
242 update to 2:4bc80088dc6b
242 update to 2:4bc80088dc6b
243 resolving manifests
243 resolving manifests
244 branchmerge: False, force: True, partial: False
244 branchmerge: False, force: True, partial: False
245 ancestor: d79e2059b5c0+, local: d79e2059b5c0+, remote: 4bc80088dc6b
245 ancestor: d79e2059b5c0+, local: d79e2059b5c0+, remote: 4bc80088dc6b
246 f2.txt: other deleted -> r
246 f2.txt: other deleted -> r
247 removing f2.txt
247 removing f2.txt
248 f1.txt: remote created -> g
248 f1.txt: remote created -> g
249 getting f1.txt
249 getting f1.txt
250 merge against 9:e31216eec445
250 merge against 9:e31216eec445
251 detach base 8:8e4e2c1a07ae
251 detach base 8:8e4e2c1a07ae
252 resolving manifests
252 resolving manifests
253 branchmerge: True, force: True, partial: False
253 branchmerge: True, force: True, partial: False
254 ancestor: 8e4e2c1a07ae, local: 4bc80088dc6b+, remote: e31216eec445
254 ancestor: 8e4e2c1a07ae, local: 4bc80088dc6b+, remote: e31216eec445
255 f1.txt: remote is newer -> g
255 f1.txt: remote is newer -> g
256 getting f1.txt
256 getting f1.txt
257 committing files:
257 committing files:
258 f1.txt
258 f1.txt
259 committing manifest
259 committing manifest
260 committing changelog
260 committing changelog
261 updating the branch cache
261 updating the branch cache
262 rebased as 19c888675e13
262 rebased as 19c888675e13
263 rebase status stored
263 rebase status stored
264 rebasing 10:2f2496ddf49d tip "merge"
264 rebasing 10:2f2496ddf49d tip "merge"
265 future parents are 11 and 7
265 future parents are 11 and 7
266 already in destination
266 already in destination
267 merge against 10:2f2496ddf49d
267 merge against 10:2f2496ddf49d
268 detach base 9:e31216eec445
268 detach base 9:e31216eec445
269 resolving manifests
269 resolving manifests
270 branchmerge: True, force: True, partial: False
270 branchmerge: True, force: True, partial: False
271 ancestor: e31216eec445, local: 19c888675e13+, remote: 2f2496ddf49d
271 ancestor: e31216eec445, local: 19c888675e13+, remote: 2f2496ddf49d
272 f1.txt: remote is newer -> g
272 f1.txt: remote is newer -> g
273 getting f1.txt
273 getting f1.txt
274 committing files:
274 committing files:
275 f1.txt
275 f1.txt
276 committing manifest
276 committing manifest
277 committing changelog
277 committing changelog
278 updating the branch cache
278 updating the branch cache
279 rebased as 2a7f09cac94c
279 rebased as 2a7f09cac94c
280 rebase status stored
280 rebase status stored
281 rebase merging completed
281 rebase merging completed
282 update back to initial working directory parent
282 update back to initial working directory parent
283 resolving manifests
283 resolving manifests
284 branchmerge: False, force: False, partial: False
284 branchmerge: False, force: False, partial: False
285 ancestor: 2a7f09cac94c, local: 2a7f09cac94c+, remote: d79e2059b5c0
285 ancestor: 2a7f09cac94c, local: 2a7f09cac94c+, remote: d79e2059b5c0
286 f1.txt: other deleted -> r
286 f1.txt: other deleted -> r
287 removing f1.txt
287 removing f1.txt
288 f2.txt: remote created -> g
288 f2.txt: remote created -> g
289 getting f2.txt
289 getting f2.txt
290 2 changesets found
290 2 changesets found
291 list of changesets:
291 list of changesets:
292 e31216eec445e44352c5f01588856059466a24c9
292 e31216eec445e44352c5f01588856059466a24c9
293 2f2496ddf49d69b5ef23ad8cf9fb2e0e4faf0ac2
293 2f2496ddf49d69b5ef23ad8cf9fb2e0e4faf0ac2
294 bundle2-output-bundle: "HG20", (1 params) 3 parts total
294 bundle2-output-bundle: "HG20", (1 params) 3 parts total
295 bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload
295 bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload
296 bundle2-output-part: "cache:rev-branch-cache" (advisory) streamed payload
296 bundle2-output-part: "cache:rev-branch-cache" (advisory) streamed payload
297 bundle2-output-part: "phase-heads" 24 bytes payload
297 bundle2-output-part: "phase-heads" 24 bytes payload
298 saved backup bundle to $TESTTMP/issue4041/.hg/strip-backup/e31216eec445-15f7a814-rebase.hg
298 saved backup bundle to $TESTTMP/issue4041/.hg/strip-backup/e31216eec445-15f7a814-rebase.hg
299 3 changesets found
299 3 changesets found
300 list of changesets:
300 list of changesets:
301 4c9fbe56a16f30c0d5dcc40ec1a97bbe3325209c
301 4c9fbe56a16f30c0d5dcc40ec1a97bbe3325209c
302 19c888675e133ab5dff84516926a65672eaf04d9
302 19c888675e133ab5dff84516926a65672eaf04d9
303 2a7f09cac94c7f4b73ebd5cd1a62d3b2e8e336bf
303 2a7f09cac94c7f4b73ebd5cd1a62d3b2e8e336bf
304 bundle2-output-bundle: "HG20", 3 parts total
304 bundle2-output-bundle: "HG20", 3 parts total
305 bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload
305 bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload
306 bundle2-output-part: "cache:rev-branch-cache" (advisory) streamed payload
306 bundle2-output-part: "cache:rev-branch-cache" (advisory) streamed payload
307 bundle2-output-part: "phase-heads" 24 bytes payload
307 bundle2-output-part: "phase-heads" 24 bytes payload
308 adding branch
308 adding branch
309 bundle2-input-bundle: with-transaction
309 bundle2-input-bundle: with-transaction
310 bundle2-input-part: "changegroup" (params: 1 mandatory 1 advisory) supported
310 bundle2-input-part: "changegroup" (params: 1 mandatory 1 advisory) supported
311 adding changesets
311 adding changesets
312 add changeset 4c9fbe56a16f
312 add changeset 4c9fbe56a16f
313 add changeset 19c888675e13
313 add changeset 19c888675e13
314 add changeset 2a7f09cac94c
314 add changeset 2a7f09cac94c
315 adding manifests
315 adding manifests
316 adding file changes
316 adding file changes
317 adding f1.txt revisions
317 adding f1.txt revisions
318 bundle2-input-part: total payload size 1686
318 bundle2-input-part: total payload size 1686
319 bundle2-input-part: "cache:rev-branch-cache" (advisory) supported
319 bundle2-input-part: "cache:rev-branch-cache" (advisory) supported
320 bundle2-input-part: total payload size 74
320 bundle2-input-part: total payload size 74
321 truncating cache/rbc-revs-v1 to 56
321 truncating cache/rbc-revs-v1 to 56
322 bundle2-input-part: "phase-heads" supported
322 bundle2-input-part: "phase-heads" supported
323 bundle2-input-part: total payload size 24
323 bundle2-input-part: total payload size 24
324 bundle2-input-bundle: 3 parts total
324 bundle2-input-bundle: 3 parts total
325 added 2 changesets with 2 changes to 1 files
325 added 2 changesets with 2 changes to 1 files
326 updating the branch cache
326 updating the branch cache
327 invalid branch cache (served): tip differs
327 invalid branch cache (served): tip differs
328 invalid branch cache (served.hidden): tip differs
328 invalid branch cache (served.hidden): tip differs
329 rebase completed
329 rebase completed
330
330
331 Test minimization of merge conflicts
331 Test minimization of merge conflicts
332 $ hg up -q null
332 $ hg up -q null
333 $ echo a > a
333 $ echo a > a
334 $ hg add a
334 $ hg add a
335 $ hg commit -q -m 'a'
335 $ hg commit -q -m 'a'
336 $ echo b >> a
336 $ echo b >> a
337 $ hg commit -q -m 'ab'
337 $ hg commit -q -m 'ab'
338 $ hg bookmark ab
338 $ hg bookmark ab
339 $ hg up -q '.^'
339 $ hg up -q '.^'
340 $ echo b >> a
340 $ echo b >> a
341 $ echo c >> a
341 $ echo c >> a
342 $ hg commit -q -m 'abc'
342 $ hg commit -q -m 'abc'
343 $ hg rebase -s 7bc217434fc1 -d ab --keep
343 $ hg rebase -s 7bc217434fc1 -d ab --keep
344 rebasing 13:7bc217434fc1 tip "abc"
344 rebasing 13:7bc217434fc1 tip "abc"
345 merging a
345 merging a
346 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
346 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
347 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
347 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
348 [240]
348 [240]
349 $ hg diff
349 $ hg diff
350 diff -r 328e4ab1f7cc a
350 diff -r 328e4ab1f7cc a
351 --- a/a Thu Jan 01 00:00:00 1970 +0000
351 --- a/a Thu Jan 01 00:00:00 1970 +0000
352 +++ b/a * (glob)
352 +++ b/a * (glob)
353 @@ -1,2 +1,6 @@
353 @@ -1,2 +1,6 @@
354 a
354 a
355 b
355 b
356 +<<<<<<< dest: 328e4ab1f7cc ab - test: ab
356 +<<<<<<< dest: 328e4ab1f7cc ab - test: ab
357 +=======
357 +=======
358 +c
358 +c
359 +>>>>>>> source: 7bc217434fc1 - test: abc
359 +>>>>>>> source: 7bc217434fc1 - test: abc
360 $ hg rebase --abort
360 $ hg rebase --abort
361 rebase aborted
361 rebase aborted
362 $ hg up -q -C 7bc217434fc1
362 $ hg up -q -C 7bc217434fc1
363 $ hg rebase -s . -d ab --keep -t internal:merge3
363 $ hg rebase -s . -d ab --keep -t internal:merge3
364 rebasing 13:7bc217434fc1 tip "abc"
364 rebasing 13:7bc217434fc1 tip "abc"
365 merging a
365 merging a
366 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
366 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
367 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
367 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
368 [240]
368 [240]
369 $ hg diff
369 $ hg diff
370 diff -r 328e4ab1f7cc a
370 diff -r 328e4ab1f7cc a
371 --- a/a Thu Jan 01 00:00:00 1970 +0000
371 --- a/a Thu Jan 01 00:00:00 1970 +0000
372 +++ b/a * (glob)
372 +++ b/a * (glob)
373 @@ -1,2 +1,8 @@
373 @@ -1,2 +1,8 @@
374 a
374 a
375 +<<<<<<< dest: 328e4ab1f7cc ab - test: ab
375 +<<<<<<< dest: 328e4ab1f7cc ab - test: ab
376 b
376 b
377 +||||||| base
377 +||||||| base
378 +=======
378 +=======
379 +b
379 +b
380 +c
380 +c
381 +>>>>>>> source: 7bc217434fc1 - test: abc
381 +>>>>>>> source: 7bc217434fc1 - test: abc
382
382
383 Test rebase with obsstore turned on and off (issue5606)
383 Test rebase with obsstore turned on and off (issue5606)
384
384
385 $ cd $TESTTMP
385 $ cd $TESTTMP
386 $ hg init b
386 $ hg init b
387 $ cd b
387 $ cd b
388 $ hg debugdrawdag <<'EOS'
388 $ hg debugdrawdag <<'EOS'
389 > D
389 > D
390 > |
390 > |
391 > C
391 > C
392 > |
392 > |
393 > B E
393 > B E
394 > |/
394 > |/
395 > A
395 > A
396 > EOS
396 > EOS
397
397
398 $ hg update E -q
398 $ hg update E -q
399 $ echo 3 > B
399 $ echo 3 > B
400 $ hg commit --amend -m E -A B -q
400 $ hg commit --amend -m E -A B -q
401 $ hg rebase -r B+D -d . --config experimental.evolution=true
401 $ hg rebase -r B+D -d . --config experimental.evolution=true
402 rebasing 1:112478962961 B "B"
402 rebasing 1:112478962961 B "B"
403 merging B
403 merging B
404 warning: conflicts while merging B! (edit, then use 'hg resolve --mark')
404 warning: conflicts while merging B! (edit, then use 'hg resolve --mark')
405 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
405 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
406 [240]
406 [240]
407
407
408 $ echo 4 > B
408 $ echo 4 > B
409 $ hg resolve -m
409 $ hg resolve -m
410 (no more unresolved files)
410 (no more unresolved files)
411 continue: hg rebase --continue
411 continue: hg rebase --continue
412 $ hg rebase --continue --config experimental.evolution=none
412 $ hg rebase --continue --config experimental.evolution=none
413 rebasing 1:112478962961 B "B"
413 rebasing 1:112478962961 B "B"
414 rebasing 3:f585351a92f8 D "D"
414 rebasing 3:f585351a92f8 D "D"
415 warning: orphaned descendants detected, not stripping 112478962961
415 warning: orphaned descendants detected, not stripping 112478962961
416 saved backup bundle to $TESTTMP/b/.hg/strip-backup/f585351a92f8-e536a9e4-rebase.hg
416 saved backup bundle to $TESTTMP/b/.hg/strip-backup/f585351a92f8-e536a9e4-rebase.hg
417
417
418 $ rm .hg/localtags
418 $ rm .hg/localtags
419 $ hg tglog
419 $ hg tglog
420 o 5:draft 'D'
420 o 5:draft 'D'
421 |
421 |
422 o 4:draft 'B'
422 o 4:draft 'B'
423 |
423 |
424 @ 3:draft 'E'
424 @ 3:draft 'E'
425 |
425 |
426 | o 2:draft 'C'
426 | o 2:draft 'C'
427 | |
427 | |
428 | o 1:draft 'B'
428 | o 1:draft 'B'
429 |/
429 |/
430 o 0:draft 'A'
430 o 0:draft 'A'
431
431
432
432
433 Test where the conflict happens when rebasing a merge commit
433 Test where the conflict happens when rebasing a merge commit
434
434
435 $ cd $TESTTMP
435 $ cd $TESTTMP
436 $ hg init conflict-in-merge
436 $ hg init conflict-in-merge
437 $ cd conflict-in-merge
437 $ cd conflict-in-merge
438 $ hg debugdrawdag <<'EOS'
438 $ hg debugdrawdag <<'EOS'
439 > F # F/conflict = foo\n
439 > F # F/conflict = foo\n
440 > |\
440 > |\
441 > D E
441 > D E
442 > |/
442 > |/
443 > C B # B/conflict = bar\n
443 > C B # B/conflict = bar\n
444 > |/
444 > |/
445 > A
445 > A
446 > EOS
446 > EOS
447
447
448 $ hg co F
448 $ hg co F
449 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
449 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
450 $ hg rebase -d B
450 $ hg rebase -d B
451 rebasing 2:dc0947a82db8 C "C"
451 rebasing 2:dc0947a82db8 C "C"
452 rebasing 3:e7b3f00ed42e D "D"
452 rebasing 3:e7b3f00ed42e D "D"
453 rebasing 4:03ca77807e91 E "E"
453 rebasing 4:03ca77807e91 E "E"
454 rebasing 5:9a6b91dc2044 F tip "F"
454 rebasing 5:9a6b91dc2044 F tip "F"
455 merging conflict
455 merging conflict
456 warning: conflicts while merging conflict! (edit, then use 'hg resolve --mark')
456 warning: conflicts while merging conflict! (edit, then use 'hg resolve --mark')
457 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
457 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
458 [240]
458 [240]
459 $ hg tglog
459 $ hg tglog
460 @ 8:draft 'E'
460 @ 8:draft 'E'
461 |
461 |
462 | @ 7:draft 'D'
462 | @ 7:draft 'D'
463 |/
463 |/
464 o 6:draft 'C'
464 o 6:draft 'C'
465 |
465 |
466 | % 5:draft 'F'
466 | % 5:draft 'F'
467 | |\
467 | |\
468 | | o 4:draft 'E'
468 | | o 4:draft 'E'
469 | | |
469 | | |
470 | o | 3:draft 'D'
470 | o | 3:draft 'D'
471 | |/
471 | |/
472 | o 2:draft 'C'
472 | o 2:draft 'C'
473 | |
473 | |
474 o | 1:draft 'B'
474 o | 1:draft 'B'
475 |/
475 |/
476 o 0:draft 'A'
476 o 0:draft 'A'
477
477
478 $ echo baz > conflict
478 $ echo baz > conflict
479 $ hg resolve -m
479 $ hg resolve -m
480 (no more unresolved files)
480 (no more unresolved files)
481 continue: hg rebase --continue
481 continue: hg rebase --continue
482 $ hg rebase -c
482 $ hg rebase -c
483 already rebased 2:dc0947a82db8 C "C" as 0199610c343e
483 already rebased 2:dc0947a82db8 C "C" as 0199610c343e
484 already rebased 3:e7b3f00ed42e D "D" as f0dd538aaa63
484 already rebased 3:e7b3f00ed42e D "D" as f0dd538aaa63
485 already rebased 4:03ca77807e91 E "E" as cbf25af8347d
485 already rebased 4:03ca77807e91 E "E" as cbf25af8347d
486 rebasing 5:9a6b91dc2044 F "F"
486 rebasing 5:9a6b91dc2044 F "F"
487 saved backup bundle to $TESTTMP/conflict-in-merge/.hg/strip-backup/dc0947a82db8-ca7e7d5b-rebase.hg
487 saved backup bundle to $TESTTMP/conflict-in-merge/.hg/strip-backup/dc0947a82db8-ca7e7d5b-rebase.hg
488 $ hg tglog
488 $ hg tglog
489 @ 5:draft 'F'
489 @ 5:draft 'F'
490 |\
490 |\
491 | o 4:draft 'E'
491 | o 4:draft 'E'
492 | |
492 | |
493 o | 3:draft 'D'
493 o | 3:draft 'D'
494 |/
494 |/
495 o 2:draft 'C'
495 o 2:draft 'C'
496 |
496 |
497 o 1:draft 'B'
497 o 1:draft 'B'
498 |
498 |
499 o 0:draft 'A'
499 o 0:draft 'A'
500
500
@@ -1,706 +1,706 b''
1 $ cat >> $HGRCPATH <<EOF
1 $ cat >> $HGRCPATH <<EOF
2 > [commands]
2 > [commands]
3 > status.verbose=1
3 > status.verbose=1
4 > EOF
4 > EOF
5
5
6 # Construct the following history tree:
6 # Construct the following history tree:
7 #
7 #
8 # @ 5:e1bb631146ca b1
8 # @ 5:e1bb631146ca b1
9 # |
9 # |
10 # o 4:a4fdb3b883c4 0:b608b9236435 b1
10 # o 4:a4fdb3b883c4 0:b608b9236435 b1
11 # |
11 # |
12 # | o 3:4b57d2520816 1:44592833ba9f
12 # | o 3:4b57d2520816 1:44592833ba9f
13 # | |
13 # | |
14 # | | o 2:063f31070f65
14 # | | o 2:063f31070f65
15 # | |/
15 # | |/
16 # | o 1:44592833ba9f
16 # | o 1:44592833ba9f
17 # |/
17 # |/
18 # o 0:b608b9236435
18 # o 0:b608b9236435
19
19
20 $ mkdir b1
20 $ mkdir b1
21 $ cd b1
21 $ cd b1
22 $ hg init
22 $ hg init
23 $ echo foo > foo
23 $ echo foo > foo
24 $ echo zero > a
24 $ echo zero > a
25 $ hg init sub
25 $ hg init sub
26 $ echo suba > sub/suba
26 $ echo suba > sub/suba
27 $ hg --cwd sub ci -Am addsuba
27 $ hg --cwd sub ci -Am addsuba
28 adding suba
28 adding suba
29 $ echo 'sub = sub' > .hgsub
29 $ echo 'sub = sub' > .hgsub
30 $ hg ci -qAm0
30 $ hg ci -qAm0
31 $ echo one > a ; hg ci -m1
31 $ echo one > a ; hg ci -m1
32 $ echo two > a ; hg ci -m2
32 $ echo two > a ; hg ci -m2
33 $ hg up -q 1
33 $ hg up -q 1
34 $ echo three > a ; hg ci -qm3
34 $ echo three > a ; hg ci -qm3
35 $ hg up -q 0
35 $ hg up -q 0
36 $ hg branch -q b1
36 $ hg branch -q b1
37 $ echo four > a ; hg ci -qm4
37 $ echo four > a ; hg ci -qm4
38 $ echo five > a ; hg ci -qm5
38 $ echo five > a ; hg ci -qm5
39
39
40 Initial repo state:
40 Initial repo state:
41
41
42 $ hg log -G --template '{rev}:{node|short} {parents} {branches}\n'
42 $ hg log -G --template '{rev}:{node|short} {parents} {branches}\n'
43 @ 5:ff252e8273df b1
43 @ 5:ff252e8273df b1
44 |
44 |
45 o 4:d047485b3896 0:60829823a42a b1
45 o 4:d047485b3896 0:60829823a42a b1
46 |
46 |
47 | o 3:6efa171f091b 1:0786582aa4b1
47 | o 3:6efa171f091b 1:0786582aa4b1
48 | |
48 | |
49 | | o 2:bd10386d478c
49 | | o 2:bd10386d478c
50 | |/
50 | |/
51 | o 1:0786582aa4b1
51 | o 1:0786582aa4b1
52 |/
52 |/
53 o 0:60829823a42a
53 o 0:60829823a42a
54
54
55
55
56 Make sure update doesn't assume b1 is a repository if invoked from outside:
56 Make sure update doesn't assume b1 is a repository if invoked from outside:
57
57
58 $ cd ..
58 $ cd ..
59 $ hg update b1
59 $ hg update b1
60 abort: no repository found in '$TESTTMP' (.hg not found)
60 abort: no repository found in '$TESTTMP' (.hg not found)
61 [10]
61 [10]
62 $ cd b1
62 $ cd b1
63
63
64 Test helper functions:
64 Test helper functions:
65
65
66 $ revtest () {
66 $ revtest () {
67 > msg=$1
67 > msg=$1
68 > dirtyflag=$2 # 'clean', 'dirty' or 'dirtysub'
68 > dirtyflag=$2 # 'clean', 'dirty' or 'dirtysub'
69 > startrev=$3
69 > startrev=$3
70 > targetrev=$4
70 > targetrev=$4
71 > opt=$5
71 > opt=$5
72 > hg up -qC $startrev
72 > hg up -qC $startrev
73 > test $dirtyflag = dirty && echo dirty > foo
73 > test $dirtyflag = dirty && echo dirty > foo
74 > test $dirtyflag = dirtysub && echo dirty > sub/suba
74 > test $dirtyflag = dirtysub && echo dirty > sub/suba
75 > hg up $opt $targetrev
75 > hg up $opt $targetrev
76 > hg parent --template 'parent={rev}\n'
76 > hg parent --template 'parent={rev}\n'
77 > hg stat -S
77 > hg stat -S
78 > }
78 > }
79
79
80 $ norevtest () {
80 $ norevtest () {
81 > msg=$1
81 > msg=$1
82 > dirtyflag=$2 # 'clean', 'dirty' or 'dirtysub'
82 > dirtyflag=$2 # 'clean', 'dirty' or 'dirtysub'
83 > startrev=$3
83 > startrev=$3
84 > opt=$4
84 > opt=$4
85 > hg up -qC $startrev
85 > hg up -qC $startrev
86 > test $dirtyflag = dirty && echo dirty > foo
86 > test $dirtyflag = dirty && echo dirty > foo
87 > test $dirtyflag = dirtysub && echo dirty > sub/suba
87 > test $dirtyflag = dirtysub && echo dirty > sub/suba
88 > hg up $opt
88 > hg up $opt
89 > hg parent --template 'parent={rev}\n'
89 > hg parent --template 'parent={rev}\n'
90 > hg stat -S
90 > hg stat -S
91 > }
91 > }
92
92
93 Test cases are documented in a table in the update function of merge.py.
93 Test cases are documented in a table in the update function of merge.py.
94 Cases are run as shown in that table, row by row.
94 Cases are run as shown in that table, row by row.
95
95
96 $ norevtest 'none clean linear' clean 4
96 $ norevtest 'none clean linear' clean 4
97 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
97 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
98 parent=5
98 parent=5
99
99
100 $ norevtest 'none clean same' clean 2
100 $ norevtest 'none clean same' clean 2
101 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
101 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
102 updated to "bd10386d478c: 2"
102 updated to "bd10386d478c: 2"
103 1 other heads for branch "default"
103 1 other heads for branch "default"
104 parent=2
104 parent=2
105
105
106
106
107 $ revtest 'none clean linear' clean 1 2
107 $ revtest 'none clean linear' clean 1 2
108 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
108 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
109 parent=2
109 parent=2
110
110
111 $ revtest 'none clean same' clean 2 3
111 $ revtest 'none clean same' clean 2 3
112 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
112 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
113 parent=3
113 parent=3
114
114
115 $ revtest 'none clean cross' clean 3 4
115 $ revtest 'none clean cross' clean 3 4
116 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
116 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
117 parent=4
117 parent=4
118
118
119
119
120 $ revtest 'none dirty linear' dirty 1 2
120 $ revtest 'none dirty linear' dirty 1 2
121 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
121 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
122 parent=2
122 parent=2
123 M foo
123 M foo
124
124
125 $ revtest 'none dirtysub linear' dirtysub 1 2
125 $ revtest 'none dirtysub linear' dirtysub 1 2
126 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
126 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
127 parent=2
127 parent=2
128 M sub/suba
128 M sub/suba
129
129
130 $ revtest 'none dirty same' dirty 2 3
130 $ revtest 'none dirty same' dirty 2 3
131 abort: uncommitted changes
131 abort: uncommitted changes
132 (commit or update --clean to discard changes)
132 (commit or update --clean to discard changes)
133 parent=2
133 parent=2
134 M foo
134 M foo
135
135
136 $ revtest 'none dirtysub same' dirtysub 2 3
136 $ revtest 'none dirtysub same' dirtysub 2 3
137 abort: uncommitted changes
137 abort: uncommitted changes
138 (commit or update --clean to discard changes)
138 (commit or update --clean to discard changes)
139 parent=2
139 parent=2
140 M sub/suba
140 M sub/suba
141
141
142 $ revtest 'none dirty cross' dirty 3 4
142 $ revtest 'none dirty cross' dirty 3 4
143 abort: uncommitted changes
143 abort: uncommitted changes
144 (commit or update --clean to discard changes)
144 (commit or update --clean to discard changes)
145 parent=3
145 parent=3
146 M foo
146 M foo
147
147
148 $ norevtest 'none dirty cross' dirty 2
148 $ norevtest 'none dirty cross' dirty 2
149 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
149 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
150 updated to "bd10386d478c: 2"
150 updated to "bd10386d478c: 2"
151 1 other heads for branch "default"
151 1 other heads for branch "default"
152 parent=2
152 parent=2
153 M foo
153 M foo
154
154
155 $ revtest 'none dirtysub cross' dirtysub 3 4
155 $ revtest 'none dirtysub cross' dirtysub 3 4
156 abort: uncommitted changes
156 abort: uncommitted changes
157 (commit or update --clean to discard changes)
157 (commit or update --clean to discard changes)
158 parent=3
158 parent=3
159 M sub/suba
159 M sub/suba
160
160
161 $ revtest '-C dirty linear' dirty 1 2 -C
161 $ revtest '-C dirty linear' dirty 1 2 -C
162 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
162 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
163 parent=2
163 parent=2
164
164
165 $ revtest '-c dirty linear' dirty 1 2 -c
165 $ revtest '-c dirty linear' dirty 1 2 -c
166 abort: uncommitted changes
166 abort: uncommitted changes
167 parent=1
167 parent=1
168 M foo
168 M foo
169
169
170 $ revtest '-m dirty linear' dirty 1 2 -m
170 $ revtest '-m dirty linear' dirty 1 2 -m
171 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
171 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
172 parent=2
172 parent=2
173 M foo
173 M foo
174
174
175 $ revtest '-m dirty cross' dirty 3 4 -m
175 $ revtest '-m dirty cross' dirty 3 4 -m
176 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
176 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
177 parent=4
177 parent=4
178 M foo
178 M foo
179
179
180 $ revtest '-c dirtysub linear' dirtysub 1 2 -c
180 $ revtest '-c dirtysub linear' dirtysub 1 2 -c
181 abort: uncommitted changes in subrepository "sub"
181 abort: uncommitted changes in subrepository "sub"
182 parent=1
182 parent=1
183 M sub/suba
183 M sub/suba
184
184
185 $ norevtest '-c clean same' clean 2 -c
185 $ norevtest '-c clean same' clean 2 -c
186 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
186 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
187 updated to "bd10386d478c: 2"
187 updated to "bd10386d478c: 2"
188 1 other heads for branch "default"
188 1 other heads for branch "default"
189 parent=2
189 parent=2
190
190
191 $ revtest '-cC dirty linear' dirty 1 2 -cC
191 $ revtest '-cC dirty linear' dirty 1 2 -cC
192 abort: cannot specify both --clean and --check
192 abort: cannot specify both --clean and --check
193 parent=1
193 parent=1
194 M foo
194 M foo
195
195
196 $ revtest '-mc dirty linear' dirty 1 2 -mc
196 $ revtest '-mc dirty linear' dirty 1 2 -mc
197 abort: cannot specify both --check and --merge
197 abort: cannot specify both --check and --merge
198 parent=1
198 parent=1
199 M foo
199 M foo
200
200
201 $ revtest '-mC dirty linear' dirty 1 2 -mC
201 $ revtest '-mC dirty linear' dirty 1 2 -mC
202 abort: cannot specify both --clean and --merge
202 abort: cannot specify both --clean and --merge
203 parent=1
203 parent=1
204 M foo
204 M foo
205
205
206 $ echo '[commands]' >> .hg/hgrc
206 $ echo '[commands]' >> .hg/hgrc
207 $ echo 'update.check = abort' >> .hg/hgrc
207 $ echo 'update.check = abort' >> .hg/hgrc
208
208
209 $ revtest 'none dirty linear' dirty 1 2
209 $ revtest 'none dirty linear' dirty 1 2
210 abort: uncommitted changes
210 abort: uncommitted changes
211 parent=1
211 parent=1
212 M foo
212 M foo
213
213
214 $ revtest 'none dirty linear' dirty 1 2 -c
214 $ revtest 'none dirty linear' dirty 1 2 -c
215 abort: uncommitted changes
215 abort: uncommitted changes
216 parent=1
216 parent=1
217 M foo
217 M foo
218
218
219 $ revtest 'none dirty linear' dirty 1 2 -C
219 $ revtest 'none dirty linear' dirty 1 2 -C
220 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
220 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
221 parent=2
221 parent=2
222
222
223 $ echo 'update.check = none' >> .hg/hgrc
223 $ echo 'update.check = none' >> .hg/hgrc
224
224
225 $ revtest 'none dirty cross' dirty 3 4
225 $ revtest 'none dirty cross' dirty 3 4
226 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
226 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
227 parent=4
227 parent=4
228 M foo
228 M foo
229
229
230 $ revtest 'none dirty linear' dirty 1 2
230 $ revtest 'none dirty linear' dirty 1 2
231 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
231 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
232 parent=2
232 parent=2
233 M foo
233 M foo
234
234
235 $ revtest 'none dirty linear' dirty 1 2 -c
235 $ revtest 'none dirty linear' dirty 1 2 -c
236 abort: uncommitted changes
236 abort: uncommitted changes
237 parent=1
237 parent=1
238 M foo
238 M foo
239
239
240 $ revtest 'none dirty linear' dirty 1 2 -C
240 $ revtest 'none dirty linear' dirty 1 2 -C
241 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
241 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
242 parent=2
242 parent=2
243
243
244 $ hg co -qC 3
244 $ hg co -qC 3
245 $ echo dirty >> a
245 $ echo dirty >> a
246 $ hg co --tool :merge3 4
246 $ hg co --tool :merge3 4
247 merging a
247 merging a
248 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
248 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
249 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
249 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
250 use 'hg resolve' to retry unresolved file merges
250 use 'hg resolve' to retry unresolved file merges
251 [1]
251 [1]
252 $ hg log -G --template '{rev}:{node|short} {parents} {branches}\n'
252 $ hg log -G --template '{rev}:{node|short} {parents} {branches}\n'
253 o 5:ff252e8273df b1
253 o 5:ff252e8273df b1
254 |
254 |
255 @ 4:d047485b3896 0:60829823a42a b1
255 @ 4:d047485b3896 0:60829823a42a b1
256 |
256 |
257 | % 3:6efa171f091b 1:0786582aa4b1
257 | % 3:6efa171f091b 1:0786582aa4b1
258 | |
258 | |
259 | | o 2:bd10386d478c
259 | | o 2:bd10386d478c
260 | |/
260 | |/
261 | o 1:0786582aa4b1
261 | o 1:0786582aa4b1
262 |/
262 |/
263 o 0:60829823a42a
263 o 0:60829823a42a
264
264
265 $ hg st
265 $ hg st
266 M a
266 M a
267 ? a.orig
267 ? a.orig
268 # Unresolved merge conflicts:
268 # Unresolved merge conflicts:
269 #
269 #
270 # a
270 # a
271 #
271 #
272 # To mark files as resolved: hg resolve --mark FILE
272 # To mark files as resolved: hg resolve --mark FILE
273
273
274 $ cat a
274 $ cat a
275 <<<<<<< working copy: 6efa171f091b - test: 3
275 <<<<<<< working copy: 6efa171f091b - test: 3
276 three
276 three
277 dirty
277 dirty
278 ||||||| base
278 ||||||| base
279 three
279 three
280 =======
280 =======
281 four
281 four
282 >>>>>>> destination: d047485b3896 b1 - test: 4
282 >>>>>>> destination: d047485b3896 b1 - test: 4
283 $ rm a.orig
283 $ rm a.orig
284
284
285 $ echo 'update.check = noconflict' >> .hg/hgrc
285 $ echo 'update.check = noconflict' >> .hg/hgrc
286
286
287 $ revtest 'none dirty cross' dirty 3 4
287 $ revtest 'none dirty cross' dirty 3 4
288 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
288 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
289 parent=4
289 parent=4
290 M foo
290 M foo
291
291
292 $ revtest 'none dirty linear' dirty 1 2
292 $ revtest 'none dirty linear' dirty 1 2
293 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
293 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
294 parent=2
294 parent=2
295 M foo
295 M foo
296
296
297 $ revtest 'none dirty linear' dirty 1 2 -c
297 $ revtest 'none dirty linear' dirty 1 2 -c
298 abort: uncommitted changes
298 abort: uncommitted changes
299 parent=1
299 parent=1
300 M foo
300 M foo
301
301
302 $ revtest 'none dirty linear' dirty 1 2 -C
302 $ revtest 'none dirty linear' dirty 1 2 -C
303 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
303 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
304 parent=2
304 parent=2
305
305
306 Locally added file is allowed
306 Locally added file is allowed
307 $ hg up -qC 3
307 $ hg up -qC 3
308 $ echo a > bar
308 $ echo a > bar
309 $ hg add bar
309 $ hg add bar
310 $ hg up -q 4
310 $ hg up -q 4
311 $ hg st
311 $ hg st
312 A bar
312 A bar
313 $ hg forget bar
313 $ hg forget bar
314 $ rm bar
314 $ rm bar
315
315
316 Locally removed file is allowed
316 Locally removed file is allowed
317 $ hg up -qC 3
317 $ hg up -qC 3
318 $ hg rm foo
318 $ hg rm foo
319 $ hg up -q 4
319 $ hg up -q 4
320
320
321 File conflict is not allowed
321 File conflict is not allowed
322 $ hg up -qC 3
322 $ hg up -qC 3
323 $ echo dirty >> a
323 $ echo dirty >> a
324 $ hg up -q 4
324 $ hg up -q 4
325 abort: conflicting changes
325 abort: conflicting changes
326 (commit or update --clean to discard changes)
326 (commit or update --clean to discard changes)
327 [255]
327 [255]
328 $ hg up -m 4
328 $ hg up -m 4
329 merging a
329 merging a
330 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
330 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
331 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
331 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
332 use 'hg resolve' to retry unresolved file merges
332 use 'hg resolve' to retry unresolved file merges
333 [1]
333 [1]
334 $ rm a.orig
334 $ rm a.orig
335 $ hg status
335 $ hg status
336 M a
336 M a
337 # Unresolved merge conflicts:
337 # Unresolved merge conflicts:
338 #
338 #
339 # a
339 # a
340 #
340 #
341 # To mark files as resolved: hg resolve --mark FILE
341 # To mark files as resolved: hg resolve --mark FILE
342
342
343 $ hg resolve -l
343 $ hg resolve -l
344 U a
344 U a
345
345
346 Try to make empty commit while there are conflicts
346 Try to make empty commit while there are conflicts
347 $ hg revert -r . a
347 $ hg revert -r . a
348 $ rm a.orig
348 $ rm a.orig
349 $ hg ci -m empty
349 $ hg ci -m empty
350 abort: unresolved merge conflicts (see 'hg help resolve')
350 abort: unresolved merge conflicts (see 'hg help resolve')
351 [255]
351 [20]
352 $ hg resolve -m a
352 $ hg resolve -m a
353 (no more unresolved files)
353 (no more unresolved files)
354 $ hg resolve -l
354 $ hg resolve -l
355 R a
355 R a
356 $ hg ci -m empty
356 $ hg ci -m empty
357 nothing changed
357 nothing changed
358 [1]
358 [1]
359 $ hg resolve -l
359 $ hg resolve -l
360
360
361 Change/delete conflict is not allowed
361 Change/delete conflict is not allowed
362 $ hg up -qC 3
362 $ hg up -qC 3
363 $ hg rm foo
363 $ hg rm foo
364 $ hg up -q 4
364 $ hg up -q 4
365
365
366 Uses default value of "linear" when value is misspelled
366 Uses default value of "linear" when value is misspelled
367 $ echo 'update.check = linyar' >> .hg/hgrc
367 $ echo 'update.check = linyar' >> .hg/hgrc
368
368
369 $ revtest 'dirty cross' dirty 3 4
369 $ revtest 'dirty cross' dirty 3 4
370 abort: uncommitted changes
370 abort: uncommitted changes
371 (commit or update --clean to discard changes)
371 (commit or update --clean to discard changes)
372 parent=3
372 parent=3
373 M foo
373 M foo
374
374
375 Setup for later tests
375 Setup for later tests
376 $ revtest 'none dirty linear' dirty 1 2 -c
376 $ revtest 'none dirty linear' dirty 1 2 -c
377 abort: uncommitted changes
377 abort: uncommitted changes
378 parent=1
378 parent=1
379 M foo
379 M foo
380
380
381 $ cd ..
381 $ cd ..
382
382
383 Test updating to null revision
383 Test updating to null revision
384
384
385 $ hg init null-repo
385 $ hg init null-repo
386 $ cd null-repo
386 $ cd null-repo
387 $ echo a > a
387 $ echo a > a
388 $ hg add a
388 $ hg add a
389 $ hg ci -m a
389 $ hg ci -m a
390 $ hg up -qC 0
390 $ hg up -qC 0
391 $ echo b > b
391 $ echo b > b
392 $ hg add b
392 $ hg add b
393 $ hg up null
393 $ hg up null
394 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
394 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
395 $ hg st
395 $ hg st
396 A b
396 A b
397 $ hg up -q 0
397 $ hg up -q 0
398 $ hg st
398 $ hg st
399 A b
399 A b
400 $ hg up -qC null
400 $ hg up -qC null
401 $ hg st
401 $ hg st
402 ? b
402 ? b
403 $ cd ..
403 $ cd ..
404
404
405 Test updating with closed head
405 Test updating with closed head
406 ---------------------------------------------------------------------
406 ---------------------------------------------------------------------
407
407
408 $ hg clone -U -q b1 closed-heads
408 $ hg clone -U -q b1 closed-heads
409 $ cd closed-heads
409 $ cd closed-heads
410
410
411 Test updating if at least one non-closed branch head exists
411 Test updating if at least one non-closed branch head exists
412
412
413 if on the closed branch head:
413 if on the closed branch head:
414 - update to "."
414 - update to "."
415 - "updated to a closed branch head ...." message is displayed
415 - "updated to a closed branch head ...." message is displayed
416 - "N other heads for ...." message is displayed
416 - "N other heads for ...." message is displayed
417
417
418 $ hg update -q -C 3
418 $ hg update -q -C 3
419 $ hg commit --close-branch -m 6
419 $ hg commit --close-branch -m 6
420 $ norevtest "on closed branch head" clean 6
420 $ norevtest "on closed branch head" clean 6
421 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
421 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
422 no open descendant heads on branch "default", updating to a closed head
422 no open descendant heads on branch "default", updating to a closed head
423 (committing will reopen the head, use 'hg heads .' to see 1 other heads)
423 (committing will reopen the head, use 'hg heads .' to see 1 other heads)
424 parent=6
424 parent=6
425
425
426 if descendant non-closed branch head exists, and it is only one branch head:
426 if descendant non-closed branch head exists, and it is only one branch head:
427 - update to it, even if its revision is less than closed one
427 - update to it, even if its revision is less than closed one
428 - "N other heads for ...." message isn't displayed
428 - "N other heads for ...." message isn't displayed
429
429
430 $ norevtest "non-closed 2 should be chosen" clean 1
430 $ norevtest "non-closed 2 should be chosen" clean 1
431 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
431 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
432 parent=2
432 parent=2
433
433
434 if all descendant branch heads are closed, but there is another branch head:
434 if all descendant branch heads are closed, but there is another branch head:
435 - update to the tipmost descendant head
435 - update to the tipmost descendant head
436 - "updated to a closed branch head ...." message is displayed
436 - "updated to a closed branch head ...." message is displayed
437 - "N other heads for ...." message is displayed
437 - "N other heads for ...." message is displayed
438
438
439 $ norevtest "all descendant branch heads are closed" clean 3
439 $ norevtest "all descendant branch heads are closed" clean 3
440 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
440 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
441 no open descendant heads on branch "default", updating to a closed head
441 no open descendant heads on branch "default", updating to a closed head
442 (committing will reopen the head, use 'hg heads .' to see 1 other heads)
442 (committing will reopen the head, use 'hg heads .' to see 1 other heads)
443 parent=6
443 parent=6
444
444
445 Test updating if all branch heads are closed
445 Test updating if all branch heads are closed
446
446
447 if on the closed branch head:
447 if on the closed branch head:
448 - update to "."
448 - update to "."
449 - "updated to a closed branch head ...." message is displayed
449 - "updated to a closed branch head ...." message is displayed
450 - "all heads of branch ...." message is displayed
450 - "all heads of branch ...." message is displayed
451
451
452 $ hg update -q -C 2
452 $ hg update -q -C 2
453 $ hg commit --close-branch -m 7
453 $ hg commit --close-branch -m 7
454 $ norevtest "all heads of branch default are closed" clean 6
454 $ norevtest "all heads of branch default are closed" clean 6
455 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
455 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
456 no open descendant heads on branch "default", updating to a closed head
456 no open descendant heads on branch "default", updating to a closed head
457 (committing will reopen branch "default")
457 (committing will reopen branch "default")
458 parent=6
458 parent=6
459
459
460 if not on the closed branch head:
460 if not on the closed branch head:
461 - update to the tipmost descendant (closed) head
461 - update to the tipmost descendant (closed) head
462 - "updated to a closed branch head ...." message is displayed
462 - "updated to a closed branch head ...." message is displayed
463 - "all heads of branch ...." message is displayed
463 - "all heads of branch ...." message is displayed
464
464
465 $ norevtest "all heads of branch default are closed" clean 1
465 $ norevtest "all heads of branch default are closed" clean 1
466 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
466 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
467 no open descendant heads on branch "default", updating to a closed head
467 no open descendant heads on branch "default", updating to a closed head
468 (committing will reopen branch "default")
468 (committing will reopen branch "default")
469 parent=7
469 parent=7
470
470
471 $ cd ..
471 $ cd ..
472
472
473 Test updating if "default" branch doesn't exist and no revision is
473 Test updating if "default" branch doesn't exist and no revision is
474 checked out (= "default" is used as current branch)
474 checked out (= "default" is used as current branch)
475
475
476 $ hg init no-default-branch
476 $ hg init no-default-branch
477 $ cd no-default-branch
477 $ cd no-default-branch
478
478
479 $ hg branch foobar
479 $ hg branch foobar
480 marked working directory as branch foobar
480 marked working directory as branch foobar
481 (branches are permanent and global, did you want a bookmark?)
481 (branches are permanent and global, did you want a bookmark?)
482 $ echo a > a
482 $ echo a > a
483 $ hg commit -m "#0" -A
483 $ hg commit -m "#0" -A
484 adding a
484 adding a
485 $ echo 1 >> a
485 $ echo 1 >> a
486 $ hg commit -m "#1"
486 $ hg commit -m "#1"
487 $ hg update -q 0
487 $ hg update -q 0
488 $ echo 3 >> a
488 $ echo 3 >> a
489 $ hg commit -m "#2"
489 $ hg commit -m "#2"
490 created new head
490 created new head
491 $ hg commit --close-branch -m "#3"
491 $ hg commit --close-branch -m "#3"
492
492
493 if there is at least one non-closed branch head:
493 if there is at least one non-closed branch head:
494 - update to the tipmost branch head
494 - update to the tipmost branch head
495
495
496 $ norevtest "non-closed 1 should be chosen" clean null
496 $ norevtest "non-closed 1 should be chosen" clean null
497 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
497 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
498 parent=1
498 parent=1
499
499
500 if all branch heads are closed
500 if all branch heads are closed
501 - update to "tip"
501 - update to "tip"
502 - "updated to a closed branch head ...." message is displayed
502 - "updated to a closed branch head ...." message is displayed
503 - "all heads for branch "XXXX" are closed" message is displayed
503 - "all heads for branch "XXXX" are closed" message is displayed
504
504
505 $ hg update -q -C 1
505 $ hg update -q -C 1
506 $ hg commit --close-branch -m "#4"
506 $ hg commit --close-branch -m "#4"
507
507
508 $ norevtest "all branches are closed" clean null
508 $ norevtest "all branches are closed" clean null
509 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
509 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
510 no open descendant heads on branch "foobar", updating to a closed head
510 no open descendant heads on branch "foobar", updating to a closed head
511 (committing will reopen branch "foobar")
511 (committing will reopen branch "foobar")
512 parent=4
512 parent=4
513
513
514 $ cd ../b1
514 $ cd ../b1
515
515
516 Test obsolescence behavior
516 Test obsolescence behavior
517 ---------------------------------------------------------------------
517 ---------------------------------------------------------------------
518
518
519 successors should be taken in account when checking head destination
519 successors should be taken in account when checking head destination
520
520
521 $ cat << EOF >> $HGRCPATH
521 $ cat << EOF >> $HGRCPATH
522 > [ui]
522 > [ui]
523 > logtemplate={rev}:{node|short} {desc|firstline}
523 > logtemplate={rev}:{node|short} {desc|firstline}
524 > [experimental]
524 > [experimental]
525 > evolution.createmarkers=True
525 > evolution.createmarkers=True
526 > EOF
526 > EOF
527
527
528 Test no-argument update to a successor of an obsoleted changeset
528 Test no-argument update to a successor of an obsoleted changeset
529
529
530 $ hg log -G
530 $ hg log -G
531 o 5:ff252e8273df 5
531 o 5:ff252e8273df 5
532 |
532 |
533 o 4:d047485b3896 4
533 o 4:d047485b3896 4
534 |
534 |
535 | o 3:6efa171f091b 3
535 | o 3:6efa171f091b 3
536 | |
536 | |
537 | | o 2:bd10386d478c 2
537 | | o 2:bd10386d478c 2
538 | |/
538 | |/
539 | @ 1:0786582aa4b1 1
539 | @ 1:0786582aa4b1 1
540 |/
540 |/
541 o 0:60829823a42a 0
541 o 0:60829823a42a 0
542
542
543 $ hg book bm -r 3
543 $ hg book bm -r 3
544 $ hg status
544 $ hg status
545 M foo
545 M foo
546
546
547 We add simple obsolescence marker between 3 and 4 (indirect successors)
547 We add simple obsolescence marker between 3 and 4 (indirect successors)
548
548
549 $ hg id --debug -i -r 3
549 $ hg id --debug -i -r 3
550 6efa171f091b00a3c35edc15d48c52a498929953
550 6efa171f091b00a3c35edc15d48c52a498929953
551 $ hg id --debug -i -r 4
551 $ hg id --debug -i -r 4
552 d047485b3896813b2a624e86201983520f003206
552 d047485b3896813b2a624e86201983520f003206
553 $ hg debugobsolete 6efa171f091b00a3c35edc15d48c52a498929953 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
553 $ hg debugobsolete 6efa171f091b00a3c35edc15d48c52a498929953 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
554 1 new obsolescence markers
554 1 new obsolescence markers
555 obsoleted 1 changesets
555 obsoleted 1 changesets
556 $ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa d047485b3896813b2a624e86201983520f003206
556 $ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa d047485b3896813b2a624e86201983520f003206
557 1 new obsolescence markers
557 1 new obsolescence markers
558
558
559 Test that 5 is detected as a valid destination from 3 and also accepts moving
559 Test that 5 is detected as a valid destination from 3 and also accepts moving
560 the bookmark (issue4015)
560 the bookmark (issue4015)
561
561
562 $ hg up --quiet --hidden 3
562 $ hg up --quiet --hidden 3
563 $ hg up 5
563 $ hg up 5
564 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
564 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
565 $ hg book bm
565 $ hg book bm
566 moving bookmark 'bm' forward from 6efa171f091b
566 moving bookmark 'bm' forward from 6efa171f091b
567 $ hg bookmarks
567 $ hg bookmarks
568 * bm 5:ff252e8273df
568 * bm 5:ff252e8273df
569
569
570 Test that we abort before we warn about the hidden commit if the working
570 Test that we abort before we warn about the hidden commit if the working
571 directory is dirty
571 directory is dirty
572 $ echo conflict > a
572 $ echo conflict > a
573 $ hg up --hidden 3
573 $ hg up --hidden 3
574 abort: uncommitted changes
574 abort: uncommitted changes
575 (commit or update --clean to discard changes)
575 (commit or update --clean to discard changes)
576 [255]
576 [255]
577
577
578 Test that we still warn also when there are conflicts
578 Test that we still warn also when there are conflicts
579 $ hg up -m --hidden 3
579 $ hg up -m --hidden 3
580 merging a
580 merging a
581 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
581 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
582 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
582 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
583 use 'hg resolve' to retry unresolved file merges
583 use 'hg resolve' to retry unresolved file merges
584 (leaving bookmark bm)
584 (leaving bookmark bm)
585 updated to hidden changeset 6efa171f091b
585 updated to hidden changeset 6efa171f091b
586 (hidden revision '6efa171f091b' was rewritten as: d047485b3896)
586 (hidden revision '6efa171f091b' was rewritten as: d047485b3896)
587 [1]
587 [1]
588
588
589 Test that statuses are reported properly before and after merge resolution.
589 Test that statuses are reported properly before and after merge resolution.
590 $ rm a.orig
590 $ rm a.orig
591 $ hg resolve -l
591 $ hg resolve -l
592 U a
592 U a
593 $ hg status
593 $ hg status
594 M a
594 M a
595 M foo
595 M foo
596 # Unresolved merge conflicts:
596 # Unresolved merge conflicts:
597 #
597 #
598 # a
598 # a
599 #
599 #
600 # To mark files as resolved: hg resolve --mark FILE
600 # To mark files as resolved: hg resolve --mark FILE
601
601
602
602
603 $ hg revert -r . a
603 $ hg revert -r . a
604
604
605 $ rm a.orig
605 $ rm a.orig
606 $ hg resolve -l
606 $ hg resolve -l
607 U a
607 U a
608 $ hg status
608 $ hg status
609 M foo
609 M foo
610 # Unresolved merge conflicts:
610 # Unresolved merge conflicts:
611 #
611 #
612 # a
612 # a
613 #
613 #
614 # To mark files as resolved: hg resolve --mark FILE
614 # To mark files as resolved: hg resolve --mark FILE
615
615
616 $ hg status -Tjson
616 $ hg status -Tjson
617 [
617 [
618 {
618 {
619 "itemtype": "file",
619 "itemtype": "file",
620 "path": "foo",
620 "path": "foo",
621 "status": "M"
621 "status": "M"
622 },
622 },
623 {
623 {
624 "itemtype": "file",
624 "itemtype": "file",
625 "path": "a",
625 "path": "a",
626 "unresolved": true
626 "unresolved": true
627 }
627 }
628 ]
628 ]
629
629
630 $ hg resolve -m
630 $ hg resolve -m
631 (no more unresolved files)
631 (no more unresolved files)
632
632
633 $ hg resolve -l
633 $ hg resolve -l
634 R a
634 R a
635 $ hg status
635 $ hg status
636 M foo
636 M foo
637 # No unresolved merge conflicts.
637 # No unresolved merge conflicts.
638
638
639 $ hg status -Tjson
639 $ hg status -Tjson
640 [
640 [
641 {
641 {
642 "itemtype": "file",
642 "itemtype": "file",
643 "path": "foo",
643 "path": "foo",
644 "status": "M"
644 "status": "M"
645 }
645 }
646 ]
646 ]
647
647
648 Test that 4 is detected as the no-argument destination from 3 and also moves
648 Test that 4 is detected as the no-argument destination from 3 and also moves
649 the bookmark with it
649 the bookmark with it
650 $ hg up --quiet 0 # we should be able to update to 3 directly
650 $ hg up --quiet 0 # we should be able to update to 3 directly
651 $ hg status
651 $ hg status
652 M foo
652 M foo
653 $ hg up --quiet --hidden 3 # but not implemented yet.
653 $ hg up --quiet --hidden 3 # but not implemented yet.
654 updated to hidden changeset 6efa171f091b
654 updated to hidden changeset 6efa171f091b
655 (hidden revision '6efa171f091b' was rewritten as: d047485b3896)
655 (hidden revision '6efa171f091b' was rewritten as: d047485b3896)
656 $ hg book -f bm
656 $ hg book -f bm
657 $ hg up
657 $ hg up
658 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
658 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
659 updating bookmark bm
659 updating bookmark bm
660 $ hg book
660 $ hg book
661 * bm 4:d047485b3896
661 * bm 4:d047485b3896
662
662
663 Test that 5 is detected as a valid destination from 1
663 Test that 5 is detected as a valid destination from 1
664 $ hg up --quiet 0 # we should be able to update to 3 directly
664 $ hg up --quiet 0 # we should be able to update to 3 directly
665 $ hg up --quiet --hidden 3 # but not implemented yet.
665 $ hg up --quiet --hidden 3 # but not implemented yet.
666 updated to hidden changeset 6efa171f091b
666 updated to hidden changeset 6efa171f091b
667 (hidden revision '6efa171f091b' was rewritten as: d047485b3896)
667 (hidden revision '6efa171f091b' was rewritten as: d047485b3896)
668 $ hg up 5
668 $ hg up 5
669 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
669 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
670
670
671 Test that 5 is not detected as a valid destination from 2
671 Test that 5 is not detected as a valid destination from 2
672 $ hg up --quiet 0
672 $ hg up --quiet 0
673 $ hg up --quiet 2
673 $ hg up --quiet 2
674 $ hg up 5
674 $ hg up 5
675 abort: uncommitted changes
675 abort: uncommitted changes
676 (commit or update --clean to discard changes)
676 (commit or update --clean to discard changes)
677 [255]
677 [255]
678
678
679 Test that we don't crash when updating from a pruned changeset (i.e. has no
679 Test that we don't crash when updating from a pruned changeset (i.e. has no
680 successors). Behavior should probably be that we update to the first
680 successors). Behavior should probably be that we update to the first
681 non-obsolete parent but that will be decided later.
681 non-obsolete parent but that will be decided later.
682 $ hg id --debug -r 2
682 $ hg id --debug -r 2
683 bd10386d478cd5a9faf2e604114c8e6da62d3889
683 bd10386d478cd5a9faf2e604114c8e6da62d3889
684 $ hg up --quiet 0
684 $ hg up --quiet 0
685 $ hg up --quiet 2
685 $ hg up --quiet 2
686 $ hg debugobsolete bd10386d478cd5a9faf2e604114c8e6da62d3889
686 $ hg debugobsolete bd10386d478cd5a9faf2e604114c8e6da62d3889
687 1 new obsolescence markers
687 1 new obsolescence markers
688 obsoleted 1 changesets
688 obsoleted 1 changesets
689 $ hg up
689 $ hg up
690 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
690 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
691
691
692 Test experimental revset support
692 Test experimental revset support
693
693
694 $ hg log -r '_destupdate()'
694 $ hg log -r '_destupdate()'
695 2:bd10386d478c 2 (no-eol)
695 2:bd10386d478c 2 (no-eol)
696
696
697 Test that boolean flags allow --no-flag specification to override [defaults]
697 Test that boolean flags allow --no-flag specification to override [defaults]
698 $ cat >> $HGRCPATH <<EOF
698 $ cat >> $HGRCPATH <<EOF
699 > [defaults]
699 > [defaults]
700 > update = --check
700 > update = --check
701 > EOF
701 > EOF
702 $ hg co 2
702 $ hg co 2
703 abort: uncommitted changes
703 abort: uncommitted changes
704 [20]
704 [20]
705 $ hg co --no-check 2
705 $ hg co --no-check 2
706 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
706 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
General Comments 0
You need to be logged in to leave comments. Login now