##// END OF EJS Templates
graft: add test for reading old graftstate files with new mechanism...
Pulkit Goyal -
r38166:d1690a64 default
parent child Browse files
Show More
@@ -1,1375 +1,1412 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
28 $ hg merge -q default --tool internal:local
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 Can't continue without starting:
49 Can't continue without starting:
50
50
51 $ hg rm -q e
51 $ hg rm -q e
52 $ hg graft --continue
52 $ hg graft --continue
53 abort: no graft in progress
53 abort: no graft in progress
54 [255]
54 [255]
55 $ hg revert -r . -q e
55 $ hg revert -r . -q e
56
56
57 Need to specify a rev:
57 Need to specify a rev:
58
58
59 $ hg graft
59 $ hg graft
60 abort: no revisions specified
60 abort: no revisions specified
61 [255]
61 [255]
62
62
63 Can't graft ancestor:
63 Can't graft ancestor:
64
64
65 $ hg graft 1 2
65 $ hg graft 1 2
66 skipping ancestor revision 1:5d205f8b35b6
66 skipping ancestor revision 1:5d205f8b35b6
67 skipping ancestor revision 2:5c095ad7e90f
67 skipping ancestor revision 2:5c095ad7e90f
68 [255]
68 [255]
69
69
70 Specify revisions with -r:
70 Specify revisions with -r:
71
71
72 $ hg graft -r 1 -r 2
72 $ hg graft -r 1 -r 2
73 skipping ancestor revision 1:5d205f8b35b6
73 skipping ancestor revision 1:5d205f8b35b6
74 skipping ancestor revision 2:5c095ad7e90f
74 skipping ancestor revision 2:5c095ad7e90f
75 [255]
75 [255]
76
76
77 $ hg graft -r 1 2
77 $ hg graft -r 1 2
78 warning: inconsistent use of --rev might give unexpected revision ordering!
78 warning: inconsistent use of --rev might give unexpected revision ordering!
79 skipping ancestor revision 2:5c095ad7e90f
79 skipping ancestor revision 2:5c095ad7e90f
80 skipping ancestor revision 1:5d205f8b35b6
80 skipping ancestor revision 1:5d205f8b35b6
81 [255]
81 [255]
82
82
83 Can't graft with dirty wd:
83 Can't graft with dirty wd:
84
84
85 $ hg up -q 0
85 $ hg up -q 0
86 $ echo foo > a
86 $ echo foo > a
87 $ hg graft 1
87 $ hg graft 1
88 abort: uncommitted changes
88 abort: uncommitted changes
89 [255]
89 [255]
90 $ hg revert a
90 $ hg revert a
91
91
92 Graft a rename:
92 Graft a rename:
93 (this also tests that editor is invoked if '--edit' is specified)
93 (this also tests that editor is invoked if '--edit' is specified)
94
94
95 $ hg status --rev "2^1" --rev 2
95 $ hg status --rev "2^1" --rev 2
96 A b
96 A b
97 R a
97 R a
98 $ HGEDITOR=cat hg graft 2 -u foo --edit
98 $ HGEDITOR=cat hg graft 2 -u foo --edit
99 grafting 2:5c095ad7e90f "2"
99 grafting 2:5c095ad7e90f "2"
100 merging a and b to b
100 merging a and b to b
101 2
101 2
102
102
103
103
104 HG: Enter commit message. Lines beginning with 'HG:' are removed.
104 HG: Enter commit message. Lines beginning with 'HG:' are removed.
105 HG: Leave message empty to abort commit.
105 HG: Leave message empty to abort commit.
106 HG: --
106 HG: --
107 HG: user: foo
107 HG: user: foo
108 HG: branch 'default'
108 HG: branch 'default'
109 HG: added b
109 HG: added b
110 HG: removed a
110 HG: removed a
111 $ hg export tip --git
111 $ hg export tip --git
112 # HG changeset patch
112 # HG changeset patch
113 # User foo
113 # User foo
114 # Date 0 0
114 # Date 0 0
115 # Thu Jan 01 00:00:00 1970 +0000
115 # Thu Jan 01 00:00:00 1970 +0000
116 # Node ID ef0ef43d49e79e81ddafdc7997401ba0041efc82
116 # Node ID ef0ef43d49e79e81ddafdc7997401ba0041efc82
117 # Parent 68795b066622ca79a25816a662041d8f78f3cd9e
117 # Parent 68795b066622ca79a25816a662041d8f78f3cd9e
118 2
118 2
119
119
120 diff --git a/a b/b
120 diff --git a/a b/b
121 rename from a
121 rename from a
122 rename to b
122 rename to b
123
123
124 Look for extra:source
124 Look for extra:source
125
125
126 $ hg log --debug -r tip
126 $ hg log --debug -r tip
127 changeset: 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82
127 changeset: 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82
128 tag: tip
128 tag: tip
129 phase: draft
129 phase: draft
130 parent: 0:68795b066622ca79a25816a662041d8f78f3cd9e
130 parent: 0:68795b066622ca79a25816a662041d8f78f3cd9e
131 parent: -1:0000000000000000000000000000000000000000
131 parent: -1:0000000000000000000000000000000000000000
132 manifest: 7:e59b6b228f9cbf9903d5e9abf996e083a1f533eb
132 manifest: 7:e59b6b228f9cbf9903d5e9abf996e083a1f533eb
133 user: foo
133 user: foo
134 date: Thu Jan 01 00:00:00 1970 +0000
134 date: Thu Jan 01 00:00:00 1970 +0000
135 files+: b
135 files+: b
136 files-: a
136 files-: a
137 extra: branch=default
137 extra: branch=default
138 extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4
138 extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4
139 description:
139 description:
140 2
140 2
141
141
142
142
143
143
144 Graft out of order, skipping a merge and a duplicate
144 Graft out of order, skipping a merge and a duplicate
145 (this also tests that editor is not invoked if '--edit' is not specified)
145 (this also tests that editor is not invoked if '--edit' is not specified)
146
146
147 $ hg graft 1 5 4 3 'merge()' 2 -n
147 $ hg graft 1 5 4 3 'merge()' 2 -n
148 skipping ungraftable merge revision 6
148 skipping ungraftable merge revision 6
149 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
149 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
150 grafting 1:5d205f8b35b6 "1"
150 grafting 1:5d205f8b35b6 "1"
151 grafting 5:97f8bfe72746 "5"
151 grafting 5:97f8bfe72746 "5"
152 grafting 4:9c233e8e184d "4"
152 grafting 4:9c233e8e184d "4"
153 grafting 3:4c60f11aa304 "3"
153 grafting 3:4c60f11aa304 "3"
154
154
155 $ HGEDITOR=cat hg graft 1 5 'merge()' 2 --debug
155 $ HGEDITOR=cat hg graft 1 5 'merge()' 2 --debug
156 skipping ungraftable merge revision 6
156 skipping ungraftable merge revision 6
157 scanning for duplicate grafts
157 scanning for duplicate grafts
158 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
158 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
159 grafting 1:5d205f8b35b6 "1"
159 grafting 1:5d205f8b35b6 "1"
160 searching for copies back to rev 1
160 searching for copies back to rev 1
161 unmatched files in local:
161 unmatched files in local:
162 b
162 b
163 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
163 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
164 src: 'a' -> dst: 'b' *
164 src: 'a' -> dst: 'b' *
165 checking for directory renames
165 checking for directory renames
166 resolving manifests
166 resolving manifests
167 branchmerge: True, force: True, partial: False
167 branchmerge: True, force: True, partial: False
168 ancestor: 68795b066622, local: ef0ef43d49e7+, remote: 5d205f8b35b6
168 ancestor: 68795b066622, local: ef0ef43d49e7+, remote: 5d205f8b35b6
169 preserving b for resolve of b
169 preserving b for resolve of b
170 starting 4 threads for background file closing (?)
170 starting 4 threads for background file closing (?)
171 b: local copied/moved from a -> m (premerge)
171 b: local copied/moved from a -> m (premerge)
172 picked tool ':merge' for b (binary False symlink False changedelete False)
172 picked tool ':merge' for b (binary False symlink False changedelete False)
173 merging b and a to b
173 merging b and a to b
174 my b@ef0ef43d49e7+ other a@5d205f8b35b6 ancestor a@68795b066622
174 my b@ef0ef43d49e7+ other a@5d205f8b35b6 ancestor a@68795b066622
175 premerge successful
175 premerge successful
176 committing files:
176 committing files:
177 b
177 b
178 committing manifest
178 committing manifest
179 committing changelog
179 committing changelog
180 updating the branch cache
180 updating the branch cache
181 grafting 5:97f8bfe72746 "5"
181 grafting 5:97f8bfe72746 "5"
182 searching for copies back to rev 1
182 searching for copies back to rev 1
183 unmatched files in other (from topological common ancestor):
183 unmatched files in other (from topological common ancestor):
184 c
184 c
185 resolving manifests
185 resolving manifests
186 branchmerge: True, force: True, partial: False
186 branchmerge: True, force: True, partial: False
187 ancestor: 4c60f11aa304, local: 6b9e5368ca4e+, remote: 97f8bfe72746
187 ancestor: 4c60f11aa304, local: 6b9e5368ca4e+, remote: 97f8bfe72746
188 e: remote is newer -> g
188 e: remote is newer -> g
189 getting e
189 getting e
190 committing files:
190 committing files:
191 e
191 e
192 committing manifest
192 committing manifest
193 committing changelog
193 committing changelog
194 updating the branch cache
194 updating the branch cache
195 $ HGEDITOR=cat hg graft 4 3 --log --debug
195 $ HGEDITOR=cat hg graft 4 3 --log --debug
196 scanning for duplicate grafts
196 scanning for duplicate grafts
197 grafting 4:9c233e8e184d "4"
197 grafting 4:9c233e8e184d "4"
198 searching for copies back to rev 1
198 searching for copies back to rev 1
199 unmatched files in other (from topological common ancestor):
199 unmatched files in other (from topological common ancestor):
200 c
200 c
201 resolving manifests
201 resolving manifests
202 branchmerge: True, force: True, partial: False
202 branchmerge: True, force: True, partial: False
203 ancestor: 4c60f11aa304, local: 1905859650ec+, remote: 9c233e8e184d
203 ancestor: 4c60f11aa304, local: 1905859650ec+, remote: 9c233e8e184d
204 preserving e for resolve of e
204 preserving e for resolve of e
205 d: remote is newer -> g
205 d: remote is newer -> g
206 getting d
206 getting d
207 e: versions differ -> m (premerge)
207 e: versions differ -> m (premerge)
208 picked tool ':merge' for e (binary False symlink False changedelete False)
208 picked tool ':merge' for e (binary False symlink False changedelete False)
209 merging e
209 merging e
210 my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304
210 my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304
211 e: versions differ -> m (merge)
211 e: versions differ -> m (merge)
212 picked tool ':merge' for e (binary False symlink False changedelete False)
212 picked tool ':merge' for e (binary False symlink False changedelete False)
213 my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304
213 my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304
214 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
214 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
215 abort: unresolved conflicts, can't continue
215 abort: unresolved conflicts, can't continue
216 (use 'hg resolve' and 'hg graft --continue --log')
216 (use 'hg resolve' and 'hg graft --continue --log')
217 [255]
217 [255]
218
218
219 Summary should mention graft:
219 Summary should mention graft:
220
220
221 $ hg summary |grep graft
221 $ hg summary |grep graft
222 commit: 2 modified, 2 unknown, 1 unresolved (graft in progress)
222 commit: 2 modified, 2 unknown, 1 unresolved (graft in progress)
223
223
224 Using status to get more context
224 Using status to get more context
225
225
226 $ hg status --verbose
226 $ hg status --verbose
227 M d
227 M d
228 M e
228 M e
229 ? a.orig
229 ? a.orig
230 ? e.orig
230 ? e.orig
231 # The repository is in an unfinished *graft* state.
231 # The repository is in an unfinished *graft* state.
232
232
233 # Unresolved merge conflicts:
233 # Unresolved merge conflicts:
234 #
234 #
235 # e
235 # e
236 #
236 #
237 # To mark files as resolved: hg resolve --mark FILE
237 # To mark files as resolved: hg resolve --mark FILE
238
238
239 # To continue: hg graft --continue
239 # To continue: hg graft --continue
240 # To abort: hg update --clean . (warning: this will discard uncommitted changes)
240 # To abort: hg update --clean . (warning: this will discard uncommitted changes)
241
241
242
242
243 Commit while interrupted should fail:
243 Commit while interrupted should fail:
244
244
245 $ hg ci -m 'commit interrupted graft'
245 $ hg ci -m 'commit interrupted graft'
246 abort: graft in progress
246 abort: graft in progress
247 (use 'hg graft --continue' or 'hg update' to abort)
247 (use 'hg graft --continue' or 'hg update' to abort)
248 [255]
248 [255]
249
249
250 Abort the graft and try committing:
250 Abort the graft and try committing:
251
251
252 $ hg up -C .
252 $ hg up -C .
253 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
253 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
254 $ echo c >> e
254 $ echo c >> e
255 $ hg ci -mtest
255 $ hg ci -mtest
256
256
257 $ hg strip . --config extensions.strip=
257 $ hg strip . --config extensions.strip=
258 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
258 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
259 saved backup bundle to $TESTTMP/a/.hg/strip-backup/*-backup.hg (glob)
259 saved backup bundle to $TESTTMP/a/.hg/strip-backup/*-backup.hg (glob)
260
260
261 Graft again:
261 Graft again:
262
262
263 $ hg graft 1 5 4 3 'merge()' 2
263 $ hg graft 1 5 4 3 'merge()' 2
264 skipping ungraftable merge revision 6
264 skipping ungraftable merge revision 6
265 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
265 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
266 skipping revision 1:5d205f8b35b6 (already grafted to 8:6b9e5368ca4e)
266 skipping revision 1:5d205f8b35b6 (already grafted to 8:6b9e5368ca4e)
267 skipping revision 5:97f8bfe72746 (already grafted to 9:1905859650ec)
267 skipping revision 5:97f8bfe72746 (already grafted to 9:1905859650ec)
268 grafting 4:9c233e8e184d "4"
268 grafting 4:9c233e8e184d "4"
269 merging e
269 merging e
270 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
270 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
271 abort: unresolved conflicts, can't continue
271 abort: unresolved conflicts, can't continue
272 (use 'hg resolve' and 'hg graft --continue')
272 (use 'hg resolve' and 'hg graft --continue')
273 [255]
273 [255]
274
274
275 Continue without resolve should fail:
275 Continue without resolve should fail:
276
276
277 $ hg graft -c
277 $ hg graft -c
278 grafting 4:9c233e8e184d "4"
278 grafting 4:9c233e8e184d "4"
279 abort: unresolved merge conflicts (see 'hg help resolve')
279 abort: unresolved merge conflicts (see 'hg help resolve')
280 [255]
280 [255]
281
281
282 Fix up:
282 Fix up:
283
283
284 $ echo b > e
284 $ echo b > e
285 $ hg resolve -m e
285 $ hg resolve -m e
286 (no more unresolved files)
286 (no more unresolved files)
287 continue: hg graft --continue
287 continue: hg graft --continue
288
288
289 Continue with a revision should fail:
289 Continue with a revision should fail:
290
290
291 $ hg graft -c 6
291 $ hg graft -c 6
292 abort: can't specify --continue and revisions
292 abort: can't specify --continue and revisions
293 [255]
293 [255]
294
294
295 $ hg graft -c -r 6
295 $ hg graft -c -r 6
296 abort: can't specify --continue and revisions
296 abort: can't specify --continue and revisions
297 [255]
297 [255]
298
298
299 Continue for real, clobber usernames
299 Continue for real, clobber usernames
300
300
301 $ hg graft -c -U
301 $ hg graft -c -U
302 grafting 4:9c233e8e184d "4"
302 grafting 4:9c233e8e184d "4"
303 grafting 3:4c60f11aa304 "3"
303 grafting 3:4c60f11aa304 "3"
304
304
305 Compare with original:
305 Compare with original:
306
306
307 $ hg diff -r 6
307 $ hg diff -r 6
308 $ hg status --rev 0:. -C
308 $ hg status --rev 0:. -C
309 M d
309 M d
310 M e
310 M e
311 A b
311 A b
312 a
312 a
313 A c
313 A c
314 a
314 a
315 R a
315 R a
316
316
317 View graph:
317 View graph:
318
318
319 $ hg log -G --template '{author}@{rev}.{phase}: {desc}\n'
319 $ hg log -G --template '{author}@{rev}.{phase}: {desc}\n'
320 @ test@11.draft: 3
320 @ test@11.draft: 3
321 |
321 |
322 o test@10.draft: 4
322 o test@10.draft: 4
323 |
323 |
324 o test@9.draft: 5
324 o test@9.draft: 5
325 |
325 |
326 o bar@8.draft: 1
326 o bar@8.draft: 1
327 |
327 |
328 o foo@7.draft: 2
328 o foo@7.draft: 2
329 |
329 |
330 | o test@6.secret: 6
330 | o test@6.secret: 6
331 | |\
331 | |\
332 | | o test@5.draft: 5
332 | | o test@5.draft: 5
333 | | |
333 | | |
334 | o | test@4.draft: 4
334 | o | test@4.draft: 4
335 | |/
335 | |/
336 | o baz@3.public: 3
336 | o baz@3.public: 3
337 | |
337 | |
338 | o test@2.public: 2
338 | o test@2.public: 2
339 | |
339 | |
340 | o bar@1.public: 1
340 | o bar@1.public: 1
341 |/
341 |/
342 o test@0.public: 0
342 o test@0.public: 0
343
343
344 Graft again onto another branch should preserve the original source
344 Graft again onto another branch should preserve the original source
345 $ hg up -q 0
345 $ hg up -q 0
346 $ echo 'g'>g
346 $ echo 'g'>g
347 $ hg add g
347 $ hg add g
348 $ hg ci -m 7
348 $ hg ci -m 7
349 created new head
349 created new head
350 $ hg graft 7
350 $ hg graft 7
351 grafting 7:ef0ef43d49e7 "2"
351 grafting 7:ef0ef43d49e7 "2"
352
352
353 $ hg log -r 7 --template '{rev}:{node}\n'
353 $ hg log -r 7 --template '{rev}:{node}\n'
354 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82
354 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82
355 $ hg log -r 2 --template '{rev}:{node}\n'
355 $ hg log -r 2 --template '{rev}:{node}\n'
356 2:5c095ad7e90f871700f02dd1fa5012cb4498a2d4
356 2:5c095ad7e90f871700f02dd1fa5012cb4498a2d4
357
357
358 $ hg log --debug -r tip
358 $ hg log --debug -r tip
359 changeset: 13:7a4785234d87ec1aa420ed6b11afe40fa73e12a9
359 changeset: 13:7a4785234d87ec1aa420ed6b11afe40fa73e12a9
360 tag: tip
360 tag: tip
361 phase: draft
361 phase: draft
362 parent: 12:b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
362 parent: 12:b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
363 parent: -1:0000000000000000000000000000000000000000
363 parent: -1:0000000000000000000000000000000000000000
364 manifest: 13:dc313617b8c32457c0d589e0dbbedfe71f3cd637
364 manifest: 13:dc313617b8c32457c0d589e0dbbedfe71f3cd637
365 user: foo
365 user: foo
366 date: Thu Jan 01 00:00:00 1970 +0000
366 date: Thu Jan 01 00:00:00 1970 +0000
367 files+: b
367 files+: b
368 files-: a
368 files-: a
369 extra: branch=default
369 extra: branch=default
370 extra: intermediate-source=ef0ef43d49e79e81ddafdc7997401ba0041efc82
370 extra: intermediate-source=ef0ef43d49e79e81ddafdc7997401ba0041efc82
371 extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4
371 extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4
372 description:
372 description:
373 2
373 2
374
374
375
375
376 Disallow grafting an already grafted cset onto its original branch
376 Disallow grafting an already grafted cset onto its original branch
377 $ hg up -q 6
377 $ hg up -q 6
378 $ hg graft 7
378 $ hg graft 7
379 skipping already grafted revision 7:ef0ef43d49e7 (was grafted from 2:5c095ad7e90f)
379 skipping already grafted revision 7:ef0ef43d49e7 (was grafted from 2:5c095ad7e90f)
380 [255]
380 [255]
381
381
382 $ hg pdiff --config extensions.extdiff= --patch -r 2 -r 13
382 $ hg pdiff --config extensions.extdiff= --patch -r 2 -r 13
383 --- */hg-5c095ad7e90f.patch * (glob)
383 --- */hg-5c095ad7e90f.patch * (glob)
384 +++ */hg-7a4785234d87.patch * (glob)
384 +++ */hg-7a4785234d87.patch * (glob)
385 @@ -1,18 +1,18 @@
385 @@ -1,18 +1,18 @@
386 # HG changeset patch
386 # HG changeset patch
387 -# User test
387 -# User test
388 +# User foo
388 +# User foo
389 # Date 0 0
389 # Date 0 0
390 # Thu Jan 01 00:00:00 1970 +0000
390 # Thu Jan 01 00:00:00 1970 +0000
391 -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4
391 -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4
392 -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04
392 -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04
393 +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9
393 +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9
394 +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
394 +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
395 2
395 2
396
396
397 -diff -r 5d205f8b35b6 -r 5c095ad7e90f a
397 -diff -r 5d205f8b35b6 -r 5c095ad7e90f a
398 +diff -r b592ea63bb0c -r 7a4785234d87 a
398 +diff -r b592ea63bb0c -r 7a4785234d87 a
399 --- a/a Thu Jan 01 00:00:00 1970 +0000
399 --- a/a Thu Jan 01 00:00:00 1970 +0000
400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
401 @@ -1,1 +0,0 @@
401 @@ -1,1 +0,0 @@
402 --b
402 --b
403 -diff -r 5d205f8b35b6 -r 5c095ad7e90f b
403 -diff -r 5d205f8b35b6 -r 5c095ad7e90f b
404 +-a
404 +-a
405 +diff -r b592ea63bb0c -r 7a4785234d87 b
405 +diff -r b592ea63bb0c -r 7a4785234d87 b
406 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
406 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
407 +++ b/b Thu Jan 01 00:00:00 1970 +0000
407 +++ b/b Thu Jan 01 00:00:00 1970 +0000
408 @@ -0,0 +1,1 @@
408 @@ -0,0 +1,1 @@
409 -+b
409 -+b
410 ++a
410 ++a
411 [1]
411 [1]
412
412
413 $ hg pdiff --config extensions.extdiff= --patch -r 2 -r 13 -X .
413 $ hg pdiff --config extensions.extdiff= --patch -r 2 -r 13 -X .
414 --- */hg-5c095ad7e90f.patch * (glob)
414 --- */hg-5c095ad7e90f.patch * (glob)
415 +++ */hg-7a4785234d87.patch * (glob)
415 +++ */hg-7a4785234d87.patch * (glob)
416 @@ -1,8 +1,8 @@
416 @@ -1,8 +1,8 @@
417 # HG changeset patch
417 # HG changeset patch
418 -# User test
418 -# User test
419 +# User foo
419 +# User foo
420 # Date 0 0
420 # Date 0 0
421 # Thu Jan 01 00:00:00 1970 +0000
421 # Thu Jan 01 00:00:00 1970 +0000
422 -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4
422 -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4
423 -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04
423 -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04
424 +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9
424 +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9
425 +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
425 +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
426 2
426 2
427
427
428 [1]
428 [1]
429
429
430 Disallow grafting already grafted csets with the same origin onto each other
430 Disallow grafting already grafted csets with the same origin onto each other
431 $ hg up -q 13
431 $ hg up -q 13
432 $ hg graft 2
432 $ hg graft 2
433 skipping revision 2:5c095ad7e90f (already grafted to 13:7a4785234d87)
433 skipping revision 2:5c095ad7e90f (already grafted to 13:7a4785234d87)
434 [255]
434 [255]
435 $ hg graft 7
435 $ hg graft 7
436 skipping already grafted revision 7:ef0ef43d49e7 (13:7a4785234d87 also has origin 2:5c095ad7e90f)
436 skipping already grafted revision 7:ef0ef43d49e7 (13:7a4785234d87 also has origin 2:5c095ad7e90f)
437 [255]
437 [255]
438
438
439 $ hg up -q 7
439 $ hg up -q 7
440 $ hg graft 2
440 $ hg graft 2
441 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
441 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
442 [255]
442 [255]
443 $ hg graft tip
443 $ hg graft tip
444 skipping already grafted revision 13:7a4785234d87 (7:ef0ef43d49e7 also has origin 2:5c095ad7e90f)
444 skipping already grafted revision 13:7a4785234d87 (7:ef0ef43d49e7 also has origin 2:5c095ad7e90f)
445 [255]
445 [255]
446
446
447 Graft with --log
447 Graft with --log
448
448
449 $ hg up -Cq 1
449 $ hg up -Cq 1
450 $ hg graft 3 --log -u foo
450 $ hg graft 3 --log -u foo
451 grafting 3:4c60f11aa304 "3"
451 grafting 3:4c60f11aa304 "3"
452 warning: can't find ancestor for 'c' copied from 'b'!
452 warning: can't find ancestor for 'c' copied from 'b'!
453 $ hg log --template '{rev}:{node|short} {parents} {desc}\n' -r tip
453 $ hg log --template '{rev}:{node|short} {parents} {desc}\n' -r tip
454 14:0c921c65ef1e 1:5d205f8b35b6 3
454 14:0c921c65ef1e 1:5d205f8b35b6 3
455 (grafted from 4c60f11aa304a54ae1c199feb94e7fc771e51ed8)
455 (grafted from 4c60f11aa304a54ae1c199feb94e7fc771e51ed8)
456
456
457 Resolve conflicted graft
457 Resolve conflicted graft
458 $ hg up -q 0
458 $ hg up -q 0
459 $ echo b > a
459 $ echo b > a
460 $ hg ci -m 8
460 $ hg ci -m 8
461 created new head
461 created new head
462 $ echo c > a
462 $ echo c > a
463 $ hg ci -m 9
463 $ hg ci -m 9
464 $ hg graft 1 --tool internal:fail
464 $ hg graft 1 --tool internal:fail
465 grafting 1:5d205f8b35b6 "1"
465 grafting 1:5d205f8b35b6 "1"
466 abort: unresolved conflicts, can't continue
466 abort: unresolved conflicts, can't continue
467 (use 'hg resolve' and 'hg graft --continue')
467 (use 'hg resolve' and 'hg graft --continue')
468 [255]
468 [255]
469 $ hg resolve --all
469 $ hg resolve --all
470 merging a
470 merging a
471 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
471 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
472 [1]
472 [1]
473 $ cat a
473 $ cat a
474 <<<<<<< local: aaa4406d4f0a - test: 9
474 <<<<<<< local: aaa4406d4f0a - test: 9
475 c
475 c
476 =======
476 =======
477 b
477 b
478 >>>>>>> graft: 5d205f8b35b6 - bar: 1
478 >>>>>>> graft: 5d205f8b35b6 - bar: 1
479 $ echo b > a
479 $ echo b > a
480 $ hg resolve -m a
480 $ hg resolve -m a
481 (no more unresolved files)
481 (no more unresolved files)
482 continue: hg graft --continue
482 continue: hg graft --continue
483 $ hg graft -c
483 $ hg graft -c
484 grafting 1:5d205f8b35b6 "1"
484 grafting 1:5d205f8b35b6 "1"
485 $ hg export tip --git
485 $ hg export tip --git
486 # HG changeset patch
486 # HG changeset patch
487 # User bar
487 # User bar
488 # Date 0 0
488 # Date 0 0
489 # Thu Jan 01 00:00:00 1970 +0000
489 # Thu Jan 01 00:00:00 1970 +0000
490 # Node ID f67661df0c4804d301f064f332b57e7d5ddaf2be
490 # Node ID f67661df0c4804d301f064f332b57e7d5ddaf2be
491 # Parent aaa4406d4f0ae9befd6e58c82ec63706460cbca6
491 # Parent aaa4406d4f0ae9befd6e58c82ec63706460cbca6
492 1
492 1
493
493
494 diff --git a/a b/a
494 diff --git a/a b/a
495 --- a/a
495 --- a/a
496 +++ b/a
496 +++ b/a
497 @@ -1,1 +1,1 @@
497 @@ -1,1 +1,1 @@
498 -c
498 -c
499 +b
499 +b
500
500
501 Resolve conflicted graft with rename
501 Resolve conflicted graft with rename
502 $ echo c > a
502 $ echo c > a
503 $ hg ci -m 10
503 $ hg ci -m 10
504 $ hg graft 2 --tool internal:fail
504 $ hg graft 2 --tool internal:fail
505 grafting 2:5c095ad7e90f "2"
505 grafting 2:5c095ad7e90f "2"
506 abort: unresolved conflicts, can't continue
506 abort: unresolved conflicts, can't continue
507 (use 'hg resolve' and 'hg graft --continue')
507 (use 'hg resolve' and 'hg graft --continue')
508 [255]
508 [255]
509 $ hg resolve --all
509 $ hg resolve --all
510 merging a and b to b
510 merging a and b to b
511 (no more unresolved files)
511 (no more unresolved files)
512 continue: hg graft --continue
512 continue: hg graft --continue
513 $ hg graft -c
513 $ hg graft -c
514 grafting 2:5c095ad7e90f "2"
514 grafting 2:5c095ad7e90f "2"
515 $ hg export tip --git
515 $ hg export tip --git
516 # HG changeset patch
516 # HG changeset patch
517 # User test
517 # User test
518 # Date 0 0
518 # Date 0 0
519 # Thu Jan 01 00:00:00 1970 +0000
519 # Thu Jan 01 00:00:00 1970 +0000
520 # Node ID 9627f653b421c61fc1ea4c4e366745070fa3d2bc
520 # Node ID 9627f653b421c61fc1ea4c4e366745070fa3d2bc
521 # Parent ee295f490a40b97f3d18dd4c4f1c8936c233b612
521 # Parent ee295f490a40b97f3d18dd4c4f1c8936c233b612
522 2
522 2
523
523
524 diff --git a/a b/b
524 diff --git a/a b/b
525 rename from a
525 rename from a
526 rename to b
526 rename to b
527
527
528 Test simple origin(), with and without args
528 Test simple origin(), with and without args
529 $ hg log -r 'origin()'
529 $ hg log -r 'origin()'
530 changeset: 1:5d205f8b35b6
530 changeset: 1:5d205f8b35b6
531 user: bar
531 user: bar
532 date: Thu Jan 01 00:00:00 1970 +0000
532 date: Thu Jan 01 00:00:00 1970 +0000
533 summary: 1
533 summary: 1
534
534
535 changeset: 2:5c095ad7e90f
535 changeset: 2:5c095ad7e90f
536 user: test
536 user: test
537 date: Thu Jan 01 00:00:00 1970 +0000
537 date: Thu Jan 01 00:00:00 1970 +0000
538 summary: 2
538 summary: 2
539
539
540 changeset: 3:4c60f11aa304
540 changeset: 3:4c60f11aa304
541 user: baz
541 user: baz
542 date: Thu Jan 01 00:00:00 1970 +0000
542 date: Thu Jan 01 00:00:00 1970 +0000
543 summary: 3
543 summary: 3
544
544
545 changeset: 4:9c233e8e184d
545 changeset: 4:9c233e8e184d
546 user: test
546 user: test
547 date: Thu Jan 01 00:00:00 1970 +0000
547 date: Thu Jan 01 00:00:00 1970 +0000
548 summary: 4
548 summary: 4
549
549
550 changeset: 5:97f8bfe72746
550 changeset: 5:97f8bfe72746
551 branch: stable
551 branch: stable
552 parent: 3:4c60f11aa304
552 parent: 3:4c60f11aa304
553 user: test
553 user: test
554 date: Thu Jan 01 00:00:00 1970 +0000
554 date: Thu Jan 01 00:00:00 1970 +0000
555 summary: 5
555 summary: 5
556
556
557 $ hg log -r 'origin(7)'
557 $ hg log -r 'origin(7)'
558 changeset: 2:5c095ad7e90f
558 changeset: 2:5c095ad7e90f
559 user: test
559 user: test
560 date: Thu Jan 01 00:00:00 1970 +0000
560 date: Thu Jan 01 00:00:00 1970 +0000
561 summary: 2
561 summary: 2
562
562
563 Now transplant a graft to test following through copies
563 Now transplant a graft to test following through copies
564 $ hg up -q 0
564 $ hg up -q 0
565 $ hg branch -q dev
565 $ hg branch -q dev
566 $ hg ci -qm "dev branch"
566 $ hg ci -qm "dev branch"
567 $ hg --config extensions.transplant= transplant -q 7
567 $ hg --config extensions.transplant= transplant -q 7
568 $ hg log -r 'origin(.)'
568 $ hg log -r 'origin(.)'
569 changeset: 2:5c095ad7e90f
569 changeset: 2:5c095ad7e90f
570 user: test
570 user: test
571 date: Thu Jan 01 00:00:00 1970 +0000
571 date: Thu Jan 01 00:00:00 1970 +0000
572 summary: 2
572 summary: 2
573
573
574 Test that the graft and transplant markers in extra are converted, allowing
574 Test that the graft and transplant markers in extra are converted, allowing
575 origin() to still work. Note that these recheck the immediately preceeding two
575 origin() to still work. Note that these recheck the immediately preceeding two
576 tests.
576 tests.
577 $ hg --quiet --config extensions.convert= --config convert.hg.saverev=True convert . ../converted
577 $ hg --quiet --config extensions.convert= --config convert.hg.saverev=True convert . ../converted
578
578
579 The graft case
579 The graft case
580 $ hg -R ../converted log -r 7 --template "{rev}: {node}\n{join(extras, '\n')}\n"
580 $ hg -R ../converted log -r 7 --template "{rev}: {node}\n{join(extras, '\n')}\n"
581 7: 7ae846e9111fc8f57745634250c7b9ac0a60689b
581 7: 7ae846e9111fc8f57745634250c7b9ac0a60689b
582 branch=default
582 branch=default
583 convert_revision=ef0ef43d49e79e81ddafdc7997401ba0041efc82
583 convert_revision=ef0ef43d49e79e81ddafdc7997401ba0041efc82
584 source=e0213322b2c1a5d5d236c74e79666441bee67a7d
584 source=e0213322b2c1a5d5d236c74e79666441bee67a7d
585 $ hg -R ../converted log -r 'origin(7)'
585 $ hg -R ../converted log -r 'origin(7)'
586 changeset: 2:e0213322b2c1
586 changeset: 2:e0213322b2c1
587 user: test
587 user: test
588 date: Thu Jan 01 00:00:00 1970 +0000
588 date: Thu Jan 01 00:00:00 1970 +0000
589 summary: 2
589 summary: 2
590
590
591 Test that template correctly expands more than one 'extra' (issue4362), and that
591 Test that template correctly expands more than one 'extra' (issue4362), and that
592 'intermediate-source' is converted.
592 'intermediate-source' is converted.
593 $ hg -R ../converted log -r 13 --template "{extras % ' Extra: {extra}\n'}"
593 $ hg -R ../converted log -r 13 --template "{extras % ' Extra: {extra}\n'}"
594 Extra: branch=default
594 Extra: branch=default
595 Extra: convert_revision=7a4785234d87ec1aa420ed6b11afe40fa73e12a9
595 Extra: convert_revision=7a4785234d87ec1aa420ed6b11afe40fa73e12a9
596 Extra: intermediate-source=7ae846e9111fc8f57745634250c7b9ac0a60689b
596 Extra: intermediate-source=7ae846e9111fc8f57745634250c7b9ac0a60689b
597 Extra: source=e0213322b2c1a5d5d236c74e79666441bee67a7d
597 Extra: source=e0213322b2c1a5d5d236c74e79666441bee67a7d
598
598
599 The transplant case
599 The transplant case
600 $ hg -R ../converted log -r tip --template "{rev}: {node}\n{join(extras, '\n')}\n"
600 $ hg -R ../converted log -r tip --template "{rev}: {node}\n{join(extras, '\n')}\n"
601 21: fbb6c5cc81002f2b4b49c9d731404688bcae5ade
601 21: fbb6c5cc81002f2b4b49c9d731404688bcae5ade
602 branch=dev
602 branch=dev
603 convert_revision=7e61b508e709a11d28194a5359bc3532d910af21
603 convert_revision=7e61b508e709a11d28194a5359bc3532d910af21
604 transplant_source=z\xe8F\xe9\x11\x1f\xc8\xf5wEcBP\xc7\xb9\xac\n`h\x9b
604 transplant_source=z\xe8F\xe9\x11\x1f\xc8\xf5wEcBP\xc7\xb9\xac\n`h\x9b
605 $ hg -R ../converted log -r 'origin(tip)'
605 $ hg -R ../converted log -r 'origin(tip)'
606 changeset: 2:e0213322b2c1
606 changeset: 2:e0213322b2c1
607 user: test
607 user: test
608 date: Thu Jan 01 00:00:00 1970 +0000
608 date: Thu Jan 01 00:00:00 1970 +0000
609 summary: 2
609 summary: 2
610
610
611
611
612 Test simple destination
612 Test simple destination
613 $ hg log -r 'destination()'
613 $ hg log -r 'destination()'
614 changeset: 7:ef0ef43d49e7
614 changeset: 7:ef0ef43d49e7
615 parent: 0:68795b066622
615 parent: 0:68795b066622
616 user: foo
616 user: foo
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 changeset: 8:6b9e5368ca4e
620 changeset: 8:6b9e5368ca4e
621 user: bar
621 user: bar
622 date: Thu Jan 01 00:00:00 1970 +0000
622 date: Thu Jan 01 00:00:00 1970 +0000
623 summary: 1
623 summary: 1
624
624
625 changeset: 9:1905859650ec
625 changeset: 9:1905859650ec
626 user: test
626 user: test
627 date: Thu Jan 01 00:00:00 1970 +0000
627 date: Thu Jan 01 00:00:00 1970 +0000
628 summary: 5
628 summary: 5
629
629
630 changeset: 10:52dc0b4c6907
630 changeset: 10:52dc0b4c6907
631 user: test
631 user: test
632 date: Thu Jan 01 00:00:00 1970 +0000
632 date: Thu Jan 01 00:00:00 1970 +0000
633 summary: 4
633 summary: 4
634
634
635 changeset: 11:882b35362a6b
635 changeset: 11:882b35362a6b
636 user: test
636 user: test
637 date: Thu Jan 01 00:00:00 1970 +0000
637 date: Thu Jan 01 00:00:00 1970 +0000
638 summary: 3
638 summary: 3
639
639
640 changeset: 13:7a4785234d87
640 changeset: 13:7a4785234d87
641 user: foo
641 user: foo
642 date: Thu Jan 01 00:00:00 1970 +0000
642 date: Thu Jan 01 00:00:00 1970 +0000
643 summary: 2
643 summary: 2
644
644
645 changeset: 14:0c921c65ef1e
645 changeset: 14:0c921c65ef1e
646 parent: 1:5d205f8b35b6
646 parent: 1:5d205f8b35b6
647 user: foo
647 user: foo
648 date: Thu Jan 01 00:00:00 1970 +0000
648 date: Thu Jan 01 00:00:00 1970 +0000
649 summary: 3
649 summary: 3
650
650
651 changeset: 17:f67661df0c48
651 changeset: 17:f67661df0c48
652 user: bar
652 user: bar
653 date: Thu Jan 01 00:00:00 1970 +0000
653 date: Thu Jan 01 00:00:00 1970 +0000
654 summary: 1
654 summary: 1
655
655
656 changeset: 19:9627f653b421
656 changeset: 19:9627f653b421
657 user: test
657 user: test
658 date: Thu Jan 01 00:00:00 1970 +0000
658 date: Thu Jan 01 00:00:00 1970 +0000
659 summary: 2
659 summary: 2
660
660
661 changeset: 21:7e61b508e709
661 changeset: 21:7e61b508e709
662 branch: dev
662 branch: dev
663 tag: tip
663 tag: tip
664 user: foo
664 user: foo
665 date: Thu Jan 01 00:00:00 1970 +0000
665 date: Thu Jan 01 00:00:00 1970 +0000
666 summary: 2
666 summary: 2
667
667
668 $ hg log -r 'destination(2)'
668 $ hg log -r 'destination(2)'
669 changeset: 7:ef0ef43d49e7
669 changeset: 7:ef0ef43d49e7
670 parent: 0:68795b066622
670 parent: 0:68795b066622
671 user: foo
671 user: foo
672 date: Thu Jan 01 00:00:00 1970 +0000
672 date: Thu Jan 01 00:00:00 1970 +0000
673 summary: 2
673 summary: 2
674
674
675 changeset: 13:7a4785234d87
675 changeset: 13:7a4785234d87
676 user: foo
676 user: foo
677 date: Thu Jan 01 00:00:00 1970 +0000
677 date: Thu Jan 01 00:00:00 1970 +0000
678 summary: 2
678 summary: 2
679
679
680 changeset: 19:9627f653b421
680 changeset: 19:9627f653b421
681 user: test
681 user: test
682 date: Thu Jan 01 00:00:00 1970 +0000
682 date: Thu Jan 01 00:00:00 1970 +0000
683 summary: 2
683 summary: 2
684
684
685 changeset: 21:7e61b508e709
685 changeset: 21:7e61b508e709
686 branch: dev
686 branch: dev
687 tag: tip
687 tag: tip
688 user: foo
688 user: foo
689 date: Thu Jan 01 00:00:00 1970 +0000
689 date: Thu Jan 01 00:00:00 1970 +0000
690 summary: 2
690 summary: 2
691
691
692 Transplants of grafts can find a destination...
692 Transplants of grafts can find a destination...
693 $ hg log -r 'destination(7)'
693 $ hg log -r 'destination(7)'
694 changeset: 21:7e61b508e709
694 changeset: 21:7e61b508e709
695 branch: dev
695 branch: dev
696 tag: tip
696 tag: tip
697 user: foo
697 user: foo
698 date: Thu Jan 01 00:00:00 1970 +0000
698 date: Thu Jan 01 00:00:00 1970 +0000
699 summary: 2
699 summary: 2
700
700
701 ... grafts of grafts unfortunately can't
701 ... grafts of grafts unfortunately can't
702 $ hg graft -q 13
702 $ hg graft -q 13
703 warning: can't find ancestor for 'b' copied from 'a'!
703 warning: can't find ancestor for 'b' copied from 'a'!
704 $ hg log -r 'destination(13)'
704 $ hg log -r 'destination(13)'
705 All copies of a cset
705 All copies of a cset
706 $ hg log -r 'origin(13) or destination(origin(13))'
706 $ hg log -r 'origin(13) or destination(origin(13))'
707 changeset: 2:5c095ad7e90f
707 changeset: 2:5c095ad7e90f
708 user: test
708 user: test
709 date: Thu Jan 01 00:00:00 1970 +0000
709 date: Thu Jan 01 00:00:00 1970 +0000
710 summary: 2
710 summary: 2
711
711
712 changeset: 7:ef0ef43d49e7
712 changeset: 7:ef0ef43d49e7
713 parent: 0:68795b066622
713 parent: 0:68795b066622
714 user: foo
714 user: foo
715 date: Thu Jan 01 00:00:00 1970 +0000
715 date: Thu Jan 01 00:00:00 1970 +0000
716 summary: 2
716 summary: 2
717
717
718 changeset: 13:7a4785234d87
718 changeset: 13:7a4785234d87
719 user: foo
719 user: foo
720 date: Thu Jan 01 00:00:00 1970 +0000
720 date: Thu Jan 01 00:00:00 1970 +0000
721 summary: 2
721 summary: 2
722
722
723 changeset: 19:9627f653b421
723 changeset: 19:9627f653b421
724 user: test
724 user: test
725 date: Thu Jan 01 00:00:00 1970 +0000
725 date: Thu Jan 01 00:00:00 1970 +0000
726 summary: 2
726 summary: 2
727
727
728 changeset: 21:7e61b508e709
728 changeset: 21:7e61b508e709
729 branch: dev
729 branch: dev
730 user: foo
730 user: foo
731 date: Thu Jan 01 00:00:00 1970 +0000
731 date: Thu Jan 01 00:00:00 1970 +0000
732 summary: 2
732 summary: 2
733
733
734 changeset: 22:d1cb6591fa4b
734 changeset: 22:d1cb6591fa4b
735 branch: dev
735 branch: dev
736 tag: tip
736 tag: tip
737 user: foo
737 user: foo
738 date: Thu Jan 01 00:00:00 1970 +0000
738 date: Thu Jan 01 00:00:00 1970 +0000
739 summary: 2
739 summary: 2
740
740
741
741
742 graft works on complex revset
742 graft works on complex revset
743
743
744 $ hg graft 'origin(13) or destination(origin(13))'
744 $ hg graft 'origin(13) or destination(origin(13))'
745 skipping ancestor revision 21:7e61b508e709
745 skipping ancestor revision 21:7e61b508e709
746 skipping ancestor revision 22:d1cb6591fa4b
746 skipping ancestor revision 22:d1cb6591fa4b
747 skipping revision 2:5c095ad7e90f (already grafted to 22:d1cb6591fa4b)
747 skipping revision 2:5c095ad7e90f (already grafted to 22:d1cb6591fa4b)
748 grafting 7:ef0ef43d49e7 "2"
748 grafting 7:ef0ef43d49e7 "2"
749 warning: can't find ancestor for 'b' copied from 'a'!
749 warning: can't find ancestor for 'b' copied from 'a'!
750 grafting 13:7a4785234d87 "2"
750 grafting 13:7a4785234d87 "2"
751 warning: can't find ancestor for 'b' copied from 'a'!
751 warning: can't find ancestor for 'b' copied from 'a'!
752 grafting 19:9627f653b421 "2"
752 grafting 19:9627f653b421 "2"
753 merging b
753 merging b
754 warning: can't find ancestor for 'b' copied from 'a'!
754 warning: can't find ancestor for 'b' copied from 'a'!
755
755
756 graft with --force (still doesn't graft merges)
756 graft with --force (still doesn't graft merges)
757
757
758 $ hg graft 19 0 6
758 $ hg graft 19 0 6
759 skipping ungraftable merge revision 6
759 skipping ungraftable merge revision 6
760 skipping ancestor revision 0:68795b066622
760 skipping ancestor revision 0:68795b066622
761 skipping already grafted revision 19:9627f653b421 (22:d1cb6591fa4b also has origin 2:5c095ad7e90f)
761 skipping already grafted revision 19:9627f653b421 (22:d1cb6591fa4b also has origin 2:5c095ad7e90f)
762 [255]
762 [255]
763 $ hg graft 19 0 6 --force
763 $ hg graft 19 0 6 --force
764 skipping ungraftable merge revision 6
764 skipping ungraftable merge revision 6
765 grafting 19:9627f653b421 "2"
765 grafting 19:9627f653b421 "2"
766 merging b
766 merging b
767 warning: can't find ancestor for 'b' copied from 'a'!
767 warning: can't find ancestor for 'b' copied from 'a'!
768 grafting 0:68795b066622 "0"
768 grafting 0:68795b066622 "0"
769
769
770 graft --force after backout
770 graft --force after backout
771
771
772 $ echo abc > a
772 $ echo abc > a
773 $ hg ci -m 28
773 $ hg ci -m 28
774 $ hg backout 28
774 $ hg backout 28
775 reverting a
775 reverting a
776 changeset 29:53177ba928f6 backs out changeset 28:50a516bb8b57
776 changeset 29:53177ba928f6 backs out changeset 28:50a516bb8b57
777 $ hg graft 28
777 $ hg graft 28
778 skipping ancestor revision 28:50a516bb8b57
778 skipping ancestor revision 28:50a516bb8b57
779 [255]
779 [255]
780 $ hg graft 28 --force
780 $ hg graft 28 --force
781 grafting 28:50a516bb8b57 "28"
781 grafting 28:50a516bb8b57 "28"
782 merging a
782 merging a
783 $ cat a
783 $ cat a
784 abc
784 abc
785
785
786 graft --continue after --force
786 graft --continue after --force
787
787
788 $ echo def > a
788 $ echo def > a
789 $ hg ci -m 31
789 $ hg ci -m 31
790 $ hg graft 28 --force --tool internal:fail
790 $ hg graft 28 --force --tool internal:fail
791 grafting 28:50a516bb8b57 "28"
791 grafting 28:50a516bb8b57 "28"
792 abort: unresolved conflicts, can't continue
792 abort: unresolved conflicts, can't continue
793 (use 'hg resolve' and 'hg graft --continue')
793 (use 'hg resolve' and 'hg graft --continue')
794 [255]
794 [255]
795 $ hg resolve --all
795 $ hg resolve --all
796 merging a
796 merging a
797 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
797 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
798 [1]
798 [1]
799 $ echo abc > a
799 $ echo abc > a
800 $ hg resolve -m a
800 $ hg resolve -m a
801 (no more unresolved files)
801 (no more unresolved files)
802 continue: hg graft --continue
802 continue: hg graft --continue
803 $ hg graft -c
803 $ hg graft -c
804 grafting 28:50a516bb8b57 "28"
804 grafting 28:50a516bb8b57 "28"
805 $ cat a
805 $ cat a
806 abc
806 abc
807
807
808 Continue testing same origin policy, using revision numbers from test above
808 Continue testing same origin policy, using revision numbers from test above
809 but do some destructive editing of the repo:
809 but do some destructive editing of the repo:
810
810
811 $ hg up -qC 7
811 $ hg up -qC 7
812 $ hg tag -l -r 13 tmp
812 $ hg tag -l -r 13 tmp
813 $ hg --config extensions.strip= strip 2
813 $ hg --config extensions.strip= strip 2
814 saved backup bundle to $TESTTMP/a/.hg/strip-backup/5c095ad7e90f-d323a1e4-backup.hg
814 saved backup bundle to $TESTTMP/a/.hg/strip-backup/5c095ad7e90f-d323a1e4-backup.hg
815 $ hg graft tmp
815 $ hg graft tmp
816 skipping already grafted revision 8:7a4785234d87 (2:ef0ef43d49e7 also has unknown origin 5c095ad7e90f)
816 skipping already grafted revision 8:7a4785234d87 (2:ef0ef43d49e7 also has unknown origin 5c095ad7e90f)
817 [255]
817 [255]
818
818
819 Empty graft
819 Empty graft
820
820
821 $ hg up -qr 26
821 $ hg up -qr 26
822 $ hg tag -f something
822 $ hg tag -f something
823 $ hg graft -qr 27
823 $ hg graft -qr 27
824 $ hg graft -f 27
824 $ hg graft -f 27
825 grafting 27:ed6c7e54e319 "28"
825 grafting 27:ed6c7e54e319 "28"
826 note: graft of 27:ed6c7e54e319 created no changes to commit
826 note: graft of 27:ed6c7e54e319 created no changes to commit
827
827
828 $ cd ..
828 $ cd ..
829
829
830 Graft to duplicate a commit
830 Graft to duplicate a commit
831
831
832 $ hg init graftsibling
832 $ hg init graftsibling
833 $ cd graftsibling
833 $ cd graftsibling
834 $ touch a
834 $ touch a
835 $ hg commit -qAm a
835 $ hg commit -qAm a
836 $ touch b
836 $ touch b
837 $ hg commit -qAm b
837 $ hg commit -qAm b
838 $ hg log -G -T '{rev}\n'
838 $ hg log -G -T '{rev}\n'
839 @ 1
839 @ 1
840 |
840 |
841 o 0
841 o 0
842
842
843 $ hg up -q 0
843 $ hg up -q 0
844 $ hg graft -r 1
844 $ hg graft -r 1
845 grafting 1:0e067c57feba "b" (tip)
845 grafting 1:0e067c57feba "b" (tip)
846 $ hg log -G -T '{rev}\n'
846 $ hg log -G -T '{rev}\n'
847 @ 2
847 @ 2
848 |
848 |
849 | o 1
849 | o 1
850 |/
850 |/
851 o 0
851 o 0
852
852
853 Graft to duplicate a commit twice
853 Graft to duplicate a commit twice
854
854
855 $ hg up -q 0
855 $ hg up -q 0
856 $ hg graft -r 2
856 $ hg graft -r 2
857 grafting 2:044ec77f6389 "b" (tip)
857 grafting 2:044ec77f6389 "b" (tip)
858 $ hg log -G -T '{rev}\n'
858 $ hg log -G -T '{rev}\n'
859 @ 3
859 @ 3
860 |
860 |
861 | o 2
861 | o 2
862 |/
862 |/
863 | o 1
863 | o 1
864 |/
864 |/
865 o 0
865 o 0
866
866
867 Graft from behind a move or rename
867 Graft from behind a move or rename
868 ==================================
868 ==================================
869
869
870 NOTE: This is affected by issue5343, and will need updating when it's fixed
870 NOTE: This is affected by issue5343, and will need updating when it's fixed
871
871
872 Possible cases during a regular graft (when ca is between cta and c2):
872 Possible cases during a regular graft (when ca is between cta and c2):
873
873
874 name | c1<-cta | cta<->ca | ca->c2
874 name | c1<-cta | cta<->ca | ca->c2
875 A.0 | | |
875 A.0 | | |
876 A.1 | X | |
876 A.1 | X | |
877 A.2 | | X |
877 A.2 | | X |
878 A.3 | | | X
878 A.3 | | | X
879 A.4 | X | X |
879 A.4 | X | X |
880 A.5 | X | | X
880 A.5 | X | | X
881 A.6 | | X | X
881 A.6 | | X | X
882 A.7 | X | X | X
882 A.7 | X | X | X
883
883
884 A.0 is trivial, and doesn't need copy tracking.
884 A.0 is trivial, and doesn't need copy tracking.
885 For A.1, a forward rename is recorded in the c1 pass, to be followed later.
885 For A.1, a forward rename is recorded in the c1 pass, to be followed later.
886 In A.2, the rename is recorded in the c2 pass and followed backwards.
886 In A.2, the rename is recorded in the c2 pass and followed backwards.
887 A.3 is recorded in the c2 pass as a forward rename to be duplicated on target.
887 A.3 is recorded in the c2 pass as a forward rename to be duplicated on target.
888 In A.4, both passes of checkcopies record incomplete renames, which are
888 In A.4, both passes of checkcopies record incomplete renames, which are
889 then joined in mergecopies to record a rename to be followed.
889 then joined in mergecopies to record a rename to be followed.
890 In A.5 and A.7, the c1 pass records an incomplete rename, while the c2 pass
890 In A.5 and A.7, the c1 pass records an incomplete rename, while the c2 pass
891 records an incomplete divergence. The incomplete rename is then joined to the
891 records an incomplete divergence. The incomplete rename is then joined to the
892 appropriate side of the incomplete divergence, and the result is recorded as a
892 appropriate side of the incomplete divergence, and the result is recorded as a
893 divergence. The code doesn't distinguish at all between these two cases, since
893 divergence. The code doesn't distinguish at all between these two cases, since
894 the end result of them is the same: an incomplete divergence joined with an
894 the end result of them is the same: an incomplete divergence joined with an
895 incomplete rename into a divergence.
895 incomplete rename into a divergence.
896 Finally, A.6 records a divergence entirely in the c2 pass.
896 Finally, A.6 records a divergence entirely in the c2 pass.
897
897
898 A.4 has a degenerate case a<-b<-a->a, where checkcopies isn't needed at all.
898 A.4 has a degenerate case a<-b<-a->a, where checkcopies isn't needed at all.
899 A.5 has a special case a<-b<-b->a, which is treated like a<-b->a in a merge.
899 A.5 has a special case a<-b<-b->a, which is treated like a<-b->a in a merge.
900 A.6 has a special case a<-a<-b->a. Here, checkcopies will find a spurious
900 A.6 has a special case a<-a<-b->a. Here, checkcopies will find a spurious
901 incomplete divergence, which is in fact complete. This is handled later in
901 incomplete divergence, which is in fact complete. This is handled later in
902 mergecopies.
902 mergecopies.
903 A.7 has 4 special cases: a<-b<-a->b (the "ping-pong" case), a<-b<-c->b,
903 A.7 has 4 special cases: a<-b<-a->b (the "ping-pong" case), a<-b<-c->b,
904 a<-b<-a->c and a<-b<-c->a. Of these, only the "ping-pong" case is interesting,
904 a<-b<-a->c and a<-b<-c->a. Of these, only the "ping-pong" case is interesting,
905 the others are fairly trivial (a<-b<-c->b and a<-b<-a->c proceed like the base
905 the others are fairly trivial (a<-b<-c->b and a<-b<-a->c proceed like the base
906 case, a<-b<-c->a is treated the same as a<-b<-b->a).
906 case, a<-b<-c->a is treated the same as a<-b<-b->a).
907
907
908 f5a therefore tests the "ping-pong" rename case, where a file is renamed to the
908 f5a therefore tests the "ping-pong" rename case, where a file is renamed to the
909 same name on both branches, then the rename is backed out on one branch, and
909 same name on both branches, then the rename is backed out on one branch, and
910 the backout is grafted to the other branch. This creates a challenging rename
910 the backout is grafted to the other branch. This creates a challenging rename
911 sequence of a<-b<-a->b in the graft target, topological CA, graft CA and graft
911 sequence of a<-b<-a->b in the graft target, topological CA, graft CA and graft
912 source, respectively. Since rename detection will run on the c1 side for such a
912 source, respectively. Since rename detection will run on the c1 side for such a
913 sequence (as for technical reasons, we split the c1 and c2 sides not at the
913 sequence (as for technical reasons, we split the c1 and c2 sides not at the
914 graft CA, but rather at the topological CA), it will pick up a false rename,
914 graft CA, but rather at the topological CA), it will pick up a false rename,
915 and cause a spurious merge conflict. This false rename is always exactly the
915 and cause a spurious merge conflict. This false rename is always exactly the
916 reverse of the true rename that would be detected on the c2 side, so we can
916 reverse of the true rename that would be detected on the c2 side, so we can
917 correct for it by detecting this condition and reversing as necessary.
917 correct for it by detecting this condition and reversing as necessary.
918
918
919 First, set up the repository with commits to be grafted
919 First, set up the repository with commits to be grafted
920
920
921 $ hg init ../graftmove
921 $ hg init ../graftmove
922 $ cd ../graftmove
922 $ cd ../graftmove
923 $ echo c1a > f1a
923 $ echo c1a > f1a
924 $ echo c2a > f2a
924 $ echo c2a > f2a
925 $ echo c3a > f3a
925 $ echo c3a > f3a
926 $ echo c4a > f4a
926 $ echo c4a > f4a
927 $ echo c5a > f5a
927 $ echo c5a > f5a
928 $ hg ci -qAm A0
928 $ hg ci -qAm A0
929 $ hg mv f1a f1b
929 $ hg mv f1a f1b
930 $ hg mv f3a f3b
930 $ hg mv f3a f3b
931 $ hg mv f5a f5b
931 $ hg mv f5a f5b
932 $ hg ci -qAm B0
932 $ hg ci -qAm B0
933 $ echo c1c > f1b
933 $ echo c1c > f1b
934 $ hg mv f2a f2c
934 $ hg mv f2a f2c
935 $ hg mv f5b f5a
935 $ hg mv f5b f5a
936 $ echo c5c > f5a
936 $ echo c5c > f5a
937 $ hg ci -qAm C0
937 $ hg ci -qAm C0
938 $ hg mv f3b f3d
938 $ hg mv f3b f3d
939 $ echo c4d > f4a
939 $ echo c4d > f4a
940 $ hg ci -qAm D0
940 $ hg ci -qAm D0
941 $ hg log -G
941 $ hg log -G
942 @ changeset: 3:b69f5839d2d9
942 @ changeset: 3:b69f5839d2d9
943 | tag: tip
943 | tag: tip
944 | user: test
944 | user: test
945 | date: Thu Jan 01 00:00:00 1970 +0000
945 | date: Thu Jan 01 00:00:00 1970 +0000
946 | summary: D0
946 | summary: D0
947 |
947 |
948 o changeset: 2:f58c7e2b28fa
948 o changeset: 2:f58c7e2b28fa
949 | user: test
949 | user: test
950 | date: Thu Jan 01 00:00:00 1970 +0000
950 | date: Thu Jan 01 00:00:00 1970 +0000
951 | summary: C0
951 | summary: C0
952 |
952 |
953 o changeset: 1:3d7bba921b5d
953 o changeset: 1:3d7bba921b5d
954 | user: test
954 | user: test
955 | date: Thu Jan 01 00:00:00 1970 +0000
955 | date: Thu Jan 01 00:00:00 1970 +0000
956 | summary: B0
956 | summary: B0
957 |
957 |
958 o changeset: 0:11f7a1b56675
958 o changeset: 0:11f7a1b56675
959 user: test
959 user: test
960 date: Thu Jan 01 00:00:00 1970 +0000
960 date: Thu Jan 01 00:00:00 1970 +0000
961 summary: A0
961 summary: A0
962
962
963
963
964 Test the cases A.2 (f1x), A.3 (f2x) and a special case of A.6 (f5x) where the
964 Test the cases A.2 (f1x), A.3 (f2x) and a special case of A.6 (f5x) where the
965 two renames actually converge to the same name (thus no actual divergence).
965 two renames actually converge to the same name (thus no actual divergence).
966
966
967 $ hg up -q 'desc("A0")'
967 $ hg up -q 'desc("A0")'
968 $ HGEDITOR="echo C1 >" hg graft -r 'desc("C0")' --edit
968 $ HGEDITOR="echo C1 >" hg graft -r 'desc("C0")' --edit
969 grafting 2:f58c7e2b28fa "C0"
969 grafting 2:f58c7e2b28fa "C0"
970 merging f1a and f1b to f1a
970 merging f1a and f1b to f1a
971 merging f5a
971 merging f5a
972 warning: can't find ancestor for 'f5a' copied from 'f5b'!
972 warning: can't find ancestor for 'f5a' copied from 'f5b'!
973 $ hg status --change .
973 $ hg status --change .
974 M f1a
974 M f1a
975 M f5a
975 M f5a
976 A f2c
976 A f2c
977 R f2a
977 R f2a
978 $ hg cat f1a
978 $ hg cat f1a
979 c1c
979 c1c
980 $ hg cat f1b
980 $ hg cat f1b
981 f1b: no such file in rev c9763722f9bd
981 f1b: no such file in rev c9763722f9bd
982 [1]
982 [1]
983
983
984 Test the cases A.0 (f4x) and A.6 (f3x)
984 Test the cases A.0 (f4x) and A.6 (f3x)
985
985
986 $ HGEDITOR="echo D1 >" hg graft -r 'desc("D0")' --edit
986 $ HGEDITOR="echo D1 >" hg graft -r 'desc("D0")' --edit
987 grafting 3:b69f5839d2d9 "D0"
987 grafting 3:b69f5839d2d9 "D0"
988 note: possible conflict - f3b was renamed multiple times to:
988 note: possible conflict - f3b was renamed multiple times to:
989 f3d
989 f3d
990 f3a
990 f3a
991 warning: can't find ancestor for 'f3d' copied from 'f3b'!
991 warning: can't find ancestor for 'f3d' copied from 'f3b'!
992
992
993 Set up the repository for some further tests
993 Set up the repository for some further tests
994
994
995 $ hg up -q "min(desc("A0"))"
995 $ hg up -q "min(desc("A0"))"
996 $ hg mv f1a f1e
996 $ hg mv f1a f1e
997 $ echo c2e > f2a
997 $ echo c2e > f2a
998 $ hg mv f3a f3e
998 $ hg mv f3a f3e
999 $ hg mv f4a f4e
999 $ hg mv f4a f4e
1000 $ hg mv f5a f5b
1000 $ hg mv f5a f5b
1001 $ hg ci -qAm "E0"
1001 $ hg ci -qAm "E0"
1002 $ hg log -G
1002 $ hg log -G
1003 @ changeset: 6:6bd1736cab86
1003 @ changeset: 6:6bd1736cab86
1004 | tag: tip
1004 | tag: tip
1005 | parent: 0:11f7a1b56675
1005 | parent: 0:11f7a1b56675
1006 | user: test
1006 | user: test
1007 | date: Thu Jan 01 00:00:00 1970 +0000
1007 | date: Thu Jan 01 00:00:00 1970 +0000
1008 | summary: E0
1008 | summary: E0
1009 |
1009 |
1010 | o changeset: 5:560daee679da
1010 | o changeset: 5:560daee679da
1011 | | user: test
1011 | | user: test
1012 | | date: Thu Jan 01 00:00:00 1970 +0000
1012 | | date: Thu Jan 01 00:00:00 1970 +0000
1013 | | summary: D1
1013 | | summary: D1
1014 | |
1014 | |
1015 | o changeset: 4:c9763722f9bd
1015 | o changeset: 4:c9763722f9bd
1016 |/ parent: 0:11f7a1b56675
1016 |/ parent: 0:11f7a1b56675
1017 | user: test
1017 | user: test
1018 | date: Thu Jan 01 00:00:00 1970 +0000
1018 | date: Thu Jan 01 00:00:00 1970 +0000
1019 | summary: C1
1019 | summary: C1
1020 |
1020 |
1021 | o changeset: 3:b69f5839d2d9
1021 | o changeset: 3:b69f5839d2d9
1022 | | user: test
1022 | | user: test
1023 | | date: Thu Jan 01 00:00:00 1970 +0000
1023 | | date: Thu Jan 01 00:00:00 1970 +0000
1024 | | summary: D0
1024 | | summary: D0
1025 | |
1025 | |
1026 | o changeset: 2:f58c7e2b28fa
1026 | o changeset: 2:f58c7e2b28fa
1027 | | user: test
1027 | | user: test
1028 | | date: Thu Jan 01 00:00:00 1970 +0000
1028 | | date: Thu Jan 01 00:00:00 1970 +0000
1029 | | summary: C0
1029 | | summary: C0
1030 | |
1030 | |
1031 | o changeset: 1:3d7bba921b5d
1031 | o changeset: 1:3d7bba921b5d
1032 |/ user: test
1032 |/ user: test
1033 | date: Thu Jan 01 00:00:00 1970 +0000
1033 | date: Thu Jan 01 00:00:00 1970 +0000
1034 | summary: B0
1034 | summary: B0
1035 |
1035 |
1036 o changeset: 0:11f7a1b56675
1036 o changeset: 0:11f7a1b56675
1037 user: test
1037 user: test
1038 date: Thu Jan 01 00:00:00 1970 +0000
1038 date: Thu Jan 01 00:00:00 1970 +0000
1039 summary: A0
1039 summary: A0
1040
1040
1041
1041
1042 Test the cases A.4 (f1x), the "ping-pong" special case of A.7 (f5x),
1042 Test the cases A.4 (f1x), the "ping-pong" special case of A.7 (f5x),
1043 and A.3 with a local content change to be preserved (f2x).
1043 and A.3 with a local content change to be preserved (f2x).
1044
1044
1045 $ HGEDITOR="echo C2 >" hg graft -r 'desc("C0")' --edit
1045 $ HGEDITOR="echo C2 >" hg graft -r 'desc("C0")' --edit
1046 grafting 2:f58c7e2b28fa "C0"
1046 grafting 2:f58c7e2b28fa "C0"
1047 merging f1e and f1b to f1e
1047 merging f1e and f1b to f1e
1048 merging f2a and f2c to f2c
1048 merging f2a and f2c to f2c
1049 merging f5b and f5a to f5a
1049 merging f5b and f5a to f5a
1050
1050
1051 Test the cases A.1 (f4x) and A.7 (f3x).
1051 Test the cases A.1 (f4x) and A.7 (f3x).
1052
1052
1053 $ HGEDITOR="echo D2 >" hg graft -r 'desc("D0")' --edit
1053 $ HGEDITOR="echo D2 >" hg graft -r 'desc("D0")' --edit
1054 grafting 3:b69f5839d2d9 "D0"
1054 grafting 3:b69f5839d2d9 "D0"
1055 note: possible conflict - f3b was renamed multiple times to:
1055 note: possible conflict - f3b was renamed multiple times to:
1056 f3e
1056 f3e
1057 f3d
1057 f3d
1058 merging f4e and f4a to f4e
1058 merging f4e and f4a to f4e
1059 warning: can't find ancestor for 'f3d' copied from 'f3b'!
1059 warning: can't find ancestor for 'f3d' copied from 'f3b'!
1060
1060
1061 Check the results of the grafts tested
1061 Check the results of the grafts tested
1062
1062
1063 $ hg log -CGv --patch --git
1063 $ hg log -CGv --patch --git
1064 @ changeset: 8:93ee502e8b0a
1064 @ changeset: 8:93ee502e8b0a
1065 | tag: tip
1065 | tag: tip
1066 | user: test
1066 | user: test
1067 | date: Thu Jan 01 00:00:00 1970 +0000
1067 | date: Thu Jan 01 00:00:00 1970 +0000
1068 | files: f3d f4e
1068 | files: f3d f4e
1069 | description:
1069 | description:
1070 | D2
1070 | D2
1071 |
1071 |
1072 |
1072 |
1073 | diff --git a/f3d b/f3d
1073 | diff --git a/f3d b/f3d
1074 | new file mode 100644
1074 | new file mode 100644
1075 | --- /dev/null
1075 | --- /dev/null
1076 | +++ b/f3d
1076 | +++ b/f3d
1077 | @@ -0,0 +1,1 @@
1077 | @@ -0,0 +1,1 @@
1078 | +c3a
1078 | +c3a
1079 | diff --git a/f4e b/f4e
1079 | diff --git a/f4e b/f4e
1080 | --- a/f4e
1080 | --- a/f4e
1081 | +++ b/f4e
1081 | +++ b/f4e
1082 | @@ -1,1 +1,1 @@
1082 | @@ -1,1 +1,1 @@
1083 | -c4a
1083 | -c4a
1084 | +c4d
1084 | +c4d
1085 |
1085 |
1086 o changeset: 7:539cf145f496
1086 o changeset: 7:539cf145f496
1087 | user: test
1087 | user: test
1088 | date: Thu Jan 01 00:00:00 1970 +0000
1088 | date: Thu Jan 01 00:00:00 1970 +0000
1089 | files: f1e f2a f2c f5a f5b
1089 | files: f1e f2a f2c f5a f5b
1090 | copies: f2c (f2a) f5a (f5b)
1090 | copies: f2c (f2a) f5a (f5b)
1091 | description:
1091 | description:
1092 | C2
1092 | C2
1093 |
1093 |
1094 |
1094 |
1095 | diff --git a/f1e b/f1e
1095 | diff --git a/f1e b/f1e
1096 | --- a/f1e
1096 | --- a/f1e
1097 | +++ b/f1e
1097 | +++ b/f1e
1098 | @@ -1,1 +1,1 @@
1098 | @@ -1,1 +1,1 @@
1099 | -c1a
1099 | -c1a
1100 | +c1c
1100 | +c1c
1101 | diff --git a/f2a b/f2c
1101 | diff --git a/f2a b/f2c
1102 | rename from f2a
1102 | rename from f2a
1103 | rename to f2c
1103 | rename to f2c
1104 | diff --git a/f5b b/f5a
1104 | diff --git a/f5b b/f5a
1105 | rename from f5b
1105 | rename from f5b
1106 | rename to f5a
1106 | rename to f5a
1107 | --- a/f5b
1107 | --- a/f5b
1108 | +++ b/f5a
1108 | +++ b/f5a
1109 | @@ -1,1 +1,1 @@
1109 | @@ -1,1 +1,1 @@
1110 | -c5a
1110 | -c5a
1111 | +c5c
1111 | +c5c
1112 |
1112 |
1113 o changeset: 6:6bd1736cab86
1113 o changeset: 6:6bd1736cab86
1114 | parent: 0:11f7a1b56675
1114 | parent: 0:11f7a1b56675
1115 | user: test
1115 | user: test
1116 | date: Thu Jan 01 00:00:00 1970 +0000
1116 | date: Thu Jan 01 00:00:00 1970 +0000
1117 | files: f1a f1e f2a f3a f3e f4a f4e f5a f5b
1117 | files: f1a f1e f2a f3a f3e f4a f4e f5a f5b
1118 | copies: f1e (f1a) f3e (f3a) f4e (f4a) f5b (f5a)
1118 | copies: f1e (f1a) f3e (f3a) f4e (f4a) f5b (f5a)
1119 | description:
1119 | description:
1120 | E0
1120 | E0
1121 |
1121 |
1122 |
1122 |
1123 | diff --git a/f1a b/f1e
1123 | diff --git a/f1a b/f1e
1124 | rename from f1a
1124 | rename from f1a
1125 | rename to f1e
1125 | rename to f1e
1126 | diff --git a/f2a b/f2a
1126 | diff --git a/f2a b/f2a
1127 | --- a/f2a
1127 | --- a/f2a
1128 | +++ b/f2a
1128 | +++ b/f2a
1129 | @@ -1,1 +1,1 @@
1129 | @@ -1,1 +1,1 @@
1130 | -c2a
1130 | -c2a
1131 | +c2e
1131 | +c2e
1132 | diff --git a/f3a b/f3e
1132 | diff --git a/f3a b/f3e
1133 | rename from f3a
1133 | rename from f3a
1134 | rename to f3e
1134 | rename to f3e
1135 | diff --git a/f4a b/f4e
1135 | diff --git a/f4a b/f4e
1136 | rename from f4a
1136 | rename from f4a
1137 | rename to f4e
1137 | rename to f4e
1138 | diff --git a/f5a b/f5b
1138 | diff --git a/f5a b/f5b
1139 | rename from f5a
1139 | rename from f5a
1140 | rename to f5b
1140 | rename to f5b
1141 |
1141 |
1142 | o changeset: 5:560daee679da
1142 | o changeset: 5:560daee679da
1143 | | user: test
1143 | | user: test
1144 | | date: Thu Jan 01 00:00:00 1970 +0000
1144 | | date: Thu Jan 01 00:00:00 1970 +0000
1145 | | files: f3d f4a
1145 | | files: f3d f4a
1146 | | description:
1146 | | description:
1147 | | D1
1147 | | D1
1148 | |
1148 | |
1149 | |
1149 | |
1150 | | diff --git a/f3d b/f3d
1150 | | diff --git a/f3d b/f3d
1151 | | new file mode 100644
1151 | | new file mode 100644
1152 | | --- /dev/null
1152 | | --- /dev/null
1153 | | +++ b/f3d
1153 | | +++ b/f3d
1154 | | @@ -0,0 +1,1 @@
1154 | | @@ -0,0 +1,1 @@
1155 | | +c3a
1155 | | +c3a
1156 | | diff --git a/f4a b/f4a
1156 | | diff --git a/f4a b/f4a
1157 | | --- a/f4a
1157 | | --- a/f4a
1158 | | +++ b/f4a
1158 | | +++ b/f4a
1159 | | @@ -1,1 +1,1 @@
1159 | | @@ -1,1 +1,1 @@
1160 | | -c4a
1160 | | -c4a
1161 | | +c4d
1161 | | +c4d
1162 | |
1162 | |
1163 | o changeset: 4:c9763722f9bd
1163 | o changeset: 4:c9763722f9bd
1164 |/ parent: 0:11f7a1b56675
1164 |/ parent: 0:11f7a1b56675
1165 | user: test
1165 | user: test
1166 | date: Thu Jan 01 00:00:00 1970 +0000
1166 | date: Thu Jan 01 00:00:00 1970 +0000
1167 | files: f1a f2a f2c f5a
1167 | files: f1a f2a f2c f5a
1168 | copies: f2c (f2a)
1168 | copies: f2c (f2a)
1169 | description:
1169 | description:
1170 | C1
1170 | C1
1171 |
1171 |
1172 |
1172 |
1173 | diff --git a/f1a b/f1a
1173 | diff --git a/f1a b/f1a
1174 | --- a/f1a
1174 | --- a/f1a
1175 | +++ b/f1a
1175 | +++ b/f1a
1176 | @@ -1,1 +1,1 @@
1176 | @@ -1,1 +1,1 @@
1177 | -c1a
1177 | -c1a
1178 | +c1c
1178 | +c1c
1179 | diff --git a/f2a b/f2c
1179 | diff --git a/f2a b/f2c
1180 | rename from f2a
1180 | rename from f2a
1181 | rename to f2c
1181 | rename to f2c
1182 | diff --git a/f5a b/f5a
1182 | diff --git a/f5a b/f5a
1183 | --- a/f5a
1183 | --- a/f5a
1184 | +++ b/f5a
1184 | +++ b/f5a
1185 | @@ -1,1 +1,1 @@
1185 | @@ -1,1 +1,1 @@
1186 | -c5a
1186 | -c5a
1187 | +c5c
1187 | +c5c
1188 |
1188 |
1189 | o changeset: 3:b69f5839d2d9
1189 | o changeset: 3:b69f5839d2d9
1190 | | user: test
1190 | | user: test
1191 | | date: Thu Jan 01 00:00:00 1970 +0000
1191 | | date: Thu Jan 01 00:00:00 1970 +0000
1192 | | files: f3b f3d f4a
1192 | | files: f3b f3d f4a
1193 | | copies: f3d (f3b)
1193 | | copies: f3d (f3b)
1194 | | description:
1194 | | description:
1195 | | D0
1195 | | D0
1196 | |
1196 | |
1197 | |
1197 | |
1198 | | diff --git a/f3b b/f3d
1198 | | diff --git a/f3b b/f3d
1199 | | rename from f3b
1199 | | rename from f3b
1200 | | rename to f3d
1200 | | rename to f3d
1201 | | diff --git a/f4a b/f4a
1201 | | diff --git a/f4a b/f4a
1202 | | --- a/f4a
1202 | | --- a/f4a
1203 | | +++ b/f4a
1203 | | +++ b/f4a
1204 | | @@ -1,1 +1,1 @@
1204 | | @@ -1,1 +1,1 @@
1205 | | -c4a
1205 | | -c4a
1206 | | +c4d
1206 | | +c4d
1207 | |
1207 | |
1208 | o changeset: 2:f58c7e2b28fa
1208 | o changeset: 2:f58c7e2b28fa
1209 | | user: test
1209 | | user: test
1210 | | date: Thu Jan 01 00:00:00 1970 +0000
1210 | | date: Thu Jan 01 00:00:00 1970 +0000
1211 | | files: f1b f2a f2c f5a f5b
1211 | | files: f1b f2a f2c f5a f5b
1212 | | copies: f2c (f2a) f5a (f5b)
1212 | | copies: f2c (f2a) f5a (f5b)
1213 | | description:
1213 | | description:
1214 | | C0
1214 | | C0
1215 | |
1215 | |
1216 | |
1216 | |
1217 | | diff --git a/f1b b/f1b
1217 | | diff --git a/f1b b/f1b
1218 | | --- a/f1b
1218 | | --- a/f1b
1219 | | +++ b/f1b
1219 | | +++ b/f1b
1220 | | @@ -1,1 +1,1 @@
1220 | | @@ -1,1 +1,1 @@
1221 | | -c1a
1221 | | -c1a
1222 | | +c1c
1222 | | +c1c
1223 | | diff --git a/f2a b/f2c
1223 | | diff --git a/f2a b/f2c
1224 | | rename from f2a
1224 | | rename from f2a
1225 | | rename to f2c
1225 | | rename to f2c
1226 | | diff --git a/f5b b/f5a
1226 | | diff --git a/f5b b/f5a
1227 | | rename from f5b
1227 | | rename from f5b
1228 | | rename to f5a
1228 | | rename to f5a
1229 | | --- a/f5b
1229 | | --- a/f5b
1230 | | +++ b/f5a
1230 | | +++ b/f5a
1231 | | @@ -1,1 +1,1 @@
1231 | | @@ -1,1 +1,1 @@
1232 | | -c5a
1232 | | -c5a
1233 | | +c5c
1233 | | +c5c
1234 | |
1234 | |
1235 | o changeset: 1:3d7bba921b5d
1235 | o changeset: 1:3d7bba921b5d
1236 |/ user: test
1236 |/ user: test
1237 | date: Thu Jan 01 00:00:00 1970 +0000
1237 | date: Thu Jan 01 00:00:00 1970 +0000
1238 | files: f1a f1b f3a f3b f5a f5b
1238 | files: f1a f1b f3a f3b f5a f5b
1239 | copies: f1b (f1a) f3b (f3a) f5b (f5a)
1239 | copies: f1b (f1a) f3b (f3a) f5b (f5a)
1240 | description:
1240 | description:
1241 | B0
1241 | B0
1242 |
1242 |
1243 |
1243 |
1244 | diff --git a/f1a b/f1b
1244 | diff --git a/f1a b/f1b
1245 | rename from f1a
1245 | rename from f1a
1246 | rename to f1b
1246 | rename to f1b
1247 | diff --git a/f3a b/f3b
1247 | diff --git a/f3a b/f3b
1248 | rename from f3a
1248 | rename from f3a
1249 | rename to f3b
1249 | rename to f3b
1250 | diff --git a/f5a b/f5b
1250 | diff --git a/f5a b/f5b
1251 | rename from f5a
1251 | rename from f5a
1252 | rename to f5b
1252 | rename to f5b
1253 |
1253 |
1254 o changeset: 0:11f7a1b56675
1254 o changeset: 0:11f7a1b56675
1255 user: test
1255 user: test
1256 date: Thu Jan 01 00:00:00 1970 +0000
1256 date: Thu Jan 01 00:00:00 1970 +0000
1257 files: f1a f2a f3a f4a f5a
1257 files: f1a f2a f3a f4a f5a
1258 description:
1258 description:
1259 A0
1259 A0
1260
1260
1261
1261
1262 diff --git a/f1a b/f1a
1262 diff --git a/f1a b/f1a
1263 new file mode 100644
1263 new file mode 100644
1264 --- /dev/null
1264 --- /dev/null
1265 +++ b/f1a
1265 +++ b/f1a
1266 @@ -0,0 +1,1 @@
1266 @@ -0,0 +1,1 @@
1267 +c1a
1267 +c1a
1268 diff --git a/f2a b/f2a
1268 diff --git a/f2a b/f2a
1269 new file mode 100644
1269 new file mode 100644
1270 --- /dev/null
1270 --- /dev/null
1271 +++ b/f2a
1271 +++ b/f2a
1272 @@ -0,0 +1,1 @@
1272 @@ -0,0 +1,1 @@
1273 +c2a
1273 +c2a
1274 diff --git a/f3a b/f3a
1274 diff --git a/f3a b/f3a
1275 new file mode 100644
1275 new file mode 100644
1276 --- /dev/null
1276 --- /dev/null
1277 +++ b/f3a
1277 +++ b/f3a
1278 @@ -0,0 +1,1 @@
1278 @@ -0,0 +1,1 @@
1279 +c3a
1279 +c3a
1280 diff --git a/f4a b/f4a
1280 diff --git a/f4a b/f4a
1281 new file mode 100644
1281 new file mode 100644
1282 --- /dev/null
1282 --- /dev/null
1283 +++ b/f4a
1283 +++ b/f4a
1284 @@ -0,0 +1,1 @@
1284 @@ -0,0 +1,1 @@
1285 +c4a
1285 +c4a
1286 diff --git a/f5a b/f5a
1286 diff --git a/f5a b/f5a
1287 new file mode 100644
1287 new file mode 100644
1288 --- /dev/null
1288 --- /dev/null
1289 +++ b/f5a
1289 +++ b/f5a
1290 @@ -0,0 +1,1 @@
1290 @@ -0,0 +1,1 @@
1291 +c5a
1291 +c5a
1292
1292
1293 $ hg cat f2c
1293 $ hg cat f2c
1294 c2e
1294 c2e
1295
1295
1296 Check superfluous filemerge of files renamed in the past but untouched by graft
1296 Check superfluous filemerge of files renamed in the past but untouched by graft
1297
1297
1298 $ echo a > a
1298 $ echo a > a
1299 $ hg ci -qAma
1299 $ hg ci -qAma
1300 $ hg mv a b
1300 $ hg mv a b
1301 $ echo b > b
1301 $ echo b > b
1302 $ hg ci -qAmb
1302 $ hg ci -qAmb
1303 $ echo c > c
1303 $ echo c > c
1304 $ hg ci -qAmc
1304 $ hg ci -qAmc
1305 $ hg up -q .~2
1305 $ hg up -q .~2
1306 $ hg graft tip -qt:fail
1306 $ hg graft tip -qt:fail
1307
1307
1308 $ cd ..
1308 $ cd ..
1309
1309
1310 Graft a change into a new file previously grafted into a renamed directory
1310 Graft a change into a new file previously grafted into a renamed directory
1311
1311
1312 $ hg init dirmovenewfile
1312 $ hg init dirmovenewfile
1313 $ cd dirmovenewfile
1313 $ cd dirmovenewfile
1314 $ mkdir a
1314 $ mkdir a
1315 $ echo a > a/a
1315 $ echo a > a/a
1316 $ hg ci -qAma
1316 $ hg ci -qAma
1317 $ echo x > a/x
1317 $ echo x > a/x
1318 $ hg ci -qAmx
1318 $ hg ci -qAmx
1319 $ hg up -q 0
1319 $ hg up -q 0
1320 $ hg mv -q a b
1320 $ hg mv -q a b
1321 $ hg ci -qAmb
1321 $ hg ci -qAmb
1322 $ hg graft -q 1 # a/x grafted as b/x, but no copy information recorded
1322 $ hg graft -q 1 # a/x grafted as b/x, but no copy information recorded
1323 $ hg up -q 1
1323 $ hg up -q 1
1324 $ echo y > a/x
1324 $ echo y > a/x
1325 $ hg ci -qAmy
1325 $ hg ci -qAmy
1326 $ hg up -q 3
1326 $ hg up -q 3
1327 $ hg graft -q 4
1327 $ hg graft -q 4
1328 $ hg status --change .
1328 $ hg status --change .
1329 M b/x
1329 M b/x
1330
1330
1331 Prepare for test of skipped changesets and how merges can influence it:
1331 Prepare for test of skipped changesets and how merges can influence it:
1332
1332
1333 $ hg merge -q -r 1 --tool :local
1333 $ hg merge -q -r 1 --tool :local
1334 $ hg ci -m m
1334 $ hg ci -m m
1335 $ echo xx >> b/x
1335 $ echo xx >> b/x
1336 $ hg ci -m xx
1336 $ hg ci -m xx
1337
1337
1338 $ hg log -G -T '{rev} {desc|firstline}'
1338 $ hg log -G -T '{rev} {desc|firstline}'
1339 @ 7 xx
1339 @ 7 xx
1340 |
1340 |
1341 o 6 m
1341 o 6 m
1342 |\
1342 |\
1343 | o 5 y
1343 | o 5 y
1344 | |
1344 | |
1345 +---o 4 y
1345 +---o 4 y
1346 | |
1346 | |
1347 | o 3 x
1347 | o 3 x
1348 | |
1348 | |
1349 | o 2 b
1349 | o 2 b
1350 | |
1350 | |
1351 o | 1 x
1351 o | 1 x
1352 |/
1352 |/
1353 o 0 a
1353 o 0 a
1354
1354
1355 Grafting of plain changes correctly detects that 3 and 5 should be skipped:
1355 Grafting of plain changes correctly detects that 3 and 5 should be skipped:
1356
1356
1357 $ hg up -qCr 4
1357 $ hg up -qCr 4
1358 $ hg graft --tool :local -r 2::5
1358 $ hg graft --tool :local -r 2::5
1359 skipping already grafted revision 3:ca093ca2f1d9 (was grafted from 1:13ec5badbf2a)
1359 skipping already grafted revision 3:ca093ca2f1d9 (was grafted from 1:13ec5badbf2a)
1360 skipping already grafted revision 5:43e9eb70dab0 (was grafted from 4:6c9a1289e5f1)
1360 skipping already grafted revision 5:43e9eb70dab0 (was grafted from 4:6c9a1289e5f1)
1361 grafting 2:42127f193bcd "b"
1361 grafting 2:42127f193bcd "b"
1362
1362
1363 Extending the graft range to include a (skipped) merge of 3 will not prevent us from
1363 Extending the graft range to include a (skipped) merge of 3 will not prevent us from
1364 also detecting that both 3 and 5 should be skipped:
1364 also detecting that both 3 and 5 should be skipped:
1365
1365
1366 $ hg up -qCr 4
1366 $ hg up -qCr 4
1367 $ hg graft --tool :local -r 2::7
1367 $ hg graft --tool :local -r 2::7
1368 skipping ungraftable merge revision 6
1368 skipping ungraftable merge revision 6
1369 skipping already grafted revision 3:ca093ca2f1d9 (was grafted from 1:13ec5badbf2a)
1369 skipping already grafted revision 3:ca093ca2f1d9 (was grafted from 1:13ec5badbf2a)
1370 skipping already grafted revision 5:43e9eb70dab0 (was grafted from 4:6c9a1289e5f1)
1370 skipping already grafted revision 5:43e9eb70dab0 (was grafted from 4:6c9a1289e5f1)
1371 grafting 2:42127f193bcd "b"
1371 grafting 2:42127f193bcd "b"
1372 grafting 7:d3c3f2b38ecc "xx"
1372 grafting 7:d3c3f2b38ecc "xx"
1373 note: graft of 7:d3c3f2b38ecc created no changes to commit
1373 note: graft of 7:d3c3f2b38ecc created no changes to commit
1374
1374
1375 $ cd ..
1375 $ cd ..
1376
1377 Testing the reading of old format graftstate file with newer mercurial
1378
1379 $ hg init oldgraft
1380 $ cd oldgraft
1381 $ for ch in a b c; do echo foo > $ch; hg add $ch; hg ci -Aqm "added "$ch; done;
1382 $ hg log -GT "{rev}:{node|short} {desc}\n"
1383 @ 2:8be98ac1a569 added c
1384 |
1385 o 1:80e6d2c47cfe added b
1386 |
1387 o 0:f7ad41964313 added a
1388
1389 $ hg up 0
1390 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1391 $ echo bar > b
1392 $ hg add b
1393 $ hg ci -m "bar to b"
1394 created new head
1395 $ hg graft -r 1 -r 2
1396 grafting 1:80e6d2c47cfe "added b"
1397 merging b
1398 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
1399 abort: unresolved conflicts, can't continue
1400 (use 'hg resolve' and 'hg graft --continue')
1401 [255]
1402
1403 Writing the nodes in old format to graftstate
1404
1405 $ hg log -r 1 -r 2 -T '{node}\n' > .hg/graftstate
1406 $ echo foo > b
1407 $ hg resolve -m
1408 (no more unresolved files)
1409 continue: hg graft --continue
1410 $ hg graft --continue
1411 grafting 1:80e6d2c47cfe "added b"
1412 grafting 2:8be98ac1a569 "added c"
General Comments 0
You need to be logged in to leave comments. Login now