##// END OF EJS Templates
copies: delete debug message about search limit...
Martin von Zweigbergk -
r42343:380f59da default draft
parent child Browse files
Show More
@@ -1,1027 +1,1026 b''
1 1 # copies.py - copy detection for Mercurial
2 2 #
3 3 # Copyright 2008 Matt Mackall <mpm@selenic.com>
4 4 #
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7
8 8 from __future__ import absolute_import
9 9
10 10 import collections
11 11 import heapq
12 12 import os
13 13
14 14 from .i18n import _
15 15
16 16 from . import (
17 17 match as matchmod,
18 18 node,
19 19 pathutil,
20 20 util,
21 21 )
22 22 from .utils import (
23 23 stringutil,
24 24 )
25 25
26 26 def _findlimit(repo, ctxa, ctxb):
27 27 """
28 28 Find the last revision that needs to be checked to ensure that a full
29 29 transitive closure for file copies can be properly calculated.
30 30 Generally, this means finding the earliest revision number that's an
31 31 ancestor of a or b but not both, except when a or b is a direct descendent
32 32 of the other, in which case we can return the minimum revnum of a and b.
33 33 """
34 34
35 35 # basic idea:
36 36 # - mark a and b with different sides
37 37 # - if a parent's children are all on the same side, the parent is
38 38 # on that side, otherwise it is on no side
39 39 # - walk the graph in topological order with the help of a heap;
40 40 # - add unseen parents to side map
41 41 # - clear side of any parent that has children on different sides
42 42 # - track number of interesting revs that might still be on a side
43 43 # - track the lowest interesting rev seen
44 44 # - quit when interesting revs is zero
45 45
46 46 cl = repo.changelog
47 47 wdirparents = None
48 48 a = ctxa.rev()
49 49 b = ctxb.rev()
50 50 if a is None:
51 51 wdirparents = (ctxa.p1(), ctxa.p2())
52 52 a = node.wdirrev
53 53 if b is None:
54 54 assert not wdirparents
55 55 wdirparents = (ctxb.p1(), ctxb.p2())
56 56 b = node.wdirrev
57 57
58 58 side = {a: -1, b: 1}
59 59 visit = [-a, -b]
60 60 heapq.heapify(visit)
61 61 interesting = len(visit)
62 62 limit = node.wdirrev
63 63
64 64 while interesting:
65 65 r = -heapq.heappop(visit)
66 66 if r == node.wdirrev:
67 67 parents = [pctx.rev() for pctx in wdirparents]
68 68 else:
69 69 parents = cl.parentrevs(r)
70 70 if parents[1] == node.nullrev:
71 71 parents = parents[:1]
72 72 for p in parents:
73 73 if p not in side:
74 74 # first time we see p; add it to visit
75 75 side[p] = side[r]
76 76 if side[p]:
77 77 interesting += 1
78 78 heapq.heappush(visit, -p)
79 79 elif side[p] and side[p] != side[r]:
80 80 # p was interesting but now we know better
81 81 side[p] = 0
82 82 interesting -= 1
83 83 if side[r]:
84 84 limit = r # lowest rev visited
85 85 interesting -= 1
86 86
87 87 # Consider the following flow (see test-commit-amend.t under issue4405):
88 88 # 1/ File 'a0' committed
89 89 # 2/ File renamed from 'a0' to 'a1' in a new commit (call it 'a1')
90 90 # 3/ Move back to first commit
91 91 # 4/ Create a new commit via revert to contents of 'a1' (call it 'a1-amend')
92 92 # 5/ Rename file from 'a1' to 'a2' and commit --amend 'a1-msg'
93 93 #
94 94 # During the amend in step five, we will be in this state:
95 95 #
96 96 # @ 3 temporary amend commit for a1-amend
97 97 # |
98 98 # o 2 a1-amend
99 99 # |
100 100 # | o 1 a1
101 101 # |/
102 102 # o 0 a0
103 103 #
104 104 # When _findlimit is called, a and b are revs 3 and 0, so limit will be 2,
105 105 # yet the filelog has the copy information in rev 1 and we will not look
106 106 # back far enough unless we also look at the a and b as candidates.
107 107 # This only occurs when a is a descendent of b or visa-versa.
108 108 return min(limit, a, b)
109 109
110 110 def _chain(src, dst, a, b):
111 111 """chain two sets of copies a->b"""
112 112 t = a.copy()
113 113 for k, v in b.iteritems():
114 114 if v in t:
115 115 # found a chain
116 116 if t[v] != k:
117 117 # file wasn't renamed back to itself
118 118 t[k] = t[v]
119 119 if v not in dst:
120 120 # chain was a rename, not a copy
121 121 del t[v]
122 122 if v in src:
123 123 # file is a copy of an existing file
124 124 t[k] = v
125 125
126 126 for k, v in list(t.items()):
127 127 # remove criss-crossed copies
128 128 if k in src and v in dst:
129 129 del t[k]
130 130 # remove copies to files that were then removed
131 131 elif k not in dst:
132 132 del t[k]
133 133
134 134 return t
135 135
136 136 def _tracefile(fctx, am, limit=node.nullrev):
137 137 """return file context that is the ancestor of fctx present in ancestor
138 138 manifest am, stopping after the first ancestor lower than limit"""
139 139
140 140 for f in fctx.ancestors():
141 141 if am.get(f.path(), None) == f.filenode():
142 142 return f
143 143 if limit >= 0 and not f.isintroducedafter(limit):
144 144 return None
145 145
146 146 def _dirstatecopies(repo, match=None):
147 147 ds = repo.dirstate
148 148 c = ds.copies().copy()
149 149 for k in list(c):
150 150 if ds[k] not in 'anm' or (match and not match(k)):
151 151 del c[k]
152 152 return c
153 153
154 154 def _computeforwardmissing(a, b, match=None):
155 155 """Computes which files are in b but not a.
156 156 This is its own function so extensions can easily wrap this call to see what
157 157 files _forwardcopies is about to process.
158 158 """
159 159 ma = a.manifest()
160 160 mb = b.manifest()
161 161 return mb.filesnotin(ma, match=match)
162 162
163 163 def usechangesetcentricalgo(repo):
164 164 """Checks if we should use changeset-centric copy algorithms"""
165 165 return (repo.ui.config('experimental', 'copies.read-from') in
166 166 ('changeset-only', 'compatibility'))
167 167
168 168 def _committedforwardcopies(a, b, match):
169 169 """Like _forwardcopies(), but b.rev() cannot be None (working copy)"""
170 170 # files might have to be traced back to the fctx parent of the last
171 171 # one-side-only changeset, but not further back than that
172 172 repo = a._repo
173 173
174 174 if usechangesetcentricalgo(repo):
175 175 return _changesetforwardcopies(a, b, match)
176 176
177 177 debug = repo.ui.debugflag and repo.ui.configbool('devel', 'debug.copies')
178 178 dbg = repo.ui.debug
179 179 if debug:
180 180 dbg('debug.copies: looking into rename from %s to %s\n'
181 181 % (a, b))
182 182 limit = _findlimit(repo, a, b)
183 183 if debug:
184 184 dbg('debug.copies: search limit: %d\n' % limit)
185 185 am = a.manifest()
186 186
187 187 # find where new files came from
188 188 # we currently don't try to find where old files went, too expensive
189 189 # this means we can miss a case like 'hg rm b; hg cp a b'
190 190 cm = {}
191 191
192 192 # Computing the forward missing is quite expensive on large manifests, since
193 193 # it compares the entire manifests. We can optimize it in the common use
194 194 # case of computing what copies are in a commit versus its parent (like
195 195 # during a rebase or histedit). Note, we exclude merge commits from this
196 196 # optimization, since the ctx.files() for a merge commit is not correct for
197 197 # this comparison.
198 198 forwardmissingmatch = match
199 199 if b.p1() == a and b.p2().node() == node.nullid:
200 200 filesmatcher = matchmod.exact(b.files())
201 201 forwardmissingmatch = matchmod.intersectmatchers(match, filesmatcher)
202 202 missing = _computeforwardmissing(a, b, match=forwardmissingmatch)
203 203
204 204 ancestrycontext = a._repo.changelog.ancestors([b.rev()], inclusive=True)
205 205
206 206 if debug:
207 207 dbg('debug.copies: missing file to search: %d\n' % len(missing))
208 208
209 209 for f in missing:
210 210 if debug:
211 211 dbg('debug.copies: tracing file: %s\n' % f)
212 212 fctx = b[f]
213 213 fctx._ancestrycontext = ancestrycontext
214 214
215 215 if debug:
216 216 start = util.timer()
217 217 ofctx = _tracefile(fctx, am, limit)
218 218 if ofctx:
219 219 if debug:
220 220 dbg('debug.copies: rename of: %s\n' % ofctx._path)
221 221 cm[f] = ofctx.path()
222 222 if debug:
223 223 dbg('debug.copies: time: %f seconds\n'
224 224 % (util.timer() - start))
225 225 return cm
226 226
227 227 def _changesetforwardcopies(a, b, match):
228 228 if a.rev() == node.nullrev:
229 229 return {}
230 230
231 231 repo = a.repo()
232 232 children = {}
233 233 cl = repo.changelog
234 234 missingrevs = cl.findmissingrevs(common=[a.rev()], heads=[b.rev()])
235 235 for r in missingrevs:
236 236 for p in cl.parentrevs(r):
237 237 if p == node.nullrev:
238 238 continue
239 239 if p not in children:
240 240 children[p] = [r]
241 241 else:
242 242 children[p].append(r)
243 243
244 244 roots = set(children) - set(missingrevs)
245 245 # 'work' contains 3-tuples of a (revision number, parent number, copies).
246 246 # The parent number is only used for knowing which parent the copies dict
247 247 # came from.
248 248 work = [(r, 1, {}) for r in roots]
249 249 heapq.heapify(work)
250 250 while work:
251 251 r, i1, copies1 = heapq.heappop(work)
252 252 if work and work[0][0] == r:
253 253 # We are tracing copies from both parents
254 254 r, i2, copies2 = heapq.heappop(work)
255 255 copies = {}
256 256 ctx = repo[r]
257 257 p1man, p2man = ctx.p1().manifest(), ctx.p2().manifest()
258 258 allcopies = set(copies1) | set(copies2)
259 259 # TODO: perhaps this filtering should be done as long as ctx
260 260 # is merge, whether or not we're tracing from both parent.
261 261 for dst in allcopies:
262 262 if not match(dst):
263 263 continue
264 264 if dst not in copies2:
265 265 # Copied on p1 side: mark as copy from p1 side if it didn't
266 266 # already exist on p2 side
267 267 if dst not in p2man:
268 268 copies[dst] = copies1[dst]
269 269 elif dst not in copies1:
270 270 # Copied on p2 side: mark as copy from p2 side if it didn't
271 271 # already exist on p1 side
272 272 if dst not in p1man:
273 273 copies[dst] = copies2[dst]
274 274 else:
275 275 # Copied on both sides: mark as copy from p1 side
276 276 copies[dst] = copies1[dst]
277 277 else:
278 278 copies = copies1
279 279 if r == b.rev():
280 280 return copies
281 281 for c in children[r]:
282 282 childctx = repo[c]
283 283 if r == childctx.p1().rev():
284 284 parent = 1
285 285 childcopies = childctx.p1copies()
286 286 else:
287 287 assert r == childctx.p2().rev()
288 288 parent = 2
289 289 childcopies = childctx.p2copies()
290 290 if not match.always():
291 291 childcopies = {dst: src for dst, src in childcopies.items()
292 292 if match(dst)}
293 293 childcopies = _chain(a, childctx, copies, childcopies)
294 294 heapq.heappush(work, (c, parent, childcopies))
295 295 assert False
296 296
297 297 def _forwardcopies(a, b, match=None):
298 298 """find {dst@b: src@a} copy mapping where a is an ancestor of b"""
299 299
300 300 match = a.repo().narrowmatch(match)
301 301 # check for working copy
302 302 if b.rev() is None:
303 303 if a == b.p1():
304 304 # short-circuit to avoid issues with merge states
305 305 return _dirstatecopies(b._repo, match)
306 306
307 307 cm = _committedforwardcopies(a, b.p1(), match)
308 308 # combine copies from dirstate if necessary
309 309 return _chain(a, b, cm, _dirstatecopies(b._repo, match))
310 310 return _committedforwardcopies(a, b, match)
311 311
312 312 def _backwardrenames(a, b, match):
313 313 if a._repo.ui.config('experimental', 'copytrace') == 'off':
314 314 return {}
315 315
316 316 # Even though we're not taking copies into account, 1:n rename situations
317 317 # can still exist (e.g. hg cp a b; hg mv a c). In those cases we
318 318 # arbitrarily pick one of the renames.
319 319 # We don't want to pass in "match" here, since that would filter
320 320 # the destination by it. Since we're reversing the copies, we want
321 321 # to filter the source instead.
322 322 f = _forwardcopies(b, a)
323 323 r = {}
324 324 for k, v in sorted(f.iteritems()):
325 325 if match and not match(v):
326 326 continue
327 327 # remove copies
328 328 if v in a:
329 329 continue
330 330 r[v] = k
331 331 return r
332 332
333 333 def pathcopies(x, y, match=None):
334 334 """find {dst@y: src@x} copy mapping for directed compare"""
335 335 repo = x._repo
336 336 debug = repo.ui.debugflag and repo.ui.configbool('devel', 'debug.copies')
337 337 if debug:
338 338 repo.ui.debug('debug.copies: searching copies from %s to %s\n'
339 339 % (x, y))
340 340 if x == y or not x or not y:
341 341 return {}
342 342 a = y.ancestor(x)
343 343 if a == x:
344 344 if debug:
345 345 repo.ui.debug('debug.copies: search mode: forward\n')
346 346 return _forwardcopies(x, y, match=match)
347 347 if a == y:
348 348 if debug:
349 349 repo.ui.debug('debug.copies: search mode: backward\n')
350 350 return _backwardrenames(x, y, match=match)
351 351 if debug:
352 352 repo.ui.debug('debug.copies: search mode: combined\n')
353 353 return _chain(x, y, _backwardrenames(x, a, match=match),
354 354 _forwardcopies(a, y, match=match))
355 355
356 356 def _computenonoverlap(repo, c1, c2, addedinm1, addedinm2, baselabel=''):
357 357 """Computes, based on addedinm1 and addedinm2, the files exclusive to c1
358 358 and c2. This is its own function so extensions can easily wrap this call
359 359 to see what files mergecopies is about to process.
360 360
361 361 Even though c1 and c2 are not used in this function, they are useful in
362 362 other extensions for being able to read the file nodes of the changed files.
363 363
364 364 "baselabel" can be passed to help distinguish the multiple computations
365 365 done in the graft case.
366 366 """
367 367 u1 = sorted(addedinm1 - addedinm2)
368 368 u2 = sorted(addedinm2 - addedinm1)
369 369
370 370 header = " unmatched files in %s"
371 371 if baselabel:
372 372 header += ' (from %s)' % baselabel
373 373 if u1:
374 374 repo.ui.debug("%s:\n %s\n" % (header % 'local', "\n ".join(u1)))
375 375 if u2:
376 376 repo.ui.debug("%s:\n %s\n" % (header % 'other', "\n ".join(u2)))
377 377
378 378 return u1, u2
379 379
380 380 def _makegetfctx(ctx):
381 381 """return a 'getfctx' function suitable for _checkcopies usage
382 382
383 383 We have to re-setup the function building 'filectx' for each
384 384 '_checkcopies' to ensure the linkrev adjustment is properly setup for
385 385 each. Linkrev adjustment is important to avoid bug in rename
386 386 detection. Moreover, having a proper '_ancestrycontext' setup ensures
387 387 the performance impact of this adjustment is kept limited. Without it,
388 388 each file could do a full dag traversal making the time complexity of
389 389 the operation explode (see issue4537).
390 390
391 391 This function exists here mostly to limit the impact on stable. Feel
392 392 free to refactor on default.
393 393 """
394 394 rev = ctx.rev()
395 395 repo = ctx._repo
396 396 ac = getattr(ctx, '_ancestrycontext', None)
397 397 if ac is None:
398 398 revs = [rev]
399 399 if rev is None:
400 400 revs = [p.rev() for p in ctx.parents()]
401 401 ac = repo.changelog.ancestors(revs, inclusive=True)
402 402 ctx._ancestrycontext = ac
403 403 def makectx(f, n):
404 404 if n in node.wdirfilenodeids: # in a working context?
405 405 if ctx.rev() is None:
406 406 return ctx.filectx(f)
407 407 return repo[None][f]
408 408 fctx = repo.filectx(f, fileid=n)
409 409 # setup only needed for filectx not create from a changectx
410 410 fctx._ancestrycontext = ac
411 411 fctx._descendantrev = rev
412 412 return fctx
413 413 return util.lrucachefunc(makectx)
414 414
415 415 def _combinecopies(copyfrom, copyto, finalcopy, diverge, incompletediverge):
416 416 """combine partial copy paths"""
417 417 remainder = {}
418 418 for f in copyfrom:
419 419 if f in copyto:
420 420 finalcopy[copyto[f]] = copyfrom[f]
421 421 del copyto[f]
422 422 for f in incompletediverge:
423 423 assert f not in diverge
424 424 ic = incompletediverge[f]
425 425 if ic[0] in copyto:
426 426 diverge[f] = [copyto[ic[0]], ic[1]]
427 427 else:
428 428 remainder[f] = ic
429 429 return remainder
430 430
431 431 def mergecopies(repo, c1, c2, base):
432 432 """
433 433 Finds moves and copies between context c1 and c2 that are relevant for
434 434 merging. 'base' will be used as the merge base.
435 435
436 436 Copytracing is used in commands like rebase, merge, unshelve, etc to merge
437 437 files that were moved/ copied in one merge parent and modified in another.
438 438 For example:
439 439
440 440 o ---> 4 another commit
441 441 |
442 442 | o ---> 3 commit that modifies a.txt
443 443 | /
444 444 o / ---> 2 commit that moves a.txt to b.txt
445 445 |/
446 446 o ---> 1 merge base
447 447
448 448 If we try to rebase revision 3 on revision 4, since there is no a.txt in
449 449 revision 4, and if user have copytrace disabled, we prints the following
450 450 message:
451 451
452 452 ```other changed <file> which local deleted```
453 453
454 454 Returns five dicts: "copy", "movewithdir", "diverge", "renamedelete" and
455 455 "dirmove".
456 456
457 457 "copy" is a mapping from destination name -> source name,
458 458 where source is in c1 and destination is in c2 or vice-versa.
459 459
460 460 "movewithdir" is a mapping from source name -> destination name,
461 461 where the file at source present in one context but not the other
462 462 needs to be moved to destination by the merge process, because the
463 463 other context moved the directory it is in.
464 464
465 465 "diverge" is a mapping of source name -> list of destination names
466 466 for divergent renames.
467 467
468 468 "renamedelete" is a mapping of source name -> list of destination
469 469 names for files deleted in c1 that were renamed in c2 or vice-versa.
470 470
471 471 "dirmove" is a mapping of detected source dir -> destination dir renames.
472 472 This is needed for handling changes to new files previously grafted into
473 473 renamed directories.
474 474
475 475 This function calls different copytracing algorithms based on config.
476 476 """
477 477 # avoid silly behavior for update from empty dir
478 478 if not c1 or not c2 or c1 == c2:
479 479 return {}, {}, {}, {}, {}
480 480
481 481 narrowmatch = c1.repo().narrowmatch()
482 482
483 483 # avoid silly behavior for parent -> working dir
484 484 if c2.node() is None and c1.node() == repo.dirstate.p1():
485 485 return _dirstatecopies(repo, narrowmatch), {}, {}, {}, {}
486 486
487 487 copytracing = repo.ui.config('experimental', 'copytrace')
488 488 boolctrace = stringutil.parsebool(copytracing)
489 489
490 490 # Copy trace disabling is explicitly below the node == p1 logic above
491 491 # because the logic above is required for a simple copy to be kept across a
492 492 # rebase.
493 493 if copytracing == 'heuristics':
494 494 # Do full copytracing if only non-public revisions are involved as
495 495 # that will be fast enough and will also cover the copies which could
496 496 # be missed by heuristics
497 497 if _isfullcopytraceable(repo, c1, base):
498 498 return _fullcopytracing(repo, c1, c2, base)
499 499 return _heuristicscopytracing(repo, c1, c2, base)
500 500 elif boolctrace is False:
501 501 # stringutil.parsebool() returns None when it is unable to parse the
502 502 # value, so we should rely on making sure copytracing is on such cases
503 503 return {}, {}, {}, {}, {}
504 504 else:
505 505 return _fullcopytracing(repo, c1, c2, base)
506 506
507 507 def _isfullcopytraceable(repo, c1, base):
508 508 """ Checks that if base, source and destination are all no-public branches,
509 509 if yes let's use the full copytrace algorithm for increased capabilities
510 510 since it will be fast enough.
511 511
512 512 `experimental.copytrace.sourcecommitlimit` can be used to set a limit for
513 513 number of changesets from c1 to base such that if number of changesets are
514 514 more than the limit, full copytracing algorithm won't be used.
515 515 """
516 516 if c1.rev() is None:
517 517 c1 = c1.p1()
518 518 if c1.mutable() and base.mutable():
519 519 sourcecommitlimit = repo.ui.configint('experimental',
520 520 'copytrace.sourcecommitlimit')
521 521 commits = len(repo.revs('%d::%d', base.rev(), c1.rev()))
522 522 return commits < sourcecommitlimit
523 523 return False
524 524
525 525 def _fullcopytracing(repo, c1, c2, base):
526 526 """ The full copytracing algorithm which finds all the new files that were
527 527 added from merge base up to the top commit and for each file it checks if
528 528 this file was copied from another file.
529 529
530 530 This is pretty slow when a lot of changesets are involved but will track all
531 531 the copies.
532 532 """
533 533 # In certain scenarios (e.g. graft, update or rebase), base can be
534 534 # overridden We still need to know a real common ancestor in this case We
535 535 # can't just compute _c1.ancestor(_c2) and compare it to ca, because there
536 536 # can be multiple common ancestors, e.g. in case of bidmerge. Because our
537 537 # caller may not know if the revision passed in lieu of the CA is a genuine
538 538 # common ancestor or not without explicitly checking it, it's better to
539 539 # determine that here.
540 540 #
541 541 # base.isancestorof(wc) is False, work around that
542 542 _c1 = c1.p1() if c1.rev() is None else c1
543 543 _c2 = c2.p1() if c2.rev() is None else c2
544 544 # an endpoint is "dirty" if it isn't a descendant of the merge base
545 545 # if we have a dirty endpoint, we need to trigger graft logic, and also
546 546 # keep track of which endpoint is dirty
547 547 dirtyc1 = not base.isancestorof(_c1)
548 548 dirtyc2 = not base.isancestorof(_c2)
549 549 graft = dirtyc1 or dirtyc2
550 550 tca = base
551 551 if graft:
552 552 tca = _c1.ancestor(_c2)
553 553
554 554 limit = _findlimit(repo, c1, c2)
555 repo.ui.debug(" searching for copies back to rev %d\n" % limit)
556 555
557 556 m1 = c1.manifest()
558 557 m2 = c2.manifest()
559 558 mb = base.manifest()
560 559
561 560 # gather data from _checkcopies:
562 561 # - diverge = record all diverges in this dict
563 562 # - copy = record all non-divergent copies in this dict
564 563 # - fullcopy = record all copies in this dict
565 564 # - incomplete = record non-divergent partial copies here
566 565 # - incompletediverge = record divergent partial copies here
567 566 diverge = {} # divergence data is shared
568 567 incompletediverge = {}
569 568 data1 = {'copy': {},
570 569 'fullcopy': {},
571 570 'incomplete': {},
572 571 'diverge': diverge,
573 572 'incompletediverge': incompletediverge,
574 573 }
575 574 data2 = {'copy': {},
576 575 'fullcopy': {},
577 576 'incomplete': {},
578 577 'diverge': diverge,
579 578 'incompletediverge': incompletediverge,
580 579 }
581 580
582 581 # find interesting file sets from manifests
583 582 addedinm1 = m1.filesnotin(mb, repo.narrowmatch())
584 583 addedinm2 = m2.filesnotin(mb, repo.narrowmatch())
585 584 bothnew = sorted(addedinm1 & addedinm2)
586 585 if tca == base:
587 586 # unmatched file from base
588 587 u1r, u2r = _computenonoverlap(repo, c1, c2, addedinm1, addedinm2)
589 588 u1u, u2u = u1r, u2r
590 589 else:
591 590 # unmatched file from base (DAG rotation in the graft case)
592 591 u1r, u2r = _computenonoverlap(repo, c1, c2, addedinm1, addedinm2,
593 592 baselabel='base')
594 593 # unmatched file from topological common ancestors (no DAG rotation)
595 594 # need to recompute this for directory move handling when grafting
596 595 mta = tca.manifest()
597 596 u1u, u2u = _computenonoverlap(repo, c1, c2,
598 597 m1.filesnotin(mta, repo.narrowmatch()),
599 598 m2.filesnotin(mta, repo.narrowmatch()),
600 599 baselabel='topological common ancestor')
601 600
602 601 for f in u1u:
603 602 _checkcopies(c1, c2, f, base, tca, dirtyc1, limit, data1)
604 603
605 604 for f in u2u:
606 605 _checkcopies(c2, c1, f, base, tca, dirtyc2, limit, data2)
607 606
608 607 copy = dict(data1['copy'])
609 608 copy.update(data2['copy'])
610 609 fullcopy = dict(data1['fullcopy'])
611 610 fullcopy.update(data2['fullcopy'])
612 611
613 612 if dirtyc1:
614 613 _combinecopies(data2['incomplete'], data1['incomplete'], copy, diverge,
615 614 incompletediverge)
616 615 if dirtyc2:
617 616 _combinecopies(data1['incomplete'], data2['incomplete'], copy, diverge,
618 617 incompletediverge)
619 618
620 619 renamedelete = {}
621 620 renamedeleteset = set()
622 621 divergeset = set()
623 622 for of, fl in list(diverge.items()):
624 623 if len(fl) == 1 or of in c1 or of in c2:
625 624 del diverge[of] # not actually divergent, or not a rename
626 625 if of not in c1 and of not in c2:
627 626 # renamed on one side, deleted on the other side, but filter
628 627 # out files that have been renamed and then deleted
629 628 renamedelete[of] = [f for f in fl if f in c1 or f in c2]
630 629 renamedeleteset.update(fl) # reverse map for below
631 630 else:
632 631 divergeset.update(fl) # reverse map for below
633 632
634 633 if bothnew:
635 634 repo.ui.debug(" unmatched files new in both:\n %s\n"
636 635 % "\n ".join(bothnew))
637 636 bothdiverge = {}
638 637 bothincompletediverge = {}
639 638 remainder = {}
640 639 both1 = {'copy': {},
641 640 'fullcopy': {},
642 641 'incomplete': {},
643 642 'diverge': bothdiverge,
644 643 'incompletediverge': bothincompletediverge
645 644 }
646 645 both2 = {'copy': {},
647 646 'fullcopy': {},
648 647 'incomplete': {},
649 648 'diverge': bothdiverge,
650 649 'incompletediverge': bothincompletediverge
651 650 }
652 651 for f in bothnew:
653 652 _checkcopies(c1, c2, f, base, tca, dirtyc1, limit, both1)
654 653 _checkcopies(c2, c1, f, base, tca, dirtyc2, limit, both2)
655 654 if dirtyc1 and dirtyc2:
656 655 remainder = _combinecopies(both2['incomplete'], both1['incomplete'],
657 656 copy, bothdiverge, bothincompletediverge)
658 657 remainder1 = _combinecopies(both1['incomplete'], both2['incomplete'],
659 658 copy, bothdiverge, bothincompletediverge)
660 659 remainder.update(remainder1)
661 660 elif dirtyc1:
662 661 # incomplete copies may only be found on the "dirty" side for bothnew
663 662 assert not both2['incomplete']
664 663 remainder = _combinecopies({}, both1['incomplete'], copy, bothdiverge,
665 664 bothincompletediverge)
666 665 elif dirtyc2:
667 666 assert not both1['incomplete']
668 667 remainder = _combinecopies({}, both2['incomplete'], copy, bothdiverge,
669 668 bothincompletediverge)
670 669 else:
671 670 # incomplete copies and divergences can't happen outside grafts
672 671 assert not both1['incomplete']
673 672 assert not both2['incomplete']
674 673 assert not bothincompletediverge
675 674 for f in remainder:
676 675 assert f not in bothdiverge
677 676 ic = remainder[f]
678 677 if ic[0] in (m1 if dirtyc1 else m2):
679 678 # backed-out rename on one side, but watch out for deleted files
680 679 bothdiverge[f] = ic
681 680 for of, fl in bothdiverge.items():
682 681 if len(fl) == 2 and fl[0] == fl[1]:
683 682 copy[fl[0]] = of # not actually divergent, just matching renames
684 683
685 684 # Sometimes we get invalid copies here (the "and not remotebase" in
686 685 # _checkcopies() seems suspicious). Filter them out.
687 686 for dst, src in fullcopy.copy().items():
688 687 if src not in mb:
689 688 del fullcopy[dst]
690 689 # Sometimes we forget to add entries from "copy" to "fullcopy", so fix
691 690 # that up here
692 691 for dst, src in copy.items():
693 692 fullcopy[dst] = src
694 693 # Sometimes we forget to add entries from "diverge" to "fullcopy", so fix
695 694 # that up here
696 695 for src, dsts in diverge.items():
697 696 for dst in dsts:
698 697 fullcopy[dst] = src
699 698
700 699 if not fullcopy:
701 700 return copy, {}, diverge, renamedelete, {}
702 701
703 702 if repo.ui.debugflag:
704 703 repo.ui.debug(" all copies found (* = to merge, ! = divergent, "
705 704 "% = renamed and deleted):\n")
706 705 for f in sorted(fullcopy):
707 706 note = ""
708 707 if f in copy:
709 708 note += "*"
710 709 if f in divergeset:
711 710 note += "!"
712 711 if f in renamedeleteset:
713 712 note += "%"
714 713 repo.ui.debug(" src: '%s' -> dst: '%s' %s\n" % (fullcopy[f], f,
715 714 note))
716 715 del divergeset
717 716
718 717 repo.ui.debug(" checking for directory renames\n")
719 718
720 719 # generate a directory move map
721 720 d1, d2 = c1.dirs(), c2.dirs()
722 721 # Hack for adding '', which is not otherwise added, to d1 and d2
723 722 d1.addpath('/')
724 723 d2.addpath('/')
725 724 invalid = set()
726 725 dirmove = {}
727 726
728 727 # examine each file copy for a potential directory move, which is
729 728 # when all the files in a directory are moved to a new directory
730 729 for dst, src in fullcopy.iteritems():
731 730 dsrc, ddst = pathutil.dirname(src), pathutil.dirname(dst)
732 731 if dsrc in invalid:
733 732 # already seen to be uninteresting
734 733 continue
735 734 elif dsrc in d1 and ddst in d1:
736 735 # directory wasn't entirely moved locally
737 736 invalid.add(dsrc)
738 737 elif dsrc in d2 and ddst in d2:
739 738 # directory wasn't entirely moved remotely
740 739 invalid.add(dsrc)
741 740 elif dsrc in dirmove and dirmove[dsrc] != ddst:
742 741 # files from the same directory moved to two different places
743 742 invalid.add(dsrc)
744 743 else:
745 744 # looks good so far
746 745 dirmove[dsrc] = ddst
747 746
748 747 for i in invalid:
749 748 if i in dirmove:
750 749 del dirmove[i]
751 750 del d1, d2, invalid
752 751
753 752 if not dirmove:
754 753 return copy, {}, diverge, renamedelete, {}
755 754
756 755 dirmove = {k + "/": v + "/" for k, v in dirmove.iteritems()}
757 756
758 757 for d in dirmove:
759 758 repo.ui.debug(" discovered dir src: '%s' -> dst: '%s'\n" %
760 759 (d, dirmove[d]))
761 760
762 761 movewithdir = {}
763 762 # check unaccounted nonoverlapping files against directory moves
764 763 for f in u1r + u2r:
765 764 if f not in fullcopy:
766 765 for d in dirmove:
767 766 if f.startswith(d):
768 767 # new file added in a directory that was moved, move it
769 768 df = dirmove[d] + f[len(d):]
770 769 if df not in copy:
771 770 movewithdir[f] = df
772 771 repo.ui.debug((" pending file src: '%s' -> "
773 772 "dst: '%s'\n") % (f, df))
774 773 break
775 774
776 775 return copy, movewithdir, diverge, renamedelete, dirmove
777 776
778 777 def _heuristicscopytracing(repo, c1, c2, base):
779 778 """ Fast copytracing using filename heuristics
780 779
781 780 Assumes that moves or renames are of following two types:
782 781
783 782 1) Inside a directory only (same directory name but different filenames)
784 783 2) Move from one directory to another
785 784 (same filenames but different directory names)
786 785
787 786 Works only when there are no merge commits in the "source branch".
788 787 Source branch is commits from base up to c2 not including base.
789 788
790 789 If merge is involved it fallbacks to _fullcopytracing().
791 790
792 791 Can be used by setting the following config:
793 792
794 793 [experimental]
795 794 copytrace = heuristics
796 795
797 796 In some cases the copy/move candidates found by heuristics can be very large
798 797 in number and that will make the algorithm slow. The number of possible
799 798 candidates to check can be limited by using the config
800 799 `experimental.copytrace.movecandidateslimit` which defaults to 100.
801 800 """
802 801
803 802 if c1.rev() is None:
804 803 c1 = c1.p1()
805 804 if c2.rev() is None:
806 805 c2 = c2.p1()
807 806
808 807 copies = {}
809 808
810 809 changedfiles = set()
811 810 m1 = c1.manifest()
812 811 if not repo.revs('%d::%d', base.rev(), c2.rev()):
813 812 # If base is not in c2 branch, we switch to fullcopytracing
814 813 repo.ui.debug("switching to full copytracing as base is not "
815 814 "an ancestor of c2\n")
816 815 return _fullcopytracing(repo, c1, c2, base)
817 816
818 817 ctx = c2
819 818 while ctx != base:
820 819 if len(ctx.parents()) == 2:
821 820 # To keep things simple let's not handle merges
822 821 repo.ui.debug("switching to full copytracing because of merges\n")
823 822 return _fullcopytracing(repo, c1, c2, base)
824 823 changedfiles.update(ctx.files())
825 824 ctx = ctx.p1()
826 825
827 826 cp = _forwardcopies(base, c2)
828 827 for dst, src in cp.iteritems():
829 828 if src in m1:
830 829 copies[dst] = src
831 830
832 831 # file is missing if it isn't present in the destination, but is present in
833 832 # the base and present in the source.
834 833 # Presence in the base is important to exclude added files, presence in the
835 834 # source is important to exclude removed files.
836 835 filt = lambda f: f not in m1 and f in base and f in c2
837 836 missingfiles = [f for f in changedfiles if filt(f)]
838 837
839 838 if missingfiles:
840 839 basenametofilename = collections.defaultdict(list)
841 840 dirnametofilename = collections.defaultdict(list)
842 841
843 842 for f in m1.filesnotin(base.manifest()):
844 843 basename = os.path.basename(f)
845 844 dirname = os.path.dirname(f)
846 845 basenametofilename[basename].append(f)
847 846 dirnametofilename[dirname].append(f)
848 847
849 848 for f in missingfiles:
850 849 basename = os.path.basename(f)
851 850 dirname = os.path.dirname(f)
852 851 samebasename = basenametofilename[basename]
853 852 samedirname = dirnametofilename[dirname]
854 853 movecandidates = samebasename + samedirname
855 854 # f is guaranteed to be present in c2, that's why
856 855 # c2.filectx(f) won't fail
857 856 f2 = c2.filectx(f)
858 857 # we can have a lot of candidates which can slow down the heuristics
859 858 # config value to limit the number of candidates moves to check
860 859 maxcandidates = repo.ui.configint('experimental',
861 860 'copytrace.movecandidateslimit')
862 861
863 862 if len(movecandidates) > maxcandidates:
864 863 repo.ui.status(_("skipping copytracing for '%s', more "
865 864 "candidates than the limit: %d\n")
866 865 % (f, len(movecandidates)))
867 866 continue
868 867
869 868 for candidate in movecandidates:
870 869 f1 = c1.filectx(candidate)
871 870 if _related(f1, f2):
872 871 # if there are a few related copies then we'll merge
873 872 # changes into all of them. This matches the behaviour
874 873 # of upstream copytracing
875 874 copies[candidate] = f
876 875
877 876 return copies, {}, {}, {}, {}
878 877
879 878 def _related(f1, f2):
880 879 """return True if f1 and f2 filectx have a common ancestor
881 880
882 881 Walk back to common ancestor to see if the two files originate
883 882 from the same file. Since workingfilectx's rev() is None it messes
884 883 up the integer comparison logic, hence the pre-step check for
885 884 None (f1 and f2 can only be workingfilectx's initially).
886 885 """
887 886
888 887 if f1 == f2:
889 888 return True # a match
890 889
891 890 g1, g2 = f1.ancestors(), f2.ancestors()
892 891 try:
893 892 f1r, f2r = f1.linkrev(), f2.linkrev()
894 893
895 894 if f1r is None:
896 895 f1 = next(g1)
897 896 if f2r is None:
898 897 f2 = next(g2)
899 898
900 899 while True:
901 900 f1r, f2r = f1.linkrev(), f2.linkrev()
902 901 if f1r > f2r:
903 902 f1 = next(g1)
904 903 elif f2r > f1r:
905 904 f2 = next(g2)
906 905 else: # f1 and f2 point to files in the same linkrev
907 906 return f1 == f2 # true if they point to the same file
908 907 except StopIteration:
909 908 return False
910 909
911 910 def _checkcopies(srcctx, dstctx, f, base, tca, remotebase, limit, data):
912 911 """
913 912 check possible copies of f from msrc to mdst
914 913
915 914 srcctx = starting context for f in msrc
916 915 dstctx = destination context for f in mdst
917 916 f = the filename to check (as in msrc)
918 917 base = the changectx used as a merge base
919 918 tca = topological common ancestor for graft-like scenarios
920 919 remotebase = True if base is outside tca::srcctx, False otherwise
921 920 limit = the rev number to not search beyond
922 921 data = dictionary of dictionary to store copy data. (see mergecopies)
923 922
924 923 note: limit is only an optimization, and provides no guarantee that
925 924 irrelevant revisions will not be visited
926 925 there is no easy way to make this algorithm stop in a guaranteed way
927 926 once it "goes behind a certain revision".
928 927 """
929 928
930 929 msrc = srcctx.manifest()
931 930 mdst = dstctx.manifest()
932 931 mb = base.manifest()
933 932 mta = tca.manifest()
934 933 # Might be true if this call is about finding backward renames,
935 934 # This happens in the case of grafts because the DAG is then rotated.
936 935 # If the file exists in both the base and the source, we are not looking
937 936 # for a rename on the source side, but on the part of the DAG that is
938 937 # traversed backwards.
939 938 #
940 939 # In the case there is both backward and forward renames (before and after
941 940 # the base) this is more complicated as we must detect a divergence.
942 941 # We use 'backwards = False' in that case.
943 942 backwards = not remotebase and base != tca and f in mb
944 943 getsrcfctx = _makegetfctx(srcctx)
945 944 getdstfctx = _makegetfctx(dstctx)
946 945
947 946 if msrc[f] == mb.get(f) and not remotebase:
948 947 # Nothing to merge
949 948 return
950 949
951 950 of = None
952 951 seen = {f}
953 952 for oc in getsrcfctx(f, msrc[f]).ancestors():
954 953 of = oc.path()
955 954 if of in seen:
956 955 # check limit late - grab last rename before
957 956 if oc.linkrev() < limit:
958 957 break
959 958 continue
960 959 seen.add(of)
961 960
962 961 # remember for dir rename detection
963 962 if backwards:
964 963 data['fullcopy'][of] = f # grafting backwards through renames
965 964 else:
966 965 data['fullcopy'][f] = of
967 966 if of not in mdst:
968 967 continue # no match, keep looking
969 968 if mdst[of] == mb.get(of):
970 969 return # no merge needed, quit early
971 970 c2 = getdstfctx(of, mdst[of])
972 971 # c2 might be a plain new file on added on destination side that is
973 972 # unrelated to the droids we are looking for.
974 973 cr = _related(oc, c2)
975 974 if cr and (of == f or of == c2.path()): # non-divergent
976 975 if backwards:
977 976 data['copy'][of] = f
978 977 elif of in mb:
979 978 data['copy'][f] = of
980 979 elif remotebase: # special case: a <- b <- a -> b "ping-pong" rename
981 980 data['copy'][of] = f
982 981 del data['fullcopy'][f]
983 982 data['fullcopy'][of] = f
984 983 else: # divergence w.r.t. graft CA on one side of topological CA
985 984 for sf in seen:
986 985 if sf in mb:
987 986 assert sf not in data['diverge']
988 987 data['diverge'][sf] = [f, of]
989 988 break
990 989 return
991 990
992 991 if of in mta:
993 992 if backwards or remotebase:
994 993 data['incomplete'][of] = f
995 994 else:
996 995 for sf in seen:
997 996 if sf in mb:
998 997 if tca == base:
999 998 data['diverge'].setdefault(sf, []).append(f)
1000 999 else:
1001 1000 data['incompletediverge'][sf] = [of, f]
1002 1001 return
1003 1002
1004 1003 def duplicatecopies(repo, wctx, rev, fromrev, skiprev=None):
1005 1004 """reproduce copies from fromrev to rev in the dirstate
1006 1005
1007 1006 If skiprev is specified, it's a revision that should be used to
1008 1007 filter copy records. Any copies that occur between fromrev and
1009 1008 skiprev will not be duplicated, even if they appear in the set of
1010 1009 copies between fromrev and rev.
1011 1010 """
1012 1011 exclude = {}
1013 1012 ctraceconfig = repo.ui.config('experimental', 'copytrace')
1014 1013 bctrace = stringutil.parsebool(ctraceconfig)
1015 1014 if (skiprev is not None and
1016 1015 (ctraceconfig == 'heuristics' or bctrace or bctrace is None)):
1017 1016 # copytrace='off' skips this line, but not the entire function because
1018 1017 # the line below is O(size of the repo) during a rebase, while the rest
1019 1018 # of the function is much faster (and is required for carrying copy
1020 1019 # metadata across the rebase anyway).
1021 1020 exclude = pathcopies(repo[fromrev], repo[skiprev])
1022 1021 for dst, src in pathcopies(repo[fromrev], repo[rev]).iteritems():
1023 1022 # copies.pathcopies returns backward renames, so dst might not
1024 1023 # actually be in the dirstate
1025 1024 if dst in exclude:
1026 1025 continue
1027 1026 wctx[dst].markcopied(src)
@@ -1,172 +1,171 b''
1 1 Test for the full copytracing algorithm
2 2 =======================================
3 3
4 4 $ hg init t
5 5 $ cd t
6 6
7 7 $ echo 1 > a
8 8 $ hg ci -qAm "first"
9 9
10 10 $ hg cp a b
11 11 $ hg mv a c
12 12 $ echo 2 >> b
13 13 $ echo 2 >> c
14 14
15 15 $ hg ci -qAm "second"
16 16
17 17 $ hg co -C 0
18 18 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
19 19
20 20 $ echo 0 > a
21 21 $ echo 1 >> a
22 22
23 23 $ hg ci -qAm "other"
24 24
25 25 $ hg merge --debug
26 searching for copies back to rev 1
27 26 unmatched files in other:
28 27 b
29 28 c
30 29 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
31 30 src: 'a' -> dst: 'b' *
32 31 src: 'a' -> dst: 'c' *
33 32 checking for directory renames
34 33 resolving manifests
35 34 branchmerge: True, force: False, partial: False
36 35 ancestor: b8bf91eeebbc, local: add3f11052fa+, remote: 17c05bb7fcb6
37 36 preserving a for resolve of b
38 37 preserving a for resolve of c
39 38 removing a
40 39 starting 4 threads for background file closing (?)
41 40 b: remote moved from a -> m (premerge)
42 41 picked tool ':merge' for b (binary False symlink False changedelete False)
43 42 merging a and b to b
44 43 my b@add3f11052fa+ other b@17c05bb7fcb6 ancestor a@b8bf91eeebbc
45 44 premerge successful
46 45 c: remote moved from a -> m (premerge)
47 46 picked tool ':merge' for c (binary False symlink False changedelete False)
48 47 merging a and c to c
49 48 my c@add3f11052fa+ other c@17c05bb7fcb6 ancestor a@b8bf91eeebbc
50 49 premerge successful
51 50 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
52 51 (branch merge, don't forget to commit)
53 52
54 53 file b
55 54 $ cat b
56 55 0
57 56 1
58 57 2
59 58
60 59 file c
61 60 $ cat c
62 61 0
63 62 1
64 63 2
65 64
66 65 Test disabling copy tracing
67 66
68 67 - first verify copy metadata was kept
69 68
70 69 $ hg up -qC 2
71 70 $ hg rebase --keep -d 1 -b 2 --config extensions.rebase=
72 71 rebasing 2:add3f11052fa "other" (tip)
73 72 merging b and a to b
74 73 merging c and a to c
75 74
76 75 $ cat b
77 76 0
78 77 1
79 78 2
80 79
81 80 - next verify copy metadata is lost when disabled
82 81
83 82 $ hg strip -r . --config extensions.strip=
84 83 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
85 84 saved backup bundle to $TESTTMP/t/.hg/strip-backup/550bd84c0cd3-fc575957-backup.hg
86 85 $ hg up -qC 2
87 86 $ hg rebase --keep -d 1 -b 2 --config extensions.rebase= --config experimental.copytrace=off --config ui.interactive=True << EOF
88 87 > c
89 88 > EOF
90 89 rebasing 2:add3f11052fa "other" (tip)
91 90 file 'a' was deleted in local [dest] but was modified in other [source].
92 91 What do you want to do?
93 92 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? c
94 93
95 94 $ cat b
96 95 1
97 96 2
98 97
99 98 $ cd ..
100 99
101 100 Verify disabling copy tracing still keeps copies from rebase source
102 101
103 102 $ hg init copydisable
104 103 $ cd copydisable
105 104 $ touch a
106 105 $ hg ci -Aqm 'add a'
107 106 $ touch b
108 107 $ hg ci -Aqm 'add b, c'
109 108 $ hg cp b x
110 109 $ echo x >> x
111 110 $ hg ci -qm 'copy b->x'
112 111 $ hg up -q 1
113 112 $ touch z
114 113 $ hg ci -Aqm 'add z'
115 114 $ hg log -G -T '{rev} {desc}\n'
116 115 @ 3 add z
117 116 |
118 117 | o 2 copy b->x
119 118 |/
120 119 o 1 add b, c
121 120 |
122 121 o 0 add a
123 122
124 123 $ hg rebase -d . -b 2 --config extensions.rebase= --config experimental.copytrace=off
125 124 rebasing 2:6adcf8c12e7d "copy b->x"
126 125 saved backup bundle to $TESTTMP/copydisable/.hg/strip-backup/6adcf8c12e7d-ce4b3e75-rebase.hg
127 126 $ hg up -q 3
128 127 $ hg log -f x -T '{rev} {desc}\n'
129 128 3 copy b->x
130 129 1 add b, c
131 130
132 131 $ cd ../
133 132
134 133 Verify we duplicate existing copies, instead of detecting them
135 134
136 135 $ hg init copydisable3
137 136 $ cd copydisable3
138 137 $ touch a
139 138 $ hg ci -Aqm 'add a'
140 139 $ hg cp a b
141 140 $ hg ci -Aqm 'copy a->b'
142 141 $ hg mv b c
143 142 $ hg ci -Aqm 'move b->c'
144 143 $ hg up -q 0
145 144 $ hg cp a b
146 145 $ echo b >> b
147 146 $ hg ci -Aqm 'copy a->b (2)'
148 147 $ hg log -G -T '{rev} {desc}\n'
149 148 @ 3 copy a->b (2)
150 149 |
151 150 | o 2 move b->c
152 151 | |
153 152 | o 1 copy a->b
154 153 |/
155 154 o 0 add a
156 155
157 156 $ hg rebase -d 2 -s 3 --config extensions.rebase= --config experimental.copytrace=off
158 157 rebasing 3:47e1a9e6273b "copy a->b (2)" (tip)
159 158 saved backup bundle to $TESTTMP/copydisable3/.hg/strip-backup/47e1a9e6273b-2d099c59-rebase.hg
160 159
161 160 $ hg log -G -f b
162 161 @ changeset: 3:76024fb4b05b
163 162 : tag: tip
164 163 : user: test
165 164 : date: Thu Jan 01 00:00:00 1970 +0000
166 165 : summary: copy a->b (2)
167 166 :
168 167 o changeset: 0:ac82d8b1f7c4
169 168 user: test
170 169 date: Thu Jan 01 00:00:00 1970 +0000
171 170 summary: add a
172 171
@@ -1,66 +1,65 b''
1 1 $ hg init repo
2 2 $ cd repo
3 3
4 4 $ echo line 1 > foo
5 5 $ hg ci -qAm 'add foo'
6 6
7 7 copy foo to bar and change both files
8 8 $ hg cp foo bar
9 9 $ echo line 2-1 >> foo
10 10 $ echo line 2-2 >> bar
11 11 $ hg ci -m 'cp foo bar; change both'
12 12
13 13 in another branch, change foo in a way that doesn't conflict with
14 14 the other changes
15 15 $ hg up -qC 0
16 16 $ echo line 0 > foo
17 17 $ hg cat foo >> foo
18 18 $ hg ci -m 'change foo'
19 19 created new head
20 20
21 21 we get conflicts that shouldn't be there
22 22 $ hg merge -P
23 23 changeset: 1:484bf6903104
24 24 user: test
25 25 date: Thu Jan 01 00:00:00 1970 +0000
26 26 summary: cp foo bar; change both
27 27
28 28 $ hg merge --debug
29 searching for copies back to rev 1
30 29 unmatched files in other:
31 30 bar
32 31 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
33 32 src: 'foo' -> dst: 'bar' *
34 33 checking for directory renames
35 34 resolving manifests
36 35 branchmerge: True, force: False, partial: False
37 36 ancestor: e6dc8efe11cc, local: 6a0df1dad128+, remote: 484bf6903104
38 37 preserving foo for resolve of bar
39 38 preserving foo for resolve of foo
40 39 starting 4 threads for background file closing (?)
41 40 bar: remote copied from foo -> m (premerge)
42 41 picked tool ':merge' for bar (binary False symlink False changedelete False)
43 42 merging foo and bar to bar
44 43 my bar@6a0df1dad128+ other bar@484bf6903104 ancestor foo@e6dc8efe11cc
45 44 premerge successful
46 45 foo: versions differ -> m (premerge)
47 46 picked tool ':merge' for foo (binary False symlink False changedelete False)
48 47 merging foo
49 48 my foo@6a0df1dad128+ other foo@484bf6903104 ancestor foo@e6dc8efe11cc
50 49 premerge successful
51 50 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
52 51 (branch merge, don't forget to commit)
53 52
54 53 contents of foo
55 54 $ cat foo
56 55 line 0
57 56 line 1
58 57 line 2-1
59 58
60 59 contents of bar
61 60 $ cat bar
62 61 line 0
63 62 line 1
64 63 line 2-2
65 64
66 65 $ cd ..
@@ -1,2415 +1,2411 b''
1 1 $ cat >> $HGRCPATH <<EOF
2 2 > [extdiff]
3 3 > # for portability:
4 4 > pdiff = sh "$RUNTESTDIR/pdiff"
5 5 > EOF
6 6
7 7 Create a repo with some stuff in it:
8 8
9 9 $ hg init a
10 10 $ cd a
11 11 $ echo a > a
12 12 $ echo a > d
13 13 $ echo a > e
14 14 $ hg ci -qAm0
15 15 $ echo b > a
16 16 $ hg ci -m1 -u bar
17 17 $ hg mv a b
18 18 $ hg ci -m2
19 19 $ hg cp b c
20 20 $ hg ci -m3 -u baz
21 21 $ echo b > d
22 22 $ echo f > e
23 23 $ hg ci -m4
24 24 $ hg up -q 3
25 25 $ echo b > e
26 26 $ hg branch -q stable
27 27 $ hg ci -m5
28 28 $ hg merge -q default --tool internal:local # for conflicts in e, choose 5 and ignore 4
29 29 $ hg branch -q default
30 30 $ hg ci -m6
31 31 $ hg phase --public 3
32 32 $ hg phase --force --secret 6
33 33
34 34 $ hg log -G --template '{author}@{rev}.{phase}: {desc}\n'
35 35 @ test@6.secret: 6
36 36 |\
37 37 | o test@5.draft: 5
38 38 | |
39 39 o | test@4.draft: 4
40 40 |/
41 41 o baz@3.public: 3
42 42 |
43 43 o test@2.public: 2
44 44 |
45 45 o bar@1.public: 1
46 46 |
47 47 o test@0.public: 0
48 48
49 49 Test --base for grafting the merge of 4 from the perspective of 5, thus only getting the change to d
50 50
51 51 $ hg up -cqr 3
52 52 $ hg graft -r 6 --base 5
53 53 grafting 6:25a2b029d3ae "6" (tip)
54 54 merging e
55 55 $ hg st --change .
56 56 M d
57 57
58 58 $ hg -q strip . --config extensions.strip=
59 59
60 60 Test --base for collapsing changesets 2 and 3, thus getting both b and c
61 61
62 62 $ hg up -cqr 0
63 63 $ hg graft -r 3 --base 1
64 64 grafting 3:4c60f11aa304 "3"
65 65 merging a and b to b
66 66 merging a and c to c
67 67 $ hg st --change .
68 68 A b
69 69 A c
70 70 R a
71 71
72 72 $ hg -q strip . --config extensions.strip=
73 73
74 74 Specifying child as --base revision fails safely (perhaps slightly confusing, but consistent)
75 75
76 76 $ hg graft -r 2 --base 3
77 77 grafting 2:5c095ad7e90f "2"
78 78 note: graft of 2:5c095ad7e90f created no changes to commit
79 79
80 80 Can't continue without starting:
81 81
82 82 $ hg -q up -cr tip
83 83 $ hg rm -q e
84 84 $ hg graft --continue
85 85 abort: no graft in progress
86 86 [255]
87 87 $ hg revert -r . -q e
88 88
89 89 Need to specify a rev:
90 90
91 91 $ hg graft
92 92 abort: no revisions specified
93 93 [255]
94 94
95 95 Can't graft ancestor:
96 96
97 97 $ hg graft 1 2
98 98 skipping ancestor revision 1:5d205f8b35b6
99 99 skipping ancestor revision 2:5c095ad7e90f
100 100 [255]
101 101
102 102 Specify revisions with -r:
103 103
104 104 $ hg graft -r 1 -r 2
105 105 skipping ancestor revision 1:5d205f8b35b6
106 106 skipping ancestor revision 2:5c095ad7e90f
107 107 [255]
108 108
109 109 $ hg graft -r 1 2
110 110 warning: inconsistent use of --rev might give unexpected revision ordering!
111 111 skipping ancestor revision 2:5c095ad7e90f
112 112 skipping ancestor revision 1:5d205f8b35b6
113 113 [255]
114 114
115 115 Conflicting date/user options:
116 116
117 117 $ hg up -q 0
118 118 $ hg graft -U --user foo 2
119 119 abort: --user and --currentuser are mutually exclusive
120 120 [255]
121 121 $ hg graft -D --date '0 0' 2
122 122 abort: --date and --currentdate are mutually exclusive
123 123 [255]
124 124
125 125 Can't graft with dirty wd:
126 126
127 127 $ hg up -q 0
128 128 $ echo foo > a
129 129 $ hg graft 1
130 130 abort: uncommitted changes
131 131 [255]
132 132 $ hg revert a
133 133
134 134 Graft a rename:
135 135 (this also tests that editor is invoked if '--edit' is specified)
136 136
137 137 $ hg status --rev "2^1" --rev 2
138 138 A b
139 139 R a
140 140 $ HGEDITOR=cat hg graft 2 -u foo --edit
141 141 grafting 2:5c095ad7e90f "2"
142 142 merging a and b to b
143 143 2
144 144
145 145
146 146 HG: Enter commit message. Lines beginning with 'HG:' are removed.
147 147 HG: Leave message empty to abort commit.
148 148 HG: --
149 149 HG: user: foo
150 150 HG: branch 'default'
151 151 HG: added b
152 152 HG: removed a
153 153 $ hg export tip --git
154 154 # HG changeset patch
155 155 # User foo
156 156 # Date 0 0
157 157 # Thu Jan 01 00:00:00 1970 +0000
158 158 # Node ID ef0ef43d49e79e81ddafdc7997401ba0041efc82
159 159 # Parent 68795b066622ca79a25816a662041d8f78f3cd9e
160 160 2
161 161
162 162 diff --git a/a b/b
163 163 rename from a
164 164 rename to b
165 165
166 166 Look for extra:source
167 167
168 168 $ hg log --debug -r tip
169 169 changeset: 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82
170 170 tag: tip
171 171 phase: draft
172 172 parent: 0:68795b066622ca79a25816a662041d8f78f3cd9e
173 173 parent: -1:0000000000000000000000000000000000000000
174 174 manifest: 7:e59b6b228f9cbf9903d5e9abf996e083a1f533eb
175 175 user: foo
176 176 date: Thu Jan 01 00:00:00 1970 +0000
177 177 files+: b
178 178 files-: a
179 179 extra: branch=default
180 180 extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4
181 181 description:
182 182 2
183 183
184 184
185 185
186 186 Graft out of order, skipping a merge and a duplicate
187 187 (this also tests that editor is not invoked if '--edit' is not specified)
188 188
189 189 $ hg graft 1 5 4 3 'merge()' 2 -n
190 190 skipping ungraftable merge revision 6
191 191 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
192 192 grafting 1:5d205f8b35b6 "1"
193 193 grafting 5:97f8bfe72746 "5"
194 194 grafting 4:9c233e8e184d "4"
195 195 grafting 3:4c60f11aa304 "3"
196 196
197 197 $ HGEDITOR=cat hg graft 1 5 'merge()' 2 --debug
198 198 skipping ungraftable merge revision 6
199 199 scanning for duplicate grafts
200 200 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
201 201 grafting 1:5d205f8b35b6 "1"
202 searching for copies back to rev 1
203 202 unmatched files in local:
204 203 b
205 204 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
206 205 src: 'a' -> dst: 'b' *
207 206 checking for directory renames
208 207 resolving manifests
209 208 branchmerge: True, force: True, partial: False
210 209 ancestor: 68795b066622, local: ef0ef43d49e7+, remote: 5d205f8b35b6
211 210 preserving b for resolve of b
212 211 starting 4 threads for background file closing (?)
213 212 b: local copied/moved from a -> m (premerge)
214 213 picked tool ':merge' for b (binary False symlink False changedelete False)
215 214 merging b and a to b
216 215 my b@ef0ef43d49e7+ other a@5d205f8b35b6 ancestor a@68795b066622
217 216 premerge successful
218 217 committing files:
219 218 b
220 219 committing manifest
221 220 committing changelog
222 221 updating the branch cache
223 222 grafting 5:97f8bfe72746 "5"
224 searching for copies back to rev 1
225 223 unmatched files in other (from topological common ancestor):
226 224 c
227 225 resolving manifests
228 226 branchmerge: True, force: True, partial: False
229 227 ancestor: 4c60f11aa304, local: 6b9e5368ca4e+, remote: 97f8bfe72746
230 228 e: remote is newer -> g
231 229 getting e
232 230 committing files:
233 231 e
234 232 committing manifest
235 233 committing changelog
236 234 updating the branch cache
237 235 $ HGEDITOR=cat hg graft 4 3 --log --debug
238 236 scanning for duplicate grafts
239 237 grafting 4:9c233e8e184d "4"
240 searching for copies back to rev 1
241 238 unmatched files in other (from topological common ancestor):
242 239 c
243 240 resolving manifests
244 241 branchmerge: True, force: True, partial: False
245 242 ancestor: 4c60f11aa304, local: 1905859650ec+, remote: 9c233e8e184d
246 243 preserving e for resolve of e
247 244 d: remote is newer -> g
248 245 getting d
249 246 e: versions differ -> m (premerge)
250 247 picked tool ':merge' for e (binary False symlink False changedelete False)
251 248 merging e
252 249 my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304
253 250 e: versions differ -> m (merge)
254 251 picked tool ':merge' for e (binary False symlink False changedelete False)
255 252 my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304
256 253 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
257 254 abort: unresolved conflicts, can't continue
258 255 (use 'hg resolve' and 'hg graft --continue')
259 256 [255]
260 257
261 258 Summary should mention graft:
262 259
263 260 $ hg summary |grep graft
264 261 commit: 2 modified, 2 unknown, 1 unresolved (graft in progress)
265 262
266 263 Using status to get more context
267 264
268 265 $ hg status --verbose
269 266 M d
270 267 M e
271 268 ? a.orig
272 269 ? e.orig
273 270 # The repository is in an unfinished *graft* state.
274 271
275 272 # Unresolved merge conflicts:
276 273 #
277 274 # e
278 275 #
279 276 # To mark files as resolved: hg resolve --mark FILE
280 277
281 278 # To continue: hg graft --continue
282 279 # To abort: hg graft --abort
283 280
284 281
285 282 Commit while interrupted should fail:
286 283
287 284 $ hg ci -m 'commit interrupted graft'
288 285 abort: graft in progress
289 286 (use 'hg graft --continue' or 'hg graft --stop' to stop)
290 287 [255]
291 288
292 289 Abort the graft and try committing:
293 290
294 291 $ hg up -C .
295 292 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
296 293 $ echo c >> e
297 294 $ hg ci -mtest
298 295
299 296 $ hg strip . --config extensions.strip=
300 297 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
301 298 saved backup bundle to $TESTTMP/a/.hg/strip-backup/*-backup.hg (glob)
302 299
303 300 Graft again:
304 301
305 302 $ hg graft 1 5 4 3 'merge()' 2
306 303 skipping ungraftable merge revision 6
307 304 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
308 305 skipping revision 1:5d205f8b35b6 (already grafted to 8:6b9e5368ca4e)
309 306 skipping revision 5:97f8bfe72746 (already grafted to 9:1905859650ec)
310 307 grafting 4:9c233e8e184d "4"
311 308 merging e
312 309 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
313 310 abort: unresolved conflicts, can't continue
314 311 (use 'hg resolve' and 'hg graft --continue')
315 312 [255]
316 313
317 314 Continue without resolve should fail:
318 315
319 316 $ hg graft -c
320 317 grafting 4:9c233e8e184d "4"
321 318 abort: unresolved merge conflicts (see 'hg help resolve')
322 319 [255]
323 320
324 321 Fix up:
325 322
326 323 $ echo b > e
327 324 $ hg resolve -m e
328 325 (no more unresolved files)
329 326 continue: hg graft --continue
330 327
331 328 Continue with a revision should fail:
332 329
333 330 $ hg graft -c 6
334 331 abort: can't specify --continue and revisions
335 332 [255]
336 333
337 334 $ hg graft -c -r 6
338 335 abort: can't specify --continue and revisions
339 336 [255]
340 337
341 338 Continue for real, clobber usernames
342 339
343 340 $ hg graft -c -U
344 341 grafting 4:9c233e8e184d "4"
345 342 grafting 3:4c60f11aa304 "3"
346 343
347 344 Compare with original:
348 345
349 346 $ hg diff -r 6
350 347 $ hg status --rev 0:. -C
351 348 M d
352 349 M e
353 350 A b
354 351 a
355 352 A c
356 353 a
357 354 R a
358 355
359 356 View graph:
360 357
361 358 $ hg log -G --template '{author}@{rev}.{phase}: {desc}\n'
362 359 @ test@11.draft: 3
363 360 |
364 361 o test@10.draft: 4
365 362 |
366 363 o test@9.draft: 5
367 364 |
368 365 o bar@8.draft: 1
369 366 |
370 367 o foo@7.draft: 2
371 368 |
372 369 | o test@6.secret: 6
373 370 | |\
374 371 | | o test@5.draft: 5
375 372 | | |
376 373 | o | test@4.draft: 4
377 374 | |/
378 375 | o baz@3.public: 3
379 376 | |
380 377 | o test@2.public: 2
381 378 | |
382 379 | o bar@1.public: 1
383 380 |/
384 381 o test@0.public: 0
385 382
386 383 Graft again onto another branch should preserve the original source
387 384 $ hg up -q 0
388 385 $ echo 'g'>g
389 386 $ hg add g
390 387 $ hg ci -m 7
391 388 created new head
392 389 $ hg graft 7
393 390 grafting 7:ef0ef43d49e7 "2"
394 391
395 392 $ hg log -r 7 --template '{rev}:{node}\n'
396 393 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82
397 394 $ hg log -r 2 --template '{rev}:{node}\n'
398 395 2:5c095ad7e90f871700f02dd1fa5012cb4498a2d4
399 396
400 397 $ hg log --debug -r tip
401 398 changeset: 13:7a4785234d87ec1aa420ed6b11afe40fa73e12a9
402 399 tag: tip
403 400 phase: draft
404 401 parent: 12:b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
405 402 parent: -1:0000000000000000000000000000000000000000
406 403 manifest: 13:dc313617b8c32457c0d589e0dbbedfe71f3cd637
407 404 user: foo
408 405 date: Thu Jan 01 00:00:00 1970 +0000
409 406 files+: b
410 407 files-: a
411 408 extra: branch=default
412 409 extra: intermediate-source=ef0ef43d49e79e81ddafdc7997401ba0041efc82
413 410 extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4
414 411 description:
415 412 2
416 413
417 414
418 415 Disallow grafting an already grafted cset onto its original branch
419 416 $ hg up -q 6
420 417 $ hg graft 7
421 418 skipping already grafted revision 7:ef0ef43d49e7 (was grafted from 2:5c095ad7e90f)
422 419 [255]
423 420
424 421 $ hg pdiff --config extensions.extdiff= --patch -r 2 -r 13
425 422 --- */hg-5c095ad7e90f.patch * (glob)
426 423 +++ */hg-7a4785234d87.patch * (glob)
427 424 @@ -1,18 +1,18 @@
428 425 # HG changeset patch
429 426 -# User test
430 427 +# User foo
431 428 # Date 0 0
432 429 # Thu Jan 01 00:00:00 1970 +0000
433 430 -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4
434 431 -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04
435 432 +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9
436 433 +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
437 434 2
438 435
439 436 -diff -r 5d205f8b35b6 -r 5c095ad7e90f a
440 437 +diff -r b592ea63bb0c -r 7a4785234d87 a
441 438 --- a/a Thu Jan 01 00:00:00 1970 +0000
442 439 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
443 440 @@ -1,1 +0,0 @@
444 441 --b
445 442 -diff -r 5d205f8b35b6 -r 5c095ad7e90f b
446 443 +-a
447 444 +diff -r b592ea63bb0c -r 7a4785234d87 b
448 445 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
449 446 +++ b/b Thu Jan 01 00:00:00 1970 +0000
450 447 @@ -0,0 +1,1 @@
451 448 -+b
452 449 ++a
453 450 [1]
454 451
455 452 $ hg pdiff --config extensions.extdiff= --patch -r 2 -r 13 -X .
456 453 --- */hg-5c095ad7e90f.patch * (glob)
457 454 +++ */hg-7a4785234d87.patch * (glob)
458 455 @@ -1,8 +1,8 @@
459 456 # HG changeset patch
460 457 -# User test
461 458 +# User foo
462 459 # Date 0 0
463 460 # Thu Jan 01 00:00:00 1970 +0000
464 461 -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4
465 462 -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04
466 463 +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9
467 464 +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
468 465 2
469 466
470 467 [1]
471 468
472 469 Disallow grafting already grafted csets with the same origin onto each other
473 470 $ hg up -q 13
474 471 $ hg graft 2
475 472 skipping revision 2:5c095ad7e90f (already grafted to 13:7a4785234d87)
476 473 [255]
477 474 $ hg graft 7
478 475 skipping already grafted revision 7:ef0ef43d49e7 (13:7a4785234d87 also has origin 2:5c095ad7e90f)
479 476 [255]
480 477
481 478 $ hg up -q 7
482 479 $ hg graft 2
483 480 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
484 481 [255]
485 482 $ hg graft tip
486 483 skipping already grafted revision 13:7a4785234d87 (7:ef0ef43d49e7 also has origin 2:5c095ad7e90f)
487 484 [255]
488 485
489 486 Graft with --log
490 487
491 488 $ hg up -Cq 1
492 489 $ hg graft 3 --log -u foo
493 490 grafting 3:4c60f11aa304 "3"
494 491 warning: can't find ancestor for 'c' copied from 'b'!
495 492 $ hg log --template '{rev}:{node|short} {parents} {desc}\n' -r tip
496 493 14:0c921c65ef1e 1:5d205f8b35b6 3
497 494 (grafted from 4c60f11aa304a54ae1c199feb94e7fc771e51ed8)
498 495
499 496 Resolve conflicted graft
500 497 $ hg up -q 0
501 498 $ echo b > a
502 499 $ hg ci -m 8
503 500 created new head
504 501 $ echo c > a
505 502 $ hg ci -m 9
506 503 $ hg graft 1 --tool internal:fail
507 504 grafting 1:5d205f8b35b6 "1"
508 505 abort: unresolved conflicts, can't continue
509 506 (use 'hg resolve' and 'hg graft --continue')
510 507 [255]
511 508 $ hg resolve --all
512 509 merging a
513 510 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
514 511 [1]
515 512 $ cat a
516 513 <<<<<<< local: aaa4406d4f0a - test: 9
517 514 c
518 515 =======
519 516 b
520 517 >>>>>>> graft: 5d205f8b35b6 - bar: 1
521 518 $ echo b > a
522 519 $ hg resolve -m a
523 520 (no more unresolved files)
524 521 continue: hg graft --continue
525 522 $ hg graft -c
526 523 grafting 1:5d205f8b35b6 "1"
527 524 $ hg export tip --git
528 525 # HG changeset patch
529 526 # User bar
530 527 # Date 0 0
531 528 # Thu Jan 01 00:00:00 1970 +0000
532 529 # Node ID f67661df0c4804d301f064f332b57e7d5ddaf2be
533 530 # Parent aaa4406d4f0ae9befd6e58c82ec63706460cbca6
534 531 1
535 532
536 533 diff --git a/a b/a
537 534 --- a/a
538 535 +++ b/a
539 536 @@ -1,1 +1,1 @@
540 537 -c
541 538 +b
542 539
543 540 Resolve conflicted graft with rename
544 541 $ echo c > a
545 542 $ hg ci -m 10
546 543 $ hg graft 2 --tool internal:fail
547 544 grafting 2:5c095ad7e90f "2"
548 545 abort: unresolved conflicts, can't continue
549 546 (use 'hg resolve' and 'hg graft --continue')
550 547 [255]
551 548 $ hg resolve --all
552 549 merging a and b to b
553 550 (no more unresolved files)
554 551 continue: hg graft --continue
555 552 $ hg graft -c
556 553 grafting 2:5c095ad7e90f "2"
557 554 $ hg export tip --git
558 555 # HG changeset patch
559 556 # User test
560 557 # Date 0 0
561 558 # Thu Jan 01 00:00:00 1970 +0000
562 559 # Node ID 9627f653b421c61fc1ea4c4e366745070fa3d2bc
563 560 # Parent ee295f490a40b97f3d18dd4c4f1c8936c233b612
564 561 2
565 562
566 563 diff --git a/a b/b
567 564 rename from a
568 565 rename to b
569 566
570 567 Test simple origin(), with and without args
571 568 $ hg log -r 'origin()'
572 569 changeset: 1:5d205f8b35b6
573 570 user: bar
574 571 date: Thu Jan 01 00:00:00 1970 +0000
575 572 summary: 1
576 573
577 574 changeset: 2:5c095ad7e90f
578 575 user: test
579 576 date: Thu Jan 01 00:00:00 1970 +0000
580 577 summary: 2
581 578
582 579 changeset: 3:4c60f11aa304
583 580 user: baz
584 581 date: Thu Jan 01 00:00:00 1970 +0000
585 582 summary: 3
586 583
587 584 changeset: 4:9c233e8e184d
588 585 user: test
589 586 date: Thu Jan 01 00:00:00 1970 +0000
590 587 summary: 4
591 588
592 589 changeset: 5:97f8bfe72746
593 590 branch: stable
594 591 parent: 3:4c60f11aa304
595 592 user: test
596 593 date: Thu Jan 01 00:00:00 1970 +0000
597 594 summary: 5
598 595
599 596 $ hg log -r 'origin(7)'
600 597 changeset: 2:5c095ad7e90f
601 598 user: test
602 599 date: Thu Jan 01 00:00:00 1970 +0000
603 600 summary: 2
604 601
605 602 Now transplant a graft to test following through copies
606 603 $ hg up -q 0
607 604 $ hg branch -q dev
608 605 $ hg ci -qm "dev branch"
609 606 $ hg --config extensions.transplant= transplant -q 7
610 607 $ hg log -r 'origin(.)'
611 608 changeset: 2:5c095ad7e90f
612 609 user: test
613 610 date: Thu Jan 01 00:00:00 1970 +0000
614 611 summary: 2
615 612
616 613 Test that the graft and transplant markers in extra are converted, allowing
617 614 origin() to still work. Note that these recheck the immediately preceeding two
618 615 tests.
619 616 $ hg --quiet --config extensions.convert= --config convert.hg.saverev=True convert . ../converted
620 617
621 618 The graft case
622 619 $ hg -R ../converted log -r 7 --template "{rev}: {node}\n{join(extras, '\n')}\n"
623 620 7: 7ae846e9111fc8f57745634250c7b9ac0a60689b
624 621 branch=default
625 622 convert_revision=ef0ef43d49e79e81ddafdc7997401ba0041efc82
626 623 source=e0213322b2c1a5d5d236c74e79666441bee67a7d
627 624 $ hg -R ../converted log -r 'origin(7)'
628 625 changeset: 2:e0213322b2c1
629 626 user: test
630 627 date: Thu Jan 01 00:00:00 1970 +0000
631 628 summary: 2
632 629
633 630 Test that template correctly expands more than one 'extra' (issue4362), and that
634 631 'intermediate-source' is converted.
635 632 $ hg -R ../converted log -r 13 --template "{extras % ' Extra: {extra}\n'}"
636 633 Extra: branch=default
637 634 Extra: convert_revision=7a4785234d87ec1aa420ed6b11afe40fa73e12a9
638 635 Extra: intermediate-source=7ae846e9111fc8f57745634250c7b9ac0a60689b
639 636 Extra: source=e0213322b2c1a5d5d236c74e79666441bee67a7d
640 637
641 638 The transplant case
642 639 $ hg -R ../converted log -r tip --template "{rev}: {node}\n{join(extras, '\n')}\n"
643 640 21: fbb6c5cc81002f2b4b49c9d731404688bcae5ade
644 641 branch=dev
645 642 convert_revision=7e61b508e709a11d28194a5359bc3532d910af21
646 643 transplant_source=z\xe8F\xe9\x11\x1f\xc8\xf5wEcBP\xc7\xb9\xac\n`h\x9b
647 644 $ hg -R ../converted log -r 'origin(tip)'
648 645 changeset: 2:e0213322b2c1
649 646 user: test
650 647 date: Thu Jan 01 00:00:00 1970 +0000
651 648 summary: 2
652 649
653 650
654 651 Test simple destination
655 652 $ hg log -r 'destination()'
656 653 changeset: 7:ef0ef43d49e7
657 654 parent: 0:68795b066622
658 655 user: foo
659 656 date: Thu Jan 01 00:00:00 1970 +0000
660 657 summary: 2
661 658
662 659 changeset: 8:6b9e5368ca4e
663 660 user: bar
664 661 date: Thu Jan 01 00:00:00 1970 +0000
665 662 summary: 1
666 663
667 664 changeset: 9:1905859650ec
668 665 user: test
669 666 date: Thu Jan 01 00:00:00 1970 +0000
670 667 summary: 5
671 668
672 669 changeset: 10:52dc0b4c6907
673 670 user: test
674 671 date: Thu Jan 01 00:00:00 1970 +0000
675 672 summary: 4
676 673
677 674 changeset: 11:882b35362a6b
678 675 user: test
679 676 date: Thu Jan 01 00:00:00 1970 +0000
680 677 summary: 3
681 678
682 679 changeset: 13:7a4785234d87
683 680 user: foo
684 681 date: Thu Jan 01 00:00:00 1970 +0000
685 682 summary: 2
686 683
687 684 changeset: 14:0c921c65ef1e
688 685 parent: 1:5d205f8b35b6
689 686 user: foo
690 687 date: Thu Jan 01 00:00:00 1970 +0000
691 688 summary: 3
692 689
693 690 changeset: 17:f67661df0c48
694 691 user: bar
695 692 date: Thu Jan 01 00:00:00 1970 +0000
696 693 summary: 1
697 694
698 695 changeset: 19:9627f653b421
699 696 user: test
700 697 date: Thu Jan 01 00:00:00 1970 +0000
701 698 summary: 2
702 699
703 700 changeset: 21:7e61b508e709
704 701 branch: dev
705 702 tag: tip
706 703 user: foo
707 704 date: Thu Jan 01 00:00:00 1970 +0000
708 705 summary: 2
709 706
710 707 $ hg log -r 'destination(2)'
711 708 changeset: 7:ef0ef43d49e7
712 709 parent: 0:68795b066622
713 710 user: foo
714 711 date: Thu Jan 01 00:00:00 1970 +0000
715 712 summary: 2
716 713
717 714 changeset: 13:7a4785234d87
718 715 user: foo
719 716 date: Thu Jan 01 00:00:00 1970 +0000
720 717 summary: 2
721 718
722 719 changeset: 19:9627f653b421
723 720 user: test
724 721 date: Thu Jan 01 00:00:00 1970 +0000
725 722 summary: 2
726 723
727 724 changeset: 21:7e61b508e709
728 725 branch: dev
729 726 tag: tip
730 727 user: foo
731 728 date: Thu Jan 01 00:00:00 1970 +0000
732 729 summary: 2
733 730
734 731 Transplants of grafts can find a destination...
735 732 $ hg log -r 'destination(7)'
736 733 changeset: 21:7e61b508e709
737 734 branch: dev
738 735 tag: tip
739 736 user: foo
740 737 date: Thu Jan 01 00:00:00 1970 +0000
741 738 summary: 2
742 739
743 740 ... grafts of grafts unfortunately can't
744 741 $ hg graft -q 13 --debug
745 742 scanning for duplicate grafts
746 743 grafting 13:7a4785234d87 "2"
747 searching for copies back to rev 12
748 744 unmatched files in other (from topological common ancestor):
749 745 g
750 746 unmatched files new in both:
751 747 b
752 748 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
753 749 src: 'a' -> dst: 'b' *
754 750 checking for directory renames
755 751 resolving manifests
756 752 branchmerge: True, force: True, partial: False
757 753 ancestor: b592ea63bb0c, local: 7e61b508e709+, remote: 7a4785234d87
758 754 starting 4 threads for background file closing (?)
759 755 committing files:
760 756 b
761 757 warning: can't find ancestor for 'b' copied from 'a'!
762 758 reusing manifest form p1 (listed files actually unchanged)
763 759 committing changelog
764 760 updating the branch cache
765 761 $ hg log -r 'destination(13)'
766 762 All copies of a cset
767 763 $ hg log -r 'origin(13) or destination(origin(13))'
768 764 changeset: 2:5c095ad7e90f
769 765 user: test
770 766 date: Thu Jan 01 00:00:00 1970 +0000
771 767 summary: 2
772 768
773 769 changeset: 7:ef0ef43d49e7
774 770 parent: 0:68795b066622
775 771 user: foo
776 772 date: Thu Jan 01 00:00:00 1970 +0000
777 773 summary: 2
778 774
779 775 changeset: 13:7a4785234d87
780 776 user: foo
781 777 date: Thu Jan 01 00:00:00 1970 +0000
782 778 summary: 2
783 779
784 780 changeset: 19:9627f653b421
785 781 user: test
786 782 date: Thu Jan 01 00:00:00 1970 +0000
787 783 summary: 2
788 784
789 785 changeset: 21:7e61b508e709
790 786 branch: dev
791 787 user: foo
792 788 date: Thu Jan 01 00:00:00 1970 +0000
793 789 summary: 2
794 790
795 791 changeset: 22:3a4e92d81b97
796 792 branch: dev
797 793 tag: tip
798 794 user: foo
799 795 date: Thu Jan 01 00:00:00 1970 +0000
800 796 summary: 2
801 797
802 798
803 799 graft works on complex revset
804 800
805 801 $ hg graft 'origin(13) or destination(origin(13))'
806 802 skipping ancestor revision 21:7e61b508e709
807 803 skipping ancestor revision 22:3a4e92d81b97
808 804 skipping revision 2:5c095ad7e90f (already grafted to 22:3a4e92d81b97)
809 805 grafting 7:ef0ef43d49e7 "2"
810 806 warning: can't find ancestor for 'b' copied from 'a'!
811 807 grafting 13:7a4785234d87 "2"
812 808 warning: can't find ancestor for 'b' copied from 'a'!
813 809 grafting 19:9627f653b421 "2"
814 810 merging b
815 811 warning: can't find ancestor for 'b' copied from 'a'!
816 812
817 813 graft with --force (still doesn't graft merges)
818 814
819 815 $ hg graft 19 0 6
820 816 skipping ungraftable merge revision 6
821 817 skipping ancestor revision 0:68795b066622
822 818 skipping already grafted revision 19:9627f653b421 (22:3a4e92d81b97 also has origin 2:5c095ad7e90f)
823 819 [255]
824 820 $ hg graft 19 0 6 --force
825 821 skipping ungraftable merge revision 6
826 822 grafting 19:9627f653b421 "2"
827 823 merging b
828 824 warning: can't find ancestor for 'b' copied from 'a'!
829 825 grafting 0:68795b066622 "0"
830 826
831 827 graft --force after backout
832 828
833 829 $ echo abc > a
834 830 $ hg ci -m 28
835 831 $ hg backout 28
836 832 reverting a
837 833 changeset 29:9d95e865b00c backs out changeset 28:cc20d29aec8d
838 834 $ hg graft 28
839 835 skipping ancestor revision 28:cc20d29aec8d
840 836 [255]
841 837 $ hg graft 28 --force
842 838 grafting 28:cc20d29aec8d "28"
843 839 merging a
844 840 $ cat a
845 841 abc
846 842
847 843 graft --continue after --force
848 844
849 845 $ echo def > a
850 846 $ hg ci -m 31
851 847 $ hg graft 28 --force --tool internal:fail
852 848 grafting 28:cc20d29aec8d "28"
853 849 abort: unresolved conflicts, can't continue
854 850 (use 'hg resolve' and 'hg graft --continue')
855 851 [255]
856 852 $ hg resolve --all
857 853 merging a
858 854 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
859 855 [1]
860 856 $ echo abc > a
861 857 $ hg resolve -m a
862 858 (no more unresolved files)
863 859 continue: hg graft --continue
864 860 $ hg graft -c
865 861 grafting 28:cc20d29aec8d "28"
866 862 $ cat a
867 863 abc
868 864
869 865 Continue testing same origin policy, using revision numbers from test above
870 866 but do some destructive editing of the repo:
871 867
872 868 $ hg up -qC 7
873 869 $ hg tag -l -r 13 tmp
874 870 $ hg --config extensions.strip= strip 2
875 871 saved backup bundle to $TESTTMP/a/.hg/strip-backup/5c095ad7e90f-d323a1e4-backup.hg
876 872 $ hg graft tmp
877 873 skipping already grafted revision 8:7a4785234d87 (2:ef0ef43d49e7 also has unknown origin 5c095ad7e90f)
878 874 [255]
879 875
880 876 Empty graft
881 877
882 878 $ hg up -qr 26
883 879 $ hg tag -f something
884 880 $ hg graft -qr 27
885 881 $ hg graft -f 27
886 882 grafting 27:17d42b8f5d50 "28"
887 883 note: graft of 27:17d42b8f5d50 created no changes to commit
888 884
889 885 $ cd ..
890 886
891 887 Graft to duplicate a commit
892 888
893 889 $ hg init graftsibling
894 890 $ cd graftsibling
895 891 $ touch a
896 892 $ hg commit -qAm a
897 893 $ touch b
898 894 $ hg commit -qAm b
899 895 $ hg log -G -T '{rev}\n'
900 896 @ 1
901 897 |
902 898 o 0
903 899
904 900 $ hg up -q 0
905 901 $ hg graft -r 1
906 902 grafting 1:0e067c57feba "b" (tip)
907 903 $ hg log -G -T '{rev}\n'
908 904 @ 2
909 905 |
910 906 | o 1
911 907 |/
912 908 o 0
913 909
914 910 Graft to duplicate a commit twice
915 911
916 912 $ hg up -q 0
917 913 $ hg graft -r 2
918 914 grafting 2:044ec77f6389 "b" (tip)
919 915 $ hg log -G -T '{rev}\n'
920 916 @ 3
921 917 |
922 918 | o 2
923 919 |/
924 920 | o 1
925 921 |/
926 922 o 0
927 923
928 924 Graft from behind a move or rename
929 925 ==================================
930 926
931 927 NOTE: This is affected by issue5343, and will need updating when it's fixed
932 928
933 929 Consider this topology for a regular graft:
934 930
935 931 o c1
936 932 |
937 933 | o c2
938 934 | |
939 935 | o ca # stands for "common ancestor"
940 936 |/
941 937 o cta # stands for "common topological ancestor"
942 938
943 939 Note that in issue5343, ca==cta.
944 940
945 941 The following table shows the possible cases. Here, "x->y" and, equivalently,
946 942 "y<-x", where x is an ancestor of y, means that some copy happened from x to y.
947 943
948 944 name | c1<-cta | cta<->ca | ca->c2
949 945 A.0 | | |
950 946 A.1 | X | |
951 947 A.2 | | X |
952 948 A.3 | | | X
953 949 A.4 | X | X |
954 950 A.5 | X | | X
955 951 A.6 | | X | X
956 952 A.7 | X | X | X
957 953
958 954 A.0 is trivial, and doesn't need copy tracking.
959 955 For A.1, a forward rename is recorded in the c1 pass, to be followed later.
960 956 In A.2, the rename is recorded in the c2 pass and followed backwards.
961 957 A.3 is recorded in the c2 pass as a forward rename to be duplicated on target.
962 958 In A.4, both passes of checkcopies record incomplete renames, which are
963 959 then joined in mergecopies to record a rename to be followed.
964 960 In A.5 and A.7, the c1 pass records an incomplete rename, while the c2 pass
965 961 records an incomplete divergence. The incomplete rename is then joined to the
966 962 appropriate side of the incomplete divergence, and the result is recorded as a
967 963 divergence. The code doesn't distinguish at all between these two cases, since
968 964 the end result of them is the same: an incomplete divergence joined with an
969 965 incomplete rename into a divergence.
970 966 Finally, A.6 records a divergence entirely in the c2 pass.
971 967
972 968 A.4 has a degenerate case a<-b<-a->a, where checkcopies isn't needed at all.
973 969 A.5 has a special case a<-b<-b->a, which is treated like a<-b->a in a merge.
974 970 A.5 has issue5343 as a special case.
975 971 A.6 has a special case a<-a<-b->a. Here, checkcopies will find a spurious
976 972 incomplete divergence, which is in fact complete. This is handled later in
977 973 mergecopies.
978 974 A.7 has 4 special cases: a<-b<-a->b (the "ping-pong" case), a<-b<-c->b,
979 975 a<-b<-a->c and a<-b<-c->a. Of these, only the "ping-pong" case is interesting,
980 976 the others are fairly trivial (a<-b<-c->b and a<-b<-a->c proceed like the base
981 977 case, a<-b<-c->a is treated the same as a<-b<-b->a).
982 978
983 979 f5a therefore tests the "ping-pong" rename case, where a file is renamed to the
984 980 same name on both branches, then the rename is backed out on one branch, and
985 981 the backout is grafted to the other branch. This creates a challenging rename
986 982 sequence of a<-b<-a->b in the graft target, topological CA, graft CA and graft
987 983 source, respectively. Since rename detection will run on the c1 side for such a
988 984 sequence (as for technical reasons, we split the c1 and c2 sides not at the
989 985 graft CA, but rather at the topological CA), it will pick up a false rename,
990 986 and cause a spurious merge conflict. This false rename is always exactly the
991 987 reverse of the true rename that would be detected on the c2 side, so we can
992 988 correct for it by detecting this condition and reversing as necessary.
993 989
994 990 First, set up the repository with commits to be grafted
995 991
996 992 $ hg init ../graftmove
997 993 $ cd ../graftmove
998 994 $ echo c1a > f1a
999 995 $ echo c2a > f2a
1000 996 $ echo c3a > f3a
1001 997 $ echo c4a > f4a
1002 998 $ echo c5a > f5a
1003 999 $ hg ci -qAm A0
1004 1000 $ hg mv f1a f1b
1005 1001 $ hg mv f3a f3b
1006 1002 $ hg mv f5a f5b
1007 1003 $ hg ci -qAm B0
1008 1004 $ echo c1c > f1b
1009 1005 $ hg mv f2a f2c
1010 1006 $ hg mv f5b f5a
1011 1007 $ echo c5c > f5a
1012 1008 $ hg ci -qAm C0
1013 1009 $ hg mv f3b f3d
1014 1010 $ echo c4d > f4a
1015 1011 $ hg ci -qAm D0
1016 1012 $ hg log -G
1017 1013 @ changeset: 3:b69f5839d2d9
1018 1014 | tag: tip
1019 1015 | user: test
1020 1016 | date: Thu Jan 01 00:00:00 1970 +0000
1021 1017 | summary: D0
1022 1018 |
1023 1019 o changeset: 2:f58c7e2b28fa
1024 1020 | user: test
1025 1021 | date: Thu Jan 01 00:00:00 1970 +0000
1026 1022 | summary: C0
1027 1023 |
1028 1024 o changeset: 1:3d7bba921b5d
1029 1025 | user: test
1030 1026 | date: Thu Jan 01 00:00:00 1970 +0000
1031 1027 | summary: B0
1032 1028 |
1033 1029 o changeset: 0:11f7a1b56675
1034 1030 user: test
1035 1031 date: Thu Jan 01 00:00:00 1970 +0000
1036 1032 summary: A0
1037 1033
1038 1034
1039 1035 Test the cases A.2 (f1x), A.3 (f2x) and a special case of A.6 (f5x) where the
1040 1036 two renames actually converge to the same name (thus no actual divergence).
1041 1037
1042 1038 $ hg up -q 'desc("A0")'
1043 1039 $ HGEDITOR="echo C1 >" hg graft -r 'desc("C0")' --edit
1044 1040 grafting 2:f58c7e2b28fa "C0"
1045 1041 merging f1a and f1b to f1a
1046 1042 merging f5a
1047 1043 warning: can't find ancestor for 'f5a' copied from 'f5b'!
1048 1044 $ hg status --change .
1049 1045 M f1a
1050 1046 M f5a
1051 1047 A f2c
1052 1048 R f2a
1053 1049 $ hg cat f1a
1054 1050 c1c
1055 1051 $ hg cat f1b
1056 1052 f1b: no such file in rev c9763722f9bd
1057 1053 [1]
1058 1054
1059 1055 Test the cases A.0 (f4x) and A.6 (f3x)
1060 1056
1061 1057 $ HGEDITOR="echo D1 >" hg graft -r 'desc("D0")' --edit
1062 1058 grafting 3:b69f5839d2d9 "D0"
1063 1059 note: possible conflict - f3b was renamed multiple times to:
1064 1060 f3a
1065 1061 f3d
1066 1062 warning: can't find ancestor for 'f3d' copied from 'f3b'!
1067 1063
1068 1064 Set up the repository for some further tests
1069 1065
1070 1066 $ hg up -q "min(desc("A0"))"
1071 1067 $ hg mv f1a f1e
1072 1068 $ echo c2e > f2a
1073 1069 $ hg mv f3a f3e
1074 1070 $ hg mv f4a f4e
1075 1071 $ hg mv f5a f5b
1076 1072 $ hg ci -qAm "E0"
1077 1073 $ hg up -q "min(desc("A0"))"
1078 1074 $ hg cp f1a f1f
1079 1075 $ hg ci -qAm "F0"
1080 1076 $ hg up -q "min(desc("A0"))"
1081 1077 $ hg cp f1a f1g
1082 1078 $ echo c1g > f1g
1083 1079 $ hg ci -qAm "G0"
1084 1080 $ hg log -G
1085 1081 @ changeset: 8:ba67f08fb15a
1086 1082 | tag: tip
1087 1083 | parent: 0:11f7a1b56675
1088 1084 | user: test
1089 1085 | date: Thu Jan 01 00:00:00 1970 +0000
1090 1086 | summary: G0
1091 1087 |
1092 1088 | o changeset: 7:d376ab0d7fda
1093 1089 |/ parent: 0:11f7a1b56675
1094 1090 | user: test
1095 1091 | date: Thu Jan 01 00:00:00 1970 +0000
1096 1092 | summary: F0
1097 1093 |
1098 1094 | o changeset: 6:6bd1736cab86
1099 1095 |/ parent: 0:11f7a1b56675
1100 1096 | user: test
1101 1097 | date: Thu Jan 01 00:00:00 1970 +0000
1102 1098 | summary: E0
1103 1099 |
1104 1100 | o changeset: 5:560daee679da
1105 1101 | | user: test
1106 1102 | | date: Thu Jan 01 00:00:00 1970 +0000
1107 1103 | | summary: D1
1108 1104 | |
1109 1105 | o changeset: 4:c9763722f9bd
1110 1106 |/ parent: 0:11f7a1b56675
1111 1107 | user: test
1112 1108 | date: Thu Jan 01 00:00:00 1970 +0000
1113 1109 | summary: C1
1114 1110 |
1115 1111 | o changeset: 3:b69f5839d2d9
1116 1112 | | user: test
1117 1113 | | date: Thu Jan 01 00:00:00 1970 +0000
1118 1114 | | summary: D0
1119 1115 | |
1120 1116 | o changeset: 2:f58c7e2b28fa
1121 1117 | | user: test
1122 1118 | | date: Thu Jan 01 00:00:00 1970 +0000
1123 1119 | | summary: C0
1124 1120 | |
1125 1121 | o changeset: 1:3d7bba921b5d
1126 1122 |/ user: test
1127 1123 | date: Thu Jan 01 00:00:00 1970 +0000
1128 1124 | summary: B0
1129 1125 |
1130 1126 o changeset: 0:11f7a1b56675
1131 1127 user: test
1132 1128 date: Thu Jan 01 00:00:00 1970 +0000
1133 1129 summary: A0
1134 1130
1135 1131
1136 1132 Test the cases A.4 (f1x), the "ping-pong" special case of A.7 (f5x),
1137 1133 and A.3 with a local content change to be preserved (f2x).
1138 1134
1139 1135 $ hg up -q "desc("E0")"
1140 1136 $ HGEDITOR="echo C2 >" hg graft -r 'desc("C0")' --edit
1141 1137 grafting 2:f58c7e2b28fa "C0"
1142 1138 merging f1e and f1b to f1e
1143 1139 merging f2a and f2c to f2c
1144 1140 merging f5b and f5a to f5a
1145 1141
1146 1142 Test the cases A.1 (f4x) and A.7 (f3x).
1147 1143
1148 1144 $ HGEDITOR="echo D2 >" hg graft -r 'desc("D0")' --edit
1149 1145 grafting 3:b69f5839d2d9 "D0"
1150 1146 note: possible conflict - f3b was renamed multiple times to:
1151 1147 f3d
1152 1148 f3e
1153 1149 merging f4e and f4a to f4e
1154 1150 warning: can't find ancestor for 'f3d' copied from 'f3b'!
1155 1151
1156 1152 $ hg cat f2c
1157 1153 c2e
1158 1154
1159 1155 Test the case A.5 (move case, f1x).
1160 1156
1161 1157 $ hg up -q "desc("C0")"
1162 1158 BROKEN: Shouldn't get the warning about missing ancestor
1163 1159 $ HGEDITOR="echo E1 >" hg graft -r 'desc("E0")' --edit
1164 1160 grafting 6:6bd1736cab86 "E0"
1165 1161 note: possible conflict - f1a was renamed multiple times to:
1166 1162 f1b
1167 1163 f1e
1168 1164 note: possible conflict - f3a was renamed multiple times to:
1169 1165 f3b
1170 1166 f3e
1171 1167 merging f2c and f2a to f2c
1172 1168 merging f5a and f5b to f5b
1173 1169 warning: can't find ancestor for 'f1e' copied from 'f1a'!
1174 1170 warning: can't find ancestor for 'f3e' copied from 'f3a'!
1175 1171 $ cat f1e
1176 1172 c1a
1177 1173
1178 1174 Test the case A.5 (copy case, f1x).
1179 1175
1180 1176 $ hg up -q "desc("C0")"
1181 1177 BROKEN: Shouldn't get the warning about missing ancestor
1182 1178 $ HGEDITOR="echo F1 >" hg graft -r 'desc("F0")' --edit
1183 1179 grafting 7:d376ab0d7fda "F0"
1184 1180 warning: can't find ancestor for 'f1f' copied from 'f1a'!
1185 1181 BROKEN: f1f should be marked a copy from f1b
1186 1182 $ hg st --copies --change .
1187 1183 A f1f
1188 1184 BROKEN: f1f should have the new content from f1b (i.e. "c1c")
1189 1185 $ cat f1f
1190 1186 c1a
1191 1187
1192 1188 Test the case A.5 (copy+modify case, f1x).
1193 1189
1194 1190 $ hg up -q "desc("C0")"
1195 1191 BROKEN: We should get a merge conflict from the 3-way merge between f1b in C0
1196 1192 (content "c1c") and f1g in G0 (content "c1g") with f1a in A0 as base (content
1197 1193 "c1a")
1198 1194 $ HGEDITOR="echo G1 >" hg graft -r 'desc("G0")' --edit
1199 1195 grafting 8:ba67f08fb15a "G0"
1200 1196 warning: can't find ancestor for 'f1g' copied from 'f1a'!
1201 1197
1202 1198 Check the results of the grafts tested
1203 1199
1204 1200 $ hg log -CGv --patch --git
1205 1201 @ changeset: 13:ef3adf6c20a4
1206 1202 | tag: tip
1207 1203 | parent: 2:f58c7e2b28fa
1208 1204 | user: test
1209 1205 | date: Thu Jan 01 00:00:00 1970 +0000
1210 1206 | files: f1g
1211 1207 | description:
1212 1208 | G1
1213 1209 |
1214 1210 |
1215 1211 | diff --git a/f1g b/f1g
1216 1212 | new file mode 100644
1217 1213 | --- /dev/null
1218 1214 | +++ b/f1g
1219 1215 | @@ -0,0 +1,1 @@
1220 1216 | +c1g
1221 1217 |
1222 1218 | o changeset: 12:b5542d755b54
1223 1219 |/ parent: 2:f58c7e2b28fa
1224 1220 | user: test
1225 1221 | date: Thu Jan 01 00:00:00 1970 +0000
1226 1222 | files: f1f
1227 1223 | description:
1228 1224 | F1
1229 1225 |
1230 1226 |
1231 1227 | diff --git a/f1f b/f1f
1232 1228 | new file mode 100644
1233 1229 | --- /dev/null
1234 1230 | +++ b/f1f
1235 1231 | @@ -0,0 +1,1 @@
1236 1232 | +c1a
1237 1233 |
1238 1234 | o changeset: 11:f8a162271246
1239 1235 |/ parent: 2:f58c7e2b28fa
1240 1236 | user: test
1241 1237 | date: Thu Jan 01 00:00:00 1970 +0000
1242 1238 | files: f1e f2c f3e f4a f4e f5a f5b
1243 1239 | copies: f4e (f4a) f5b (f5a)
1244 1240 | description:
1245 1241 | E1
1246 1242 |
1247 1243 |
1248 1244 | diff --git a/f1e b/f1e
1249 1245 | new file mode 100644
1250 1246 | --- /dev/null
1251 1247 | +++ b/f1e
1252 1248 | @@ -0,0 +1,1 @@
1253 1249 | +c1a
1254 1250 | diff --git a/f2c b/f2c
1255 1251 | --- a/f2c
1256 1252 | +++ b/f2c
1257 1253 | @@ -1,1 +1,1 @@
1258 1254 | -c2a
1259 1255 | +c2e
1260 1256 | diff --git a/f3e b/f3e
1261 1257 | new file mode 100644
1262 1258 | --- /dev/null
1263 1259 | +++ b/f3e
1264 1260 | @@ -0,0 +1,1 @@
1265 1261 | +c3a
1266 1262 | diff --git a/f4a b/f4e
1267 1263 | rename from f4a
1268 1264 | rename to f4e
1269 1265 | diff --git a/f5a b/f5b
1270 1266 | rename from f5a
1271 1267 | rename to f5b
1272 1268 |
1273 1269 | o changeset: 10:93ee502e8b0a
1274 1270 | | user: test
1275 1271 | | date: Thu Jan 01 00:00:00 1970 +0000
1276 1272 | | files: f3d f4e
1277 1273 | | description:
1278 1274 | | D2
1279 1275 | |
1280 1276 | |
1281 1277 | | diff --git a/f3d b/f3d
1282 1278 | | new file mode 100644
1283 1279 | | --- /dev/null
1284 1280 | | +++ b/f3d
1285 1281 | | @@ -0,0 +1,1 @@
1286 1282 | | +c3a
1287 1283 | | diff --git a/f4e b/f4e
1288 1284 | | --- a/f4e
1289 1285 | | +++ b/f4e
1290 1286 | | @@ -1,1 +1,1 @@
1291 1287 | | -c4a
1292 1288 | | +c4d
1293 1289 | |
1294 1290 | o changeset: 9:539cf145f496
1295 1291 | | parent: 6:6bd1736cab86
1296 1292 | | user: test
1297 1293 | | date: Thu Jan 01 00:00:00 1970 +0000
1298 1294 | | files: f1e f2a f2c f5a f5b
1299 1295 | | copies: f2c (f2a) f5a (f5b)
1300 1296 | | description:
1301 1297 | | C2
1302 1298 | |
1303 1299 | |
1304 1300 | | diff --git a/f1e b/f1e
1305 1301 | | --- a/f1e
1306 1302 | | +++ b/f1e
1307 1303 | | @@ -1,1 +1,1 @@
1308 1304 | | -c1a
1309 1305 | | +c1c
1310 1306 | | diff --git a/f2a b/f2c
1311 1307 | | rename from f2a
1312 1308 | | rename to f2c
1313 1309 | | diff --git a/f5b b/f5a
1314 1310 | | rename from f5b
1315 1311 | | rename to f5a
1316 1312 | | --- a/f5b
1317 1313 | | +++ b/f5a
1318 1314 | | @@ -1,1 +1,1 @@
1319 1315 | | -c5a
1320 1316 | | +c5c
1321 1317 | |
1322 1318 | | o changeset: 8:ba67f08fb15a
1323 1319 | | | parent: 0:11f7a1b56675
1324 1320 | | | user: test
1325 1321 | | | date: Thu Jan 01 00:00:00 1970 +0000
1326 1322 | | | files: f1g
1327 1323 | | | copies: f1g (f1a)
1328 1324 | | | description:
1329 1325 | | | G0
1330 1326 | | |
1331 1327 | | |
1332 1328 | | | diff --git a/f1a b/f1g
1333 1329 | | | copy from f1a
1334 1330 | | | copy to f1g
1335 1331 | | | --- a/f1a
1336 1332 | | | +++ b/f1g
1337 1333 | | | @@ -1,1 +1,1 @@
1338 1334 | | | -c1a
1339 1335 | | | +c1g
1340 1336 | | |
1341 1337 | | | o changeset: 7:d376ab0d7fda
1342 1338 | | |/ parent: 0:11f7a1b56675
1343 1339 | | | user: test
1344 1340 | | | date: Thu Jan 01 00:00:00 1970 +0000
1345 1341 | | | files: f1f
1346 1342 | | | copies: f1f (f1a)
1347 1343 | | | description:
1348 1344 | | | F0
1349 1345 | | |
1350 1346 | | |
1351 1347 | | | diff --git a/f1a b/f1f
1352 1348 | | | copy from f1a
1353 1349 | | | copy to f1f
1354 1350 | | |
1355 1351 | o | changeset: 6:6bd1736cab86
1356 1352 | |/ parent: 0:11f7a1b56675
1357 1353 | | user: test
1358 1354 | | date: Thu Jan 01 00:00:00 1970 +0000
1359 1355 | | files: f1a f1e f2a f3a f3e f4a f4e f5a f5b
1360 1356 | | copies: f1e (f1a) f3e (f3a) f4e (f4a) f5b (f5a)
1361 1357 | | description:
1362 1358 | | E0
1363 1359 | |
1364 1360 | |
1365 1361 | | diff --git a/f1a b/f1e
1366 1362 | | rename from f1a
1367 1363 | | rename to f1e
1368 1364 | | diff --git a/f2a b/f2a
1369 1365 | | --- a/f2a
1370 1366 | | +++ b/f2a
1371 1367 | | @@ -1,1 +1,1 @@
1372 1368 | | -c2a
1373 1369 | | +c2e
1374 1370 | | diff --git a/f3a b/f3e
1375 1371 | | rename from f3a
1376 1372 | | rename to f3e
1377 1373 | | diff --git a/f4a b/f4e
1378 1374 | | rename from f4a
1379 1375 | | rename to f4e
1380 1376 | | diff --git a/f5a b/f5b
1381 1377 | | rename from f5a
1382 1378 | | rename to f5b
1383 1379 | |
1384 1380 | | o changeset: 5:560daee679da
1385 1381 | | | user: test
1386 1382 | | | date: Thu Jan 01 00:00:00 1970 +0000
1387 1383 | | | files: f3d f4a
1388 1384 | | | description:
1389 1385 | | | D1
1390 1386 | | |
1391 1387 | | |
1392 1388 | | | diff --git a/f3d b/f3d
1393 1389 | | | new file mode 100644
1394 1390 | | | --- /dev/null
1395 1391 | | | +++ b/f3d
1396 1392 | | | @@ -0,0 +1,1 @@
1397 1393 | | | +c3a
1398 1394 | | | diff --git a/f4a b/f4a
1399 1395 | | | --- a/f4a
1400 1396 | | | +++ b/f4a
1401 1397 | | | @@ -1,1 +1,1 @@
1402 1398 | | | -c4a
1403 1399 | | | +c4d
1404 1400 | | |
1405 1401 | | o changeset: 4:c9763722f9bd
1406 1402 | |/ parent: 0:11f7a1b56675
1407 1403 | | user: test
1408 1404 | | date: Thu Jan 01 00:00:00 1970 +0000
1409 1405 | | files: f1a f2a f2c f5a
1410 1406 | | copies: f2c (f2a)
1411 1407 | | description:
1412 1408 | | C1
1413 1409 | |
1414 1410 | |
1415 1411 | | diff --git a/f1a b/f1a
1416 1412 | | --- a/f1a
1417 1413 | | +++ b/f1a
1418 1414 | | @@ -1,1 +1,1 @@
1419 1415 | | -c1a
1420 1416 | | +c1c
1421 1417 | | diff --git a/f2a b/f2c
1422 1418 | | rename from f2a
1423 1419 | | rename to f2c
1424 1420 | | diff --git a/f5a b/f5a
1425 1421 | | --- a/f5a
1426 1422 | | +++ b/f5a
1427 1423 | | @@ -1,1 +1,1 @@
1428 1424 | | -c5a
1429 1425 | | +c5c
1430 1426 | |
1431 1427 +---o changeset: 3:b69f5839d2d9
1432 1428 | | user: test
1433 1429 | | date: Thu Jan 01 00:00:00 1970 +0000
1434 1430 | | files: f3b f3d f4a
1435 1431 | | copies: f3d (f3b)
1436 1432 | | description:
1437 1433 | | D0
1438 1434 | |
1439 1435 | |
1440 1436 | | diff --git a/f3b b/f3d
1441 1437 | | rename from f3b
1442 1438 | | rename to f3d
1443 1439 | | diff --git a/f4a b/f4a
1444 1440 | | --- a/f4a
1445 1441 | | +++ b/f4a
1446 1442 | | @@ -1,1 +1,1 @@
1447 1443 | | -c4a
1448 1444 | | +c4d
1449 1445 | |
1450 1446 o | changeset: 2:f58c7e2b28fa
1451 1447 | | user: test
1452 1448 | | date: Thu Jan 01 00:00:00 1970 +0000
1453 1449 | | files: f1b f2a f2c f5a f5b
1454 1450 | | copies: f2c (f2a) f5a (f5b)
1455 1451 | | description:
1456 1452 | | C0
1457 1453 | |
1458 1454 | |
1459 1455 | | diff --git a/f1b b/f1b
1460 1456 | | --- a/f1b
1461 1457 | | +++ b/f1b
1462 1458 | | @@ -1,1 +1,1 @@
1463 1459 | | -c1a
1464 1460 | | +c1c
1465 1461 | | diff --git a/f2a b/f2c
1466 1462 | | rename from f2a
1467 1463 | | rename to f2c
1468 1464 | | diff --git a/f5b b/f5a
1469 1465 | | rename from f5b
1470 1466 | | rename to f5a
1471 1467 | | --- a/f5b
1472 1468 | | +++ b/f5a
1473 1469 | | @@ -1,1 +1,1 @@
1474 1470 | | -c5a
1475 1471 | | +c5c
1476 1472 | |
1477 1473 o | changeset: 1:3d7bba921b5d
1478 1474 |/ user: test
1479 1475 | date: Thu Jan 01 00:00:00 1970 +0000
1480 1476 | files: f1a f1b f3a f3b f5a f5b
1481 1477 | copies: f1b (f1a) f3b (f3a) f5b (f5a)
1482 1478 | description:
1483 1479 | B0
1484 1480 |
1485 1481 |
1486 1482 | diff --git a/f1a b/f1b
1487 1483 | rename from f1a
1488 1484 | rename to f1b
1489 1485 | diff --git a/f3a b/f3b
1490 1486 | rename from f3a
1491 1487 | rename to f3b
1492 1488 | diff --git a/f5a b/f5b
1493 1489 | rename from f5a
1494 1490 | rename to f5b
1495 1491 |
1496 1492 o changeset: 0:11f7a1b56675
1497 1493 user: test
1498 1494 date: Thu Jan 01 00:00:00 1970 +0000
1499 1495 files: f1a f2a f3a f4a f5a
1500 1496 description:
1501 1497 A0
1502 1498
1503 1499
1504 1500 diff --git a/f1a b/f1a
1505 1501 new file mode 100644
1506 1502 --- /dev/null
1507 1503 +++ b/f1a
1508 1504 @@ -0,0 +1,1 @@
1509 1505 +c1a
1510 1506 diff --git a/f2a b/f2a
1511 1507 new file mode 100644
1512 1508 --- /dev/null
1513 1509 +++ b/f2a
1514 1510 @@ -0,0 +1,1 @@
1515 1511 +c2a
1516 1512 diff --git a/f3a b/f3a
1517 1513 new file mode 100644
1518 1514 --- /dev/null
1519 1515 +++ b/f3a
1520 1516 @@ -0,0 +1,1 @@
1521 1517 +c3a
1522 1518 diff --git a/f4a b/f4a
1523 1519 new file mode 100644
1524 1520 --- /dev/null
1525 1521 +++ b/f4a
1526 1522 @@ -0,0 +1,1 @@
1527 1523 +c4a
1528 1524 diff --git a/f5a b/f5a
1529 1525 new file mode 100644
1530 1526 --- /dev/null
1531 1527 +++ b/f5a
1532 1528 @@ -0,0 +1,1 @@
1533 1529 +c5a
1534 1530
1535 1531 Check superfluous filemerge of files renamed in the past but untouched by graft
1536 1532
1537 1533 $ echo a > a
1538 1534 $ hg ci -qAma
1539 1535 $ hg mv a b
1540 1536 $ echo b > b
1541 1537 $ hg ci -qAmb
1542 1538 $ echo c > c
1543 1539 $ hg ci -qAmc
1544 1540 $ hg up -q .~2
1545 1541 $ hg graft tip -qt:fail
1546 1542
1547 1543 $ cd ..
1548 1544
1549 1545 Graft a change into a new file previously grafted into a renamed directory
1550 1546
1551 1547 $ hg init dirmovenewfile
1552 1548 $ cd dirmovenewfile
1553 1549 $ mkdir a
1554 1550 $ echo a > a/a
1555 1551 $ hg ci -qAma
1556 1552 $ echo x > a/x
1557 1553 $ hg ci -qAmx
1558 1554 $ hg up -q 0
1559 1555 $ hg mv -q a b
1560 1556 $ hg ci -qAmb
1561 1557 $ hg graft -q 1 # a/x grafted as b/x, but no copy information recorded
1562 1558 $ hg up -q 1
1563 1559 $ echo y > a/x
1564 1560 $ hg ci -qAmy
1565 1561 $ hg up -q 3
1566 1562 $ hg graft -q 4
1567 1563 $ hg status --change .
1568 1564 M b/x
1569 1565
1570 1566 Prepare for test of skipped changesets and how merges can influence it:
1571 1567
1572 1568 $ hg merge -q -r 1 --tool :local
1573 1569 $ hg ci -m m
1574 1570 $ echo xx >> b/x
1575 1571 $ hg ci -m xx
1576 1572
1577 1573 $ hg log -G -T '{rev} {desc|firstline}'
1578 1574 @ 7 xx
1579 1575 |
1580 1576 o 6 m
1581 1577 |\
1582 1578 | o 5 y
1583 1579 | |
1584 1580 +---o 4 y
1585 1581 | |
1586 1582 | o 3 x
1587 1583 | |
1588 1584 | o 2 b
1589 1585 | |
1590 1586 o | 1 x
1591 1587 |/
1592 1588 o 0 a
1593 1589
1594 1590 Grafting of plain changes correctly detects that 3 and 5 should be skipped:
1595 1591
1596 1592 $ hg up -qCr 4
1597 1593 $ hg graft --tool :local -r 2::5
1598 1594 skipping already grafted revision 3:ca093ca2f1d9 (was grafted from 1:13ec5badbf2a)
1599 1595 skipping already grafted revision 5:43e9eb70dab0 (was grafted from 4:6c9a1289e5f1)
1600 1596 grafting 2:42127f193bcd "b"
1601 1597
1602 1598 Extending the graft range to include a (skipped) merge of 3 will not prevent us from
1603 1599 also detecting that both 3 and 5 should be skipped:
1604 1600
1605 1601 $ hg up -qCr 4
1606 1602 $ hg graft --tool :local -r 2::7
1607 1603 skipping ungraftable merge revision 6
1608 1604 skipping already grafted revision 3:ca093ca2f1d9 (was grafted from 1:13ec5badbf2a)
1609 1605 skipping already grafted revision 5:43e9eb70dab0 (was grafted from 4:6c9a1289e5f1)
1610 1606 grafting 2:42127f193bcd "b"
1611 1607 grafting 7:d3c3f2b38ecc "xx"
1612 1608 note: graft of 7:d3c3f2b38ecc created no changes to commit
1613 1609
1614 1610 $ cd ..
1615 1611
1616 1612 Grafted revision should be warned and skipped only once. (issue6024)
1617 1613
1618 1614 $ mkdir issue6024
1619 1615 $ cd issue6024
1620 1616
1621 1617 $ hg init base
1622 1618 $ cd base
1623 1619 $ touch x
1624 1620 $ hg commit -qAminit
1625 1621 $ echo a > x
1626 1622 $ hg commit -mchange
1627 1623 $ hg update -q 0
1628 1624 $ hg graft -r 1
1629 1625 grafting 1:a0b923c546aa "change" (tip)
1630 1626 $ cd ..
1631 1627
1632 1628 $ hg clone -qr 2 base clone
1633 1629 $ cd clone
1634 1630 $ hg pull -q
1635 1631 $ hg merge -q 2
1636 1632 $ hg commit -mmerge
1637 1633 $ hg update -q 0
1638 1634 $ hg graft -r 1
1639 1635 grafting 1:04fc6d444368 "change"
1640 1636 $ hg update -q 3
1641 1637 $ hg log -G -T '{rev}:{node|shortest} <- {extras.source|shortest}\n'
1642 1638 o 4:4e16 <- a0b9
1643 1639 |
1644 1640 | @ 3:f0ac <-
1645 1641 | |\
1646 1642 +---o 2:a0b9 <-
1647 1643 | |
1648 1644 | o 1:04fc <- a0b9
1649 1645 |/
1650 1646 o 0:7848 <-
1651 1647
1652 1648
1653 1649 the source of rev 4 is an ancestor of the working parent, and was also
1654 1650 grafted as rev 1. it should be stripped from the target revisions only once.
1655 1651
1656 1652 $ hg graft -r 4
1657 1653 skipping already grafted revision 4:4e16bab40c9c (1:04fc6d444368 also has origin 2:a0b923c546aa)
1658 1654 [255]
1659 1655
1660 1656 $ cd ../..
1661 1657
1662 1658 Testing the reading of old format graftstate file with newer mercurial
1663 1659
1664 1660 $ hg init oldgraft
1665 1661 $ cd oldgraft
1666 1662 $ for ch in a b c; do echo foo > $ch; hg add $ch; hg ci -Aqm "added "$ch; done;
1667 1663 $ hg log -GT "{rev}:{node|short} {desc}\n"
1668 1664 @ 2:8be98ac1a569 added c
1669 1665 |
1670 1666 o 1:80e6d2c47cfe added b
1671 1667 |
1672 1668 o 0:f7ad41964313 added a
1673 1669
1674 1670 $ hg up 0
1675 1671 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1676 1672 $ echo bar > b
1677 1673 $ hg add b
1678 1674 $ hg ci -m "bar to b"
1679 1675 created new head
1680 1676 $ hg graft -r 1 -r 2
1681 1677 grafting 1:80e6d2c47cfe "added b"
1682 1678 merging b
1683 1679 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
1684 1680 abort: unresolved conflicts, can't continue
1685 1681 (use 'hg resolve' and 'hg graft --continue')
1686 1682 [255]
1687 1683
1688 1684 Writing the nodes in old format to graftstate
1689 1685
1690 1686 $ hg log -r 1 -r 2 -T '{node}\n' > .hg/graftstate
1691 1687 $ echo foo > b
1692 1688 $ hg resolve -m
1693 1689 (no more unresolved files)
1694 1690 continue: hg graft --continue
1695 1691 $ hg graft --continue
1696 1692 grafting 1:80e6d2c47cfe "added b"
1697 1693 grafting 2:8be98ac1a569 "added c"
1698 1694
1699 1695 Testing that --user is preserved during conflicts and value is reused while
1700 1696 running `hg graft --continue`
1701 1697
1702 1698 $ hg log -G
1703 1699 @ changeset: 5:711e9fa999f1
1704 1700 | tag: tip
1705 1701 | user: test
1706 1702 | date: Thu Jan 01 00:00:00 1970 +0000
1707 1703 | summary: added c
1708 1704 |
1709 1705 o changeset: 4:e5ad7353b408
1710 1706 | user: test
1711 1707 | date: Thu Jan 01 00:00:00 1970 +0000
1712 1708 | summary: added b
1713 1709 |
1714 1710 o changeset: 3:9e887f7a939c
1715 1711 | parent: 0:f7ad41964313
1716 1712 | user: test
1717 1713 | date: Thu Jan 01 00:00:00 1970 +0000
1718 1714 | summary: bar to b
1719 1715 |
1720 1716 | o changeset: 2:8be98ac1a569
1721 1717 | | user: test
1722 1718 | | date: Thu Jan 01 00:00:00 1970 +0000
1723 1719 | | summary: added c
1724 1720 | |
1725 1721 | o changeset: 1:80e6d2c47cfe
1726 1722 |/ user: test
1727 1723 | date: Thu Jan 01 00:00:00 1970 +0000
1728 1724 | summary: added b
1729 1725 |
1730 1726 o changeset: 0:f7ad41964313
1731 1727 user: test
1732 1728 date: Thu Jan 01 00:00:00 1970 +0000
1733 1729 summary: added a
1734 1730
1735 1731
1736 1732 $ hg up '.^^'
1737 1733 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1738 1734
1739 1735 $ hg graft -r 1 -r 2 --user batman
1740 1736 grafting 1:80e6d2c47cfe "added b"
1741 1737 merging b
1742 1738 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
1743 1739 abort: unresolved conflicts, can't continue
1744 1740 (use 'hg resolve' and 'hg graft --continue')
1745 1741 [255]
1746 1742
1747 1743 $ echo wat > b
1748 1744 $ hg resolve -m
1749 1745 (no more unresolved files)
1750 1746 continue: hg graft --continue
1751 1747
1752 1748 $ hg graft --continue
1753 1749 grafting 1:80e6d2c47cfe "added b"
1754 1750 grafting 2:8be98ac1a569 "added c"
1755 1751
1756 1752 $ hg log -Gr 3::
1757 1753 @ changeset: 7:11a36ffaacf2
1758 1754 | tag: tip
1759 1755 | user: batman
1760 1756 | date: Thu Jan 01 00:00:00 1970 +0000
1761 1757 | summary: added c
1762 1758 |
1763 1759 o changeset: 6:76803afc6511
1764 1760 | parent: 3:9e887f7a939c
1765 1761 | user: batman
1766 1762 | date: Thu Jan 01 00:00:00 1970 +0000
1767 1763 | summary: added b
1768 1764 |
1769 1765 | o changeset: 5:711e9fa999f1
1770 1766 | | user: test
1771 1767 | | date: Thu Jan 01 00:00:00 1970 +0000
1772 1768 | | summary: added c
1773 1769 | |
1774 1770 | o changeset: 4:e5ad7353b408
1775 1771 |/ user: test
1776 1772 | date: Thu Jan 01 00:00:00 1970 +0000
1777 1773 | summary: added b
1778 1774 |
1779 1775 o changeset: 3:9e887f7a939c
1780 1776 | parent: 0:f7ad41964313
1781 1777 ~ user: test
1782 1778 date: Thu Jan 01 00:00:00 1970 +0000
1783 1779 summary: bar to b
1784 1780
1785 1781 Test that --date is preserved and reused in `hg graft --continue`
1786 1782
1787 1783 $ hg up '.^^'
1788 1784 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1789 1785 $ hg graft -r 1 -r 2 --date '1234560000 120'
1790 1786 grafting 1:80e6d2c47cfe "added b"
1791 1787 merging b
1792 1788 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
1793 1789 abort: unresolved conflicts, can't continue
1794 1790 (use 'hg resolve' and 'hg graft --continue')
1795 1791 [255]
1796 1792
1797 1793 $ echo foobar > b
1798 1794 $ hg resolve -m
1799 1795 (no more unresolved files)
1800 1796 continue: hg graft --continue
1801 1797 $ hg graft --continue
1802 1798 grafting 1:80e6d2c47cfe "added b"
1803 1799 grafting 2:8be98ac1a569 "added c"
1804 1800
1805 1801 $ hg log -Gr '.^^::.'
1806 1802 @ changeset: 9:1896b76e007a
1807 1803 | tag: tip
1808 1804 | user: test
1809 1805 | date: Fri Feb 13 21:18:00 2009 -0002
1810 1806 | summary: added c
1811 1807 |
1812 1808 o changeset: 8:ce2b4f1632af
1813 1809 | parent: 3:9e887f7a939c
1814 1810 | user: test
1815 1811 | date: Fri Feb 13 21:18:00 2009 -0002
1816 1812 | summary: added b
1817 1813 |
1818 1814 o changeset: 3:9e887f7a939c
1819 1815 | parent: 0:f7ad41964313
1820 1816 ~ user: test
1821 1817 date: Thu Jan 01 00:00:00 1970 +0000
1822 1818 summary: bar to b
1823 1819
1824 1820 Test that --log is preserved and reused in `hg graft --continue`
1825 1821
1826 1822 $ hg up '.^^'
1827 1823 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1828 1824 $ hg graft -r 1 -r 2 --log
1829 1825 grafting 1:80e6d2c47cfe "added b"
1830 1826 merging b
1831 1827 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
1832 1828 abort: unresolved conflicts, can't continue
1833 1829 (use 'hg resolve' and 'hg graft --continue')
1834 1830 [255]
1835 1831
1836 1832 $ echo foobar > b
1837 1833 $ hg resolve -m
1838 1834 (no more unresolved files)
1839 1835 continue: hg graft --continue
1840 1836
1841 1837 $ hg graft --continue
1842 1838 grafting 1:80e6d2c47cfe "added b"
1843 1839 grafting 2:8be98ac1a569 "added c"
1844 1840
1845 1841 $ hg log -GT "{rev}:{node|short} {desc}" -r '.^^::.'
1846 1842 @ 11:30c1050a58b2 added c
1847 1843 | (grafted from 8be98ac1a56990c2d9ca6861041b8390af7bd6f3)
1848 1844 o 10:ec7eda2313e2 added b
1849 1845 | (grafted from 80e6d2c47cfe5b3185519568327a17a061c7efb6)
1850 1846 o 3:9e887f7a939c bar to b
1851 1847 |
1852 1848 ~
1853 1849
1854 1850 $ cd ..
1855 1851
1856 1852 Testing the --stop flag of `hg graft` which stops the interrupted graft
1857 1853
1858 1854 $ hg init stopgraft
1859 1855 $ cd stopgraft
1860 1856 $ for ch in a b c d; do echo $ch > $ch; hg add $ch; hg ci -Aqm "added "$ch; done;
1861 1857
1862 1858 $ hg log -G
1863 1859 @ changeset: 3:9150fe93bec6
1864 1860 | tag: tip
1865 1861 | user: test
1866 1862 | date: Thu Jan 01 00:00:00 1970 +0000
1867 1863 | summary: added d
1868 1864 |
1869 1865 o changeset: 2:155349b645be
1870 1866 | user: test
1871 1867 | date: Thu Jan 01 00:00:00 1970 +0000
1872 1868 | summary: added c
1873 1869 |
1874 1870 o changeset: 1:5f6d8a4bf34a
1875 1871 | user: test
1876 1872 | date: Thu Jan 01 00:00:00 1970 +0000
1877 1873 | summary: added b
1878 1874 |
1879 1875 o changeset: 0:9092f1db7931
1880 1876 user: test
1881 1877 date: Thu Jan 01 00:00:00 1970 +0000
1882 1878 summary: added a
1883 1879
1884 1880 $ hg up '.^^'
1885 1881 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1886 1882
1887 1883 $ echo foo > d
1888 1884 $ hg ci -Aqm "added foo to d"
1889 1885
1890 1886 $ hg graft --stop
1891 1887 abort: no interrupted graft found
1892 1888 [255]
1893 1889
1894 1890 $ hg graft -r 3
1895 1891 grafting 3:9150fe93bec6 "added d"
1896 1892 merging d
1897 1893 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1898 1894 abort: unresolved conflicts, can't continue
1899 1895 (use 'hg resolve' and 'hg graft --continue')
1900 1896 [255]
1901 1897
1902 1898 $ hg graft --stop --continue
1903 1899 abort: cannot use '--continue' and '--stop' together
1904 1900 [255]
1905 1901
1906 1902 $ hg graft --stop -U
1907 1903 abort: cannot specify any other flag with '--stop'
1908 1904 [255]
1909 1905 $ hg graft --stop --rev 4
1910 1906 abort: cannot specify any other flag with '--stop'
1911 1907 [255]
1912 1908 $ hg graft --stop --log
1913 1909 abort: cannot specify any other flag with '--stop'
1914 1910 [255]
1915 1911
1916 1912 $ hg graft --stop
1917 1913 stopped the interrupted graft
1918 1914 working directory is now at a0deacecd59d
1919 1915
1920 1916 $ hg diff
1921 1917
1922 1918 $ hg log -Gr '.'
1923 1919 @ changeset: 4:a0deacecd59d
1924 1920 | tag: tip
1925 1921 ~ parent: 1:5f6d8a4bf34a
1926 1922 user: test
1927 1923 date: Thu Jan 01 00:00:00 1970 +0000
1928 1924 summary: added foo to d
1929 1925
1930 1926 $ hg graft -r 2 -r 3
1931 1927 grafting 2:155349b645be "added c"
1932 1928 grafting 3:9150fe93bec6 "added d"
1933 1929 merging d
1934 1930 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1935 1931 abort: unresolved conflicts, can't continue
1936 1932 (use 'hg resolve' and 'hg graft --continue')
1937 1933 [255]
1938 1934
1939 1935 $ hg graft --stop
1940 1936 stopped the interrupted graft
1941 1937 working directory is now at 75b447541a9e
1942 1938
1943 1939 $ hg diff
1944 1940
1945 1941 $ hg log -G -T "{rev}:{node|short} {desc}"
1946 1942 @ 5:75b447541a9e added c
1947 1943 |
1948 1944 o 4:a0deacecd59d added foo to d
1949 1945 |
1950 1946 | o 3:9150fe93bec6 added d
1951 1947 | |
1952 1948 | o 2:155349b645be added c
1953 1949 |/
1954 1950 o 1:5f6d8a4bf34a added b
1955 1951 |
1956 1952 o 0:9092f1db7931 added a
1957 1953
1958 1954 $ cd ..
1959 1955
1960 1956 Testing the --abort flag for `hg graft` which aborts and rollback to state
1961 1957 before the graft
1962 1958
1963 1959 $ hg init abortgraft
1964 1960 $ cd abortgraft
1965 1961 $ for ch in a b c d; do echo $ch > $ch; hg add $ch; hg ci -Aqm "added "$ch; done;
1966 1962
1967 1963 $ hg up '.^^'
1968 1964 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1969 1965
1970 1966 $ echo x > x
1971 1967 $ hg ci -Aqm "added x"
1972 1968 $ hg up '.^'
1973 1969 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1974 1970 $ echo foo > c
1975 1971 $ hg ci -Aqm "added foo to c"
1976 1972
1977 1973 $ hg log -GT "{rev}:{node|short} {desc}"
1978 1974 @ 5:36b793615f78 added foo to c
1979 1975 |
1980 1976 | o 4:863a25e1a9ea added x
1981 1977 |/
1982 1978 | o 3:9150fe93bec6 added d
1983 1979 | |
1984 1980 | o 2:155349b645be added c
1985 1981 |/
1986 1982 o 1:5f6d8a4bf34a added b
1987 1983 |
1988 1984 o 0:9092f1db7931 added a
1989 1985
1990 1986 $ hg up 9150fe93bec6
1991 1987 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1992 1988
1993 1989 $ hg graft --abort
1994 1990 abort: no interrupted graft to abort
1995 1991 [255]
1996 1992
1997 1993 when stripping is required
1998 1994 $ hg graft -r 4 -r 5
1999 1995 grafting 4:863a25e1a9ea "added x"
2000 1996 grafting 5:36b793615f78 "added foo to c" (tip)
2001 1997 merging c
2002 1998 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
2003 1999 abort: unresolved conflicts, can't continue
2004 2000 (use 'hg resolve' and 'hg graft --continue')
2005 2001 [255]
2006 2002
2007 2003 $ hg graft --continue --abort
2008 2004 abort: cannot use '--continue' and '--abort' together
2009 2005 [255]
2010 2006
2011 2007 $ hg graft --abort --stop
2012 2008 abort: cannot use '--abort' and '--stop' together
2013 2009 [255]
2014 2010
2015 2011 $ hg graft --abort --currentuser
2016 2012 abort: cannot specify any other flag with '--abort'
2017 2013 [255]
2018 2014
2019 2015 $ hg graft --abort --edit
2020 2016 abort: cannot specify any other flag with '--abort'
2021 2017 [255]
2022 2018
2023 2019 $ hg graft --abort
2024 2020 graft aborted
2025 2021 working directory is now at 9150fe93bec6
2026 2022 $ hg log -GT "{rev}:{node|short} {desc}"
2027 2023 o 5:36b793615f78 added foo to c
2028 2024 |
2029 2025 | o 4:863a25e1a9ea added x
2030 2026 |/
2031 2027 | @ 3:9150fe93bec6 added d
2032 2028 | |
2033 2029 | o 2:155349b645be added c
2034 2030 |/
2035 2031 o 1:5f6d8a4bf34a added b
2036 2032 |
2037 2033 o 0:9092f1db7931 added a
2038 2034
2039 2035 when stripping is not required
2040 2036 $ hg graft -r 5
2041 2037 grafting 5:36b793615f78 "added foo to c" (tip)
2042 2038 merging c
2043 2039 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
2044 2040 abort: unresolved conflicts, can't continue
2045 2041 (use 'hg resolve' and 'hg graft --continue')
2046 2042 [255]
2047 2043
2048 2044 $ hg graft --abort
2049 2045 graft aborted
2050 2046 working directory is now at 9150fe93bec6
2051 2047 $ hg log -GT "{rev}:{node|short} {desc}"
2052 2048 o 5:36b793615f78 added foo to c
2053 2049 |
2054 2050 | o 4:863a25e1a9ea added x
2055 2051 |/
2056 2052 | @ 3:9150fe93bec6 added d
2057 2053 | |
2058 2054 | o 2:155349b645be added c
2059 2055 |/
2060 2056 o 1:5f6d8a4bf34a added b
2061 2057 |
2062 2058 o 0:9092f1db7931 added a
2063 2059
2064 2060 when some of the changesets became public
2065 2061
2066 2062 $ hg graft -r 4 -r 5
2067 2063 grafting 4:863a25e1a9ea "added x"
2068 2064 grafting 5:36b793615f78 "added foo to c" (tip)
2069 2065 merging c
2070 2066 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
2071 2067 abort: unresolved conflicts, can't continue
2072 2068 (use 'hg resolve' and 'hg graft --continue')
2073 2069 [255]
2074 2070
2075 2071 $ hg log -GT "{rev}:{node|short} {desc}"
2076 2072 @ 6:6ec71c037d94 added x
2077 2073 |
2078 2074 | o 5:36b793615f78 added foo to c
2079 2075 | |
2080 2076 | | o 4:863a25e1a9ea added x
2081 2077 | |/
2082 2078 o | 3:9150fe93bec6 added d
2083 2079 | |
2084 2080 o | 2:155349b645be added c
2085 2081 |/
2086 2082 o 1:5f6d8a4bf34a added b
2087 2083 |
2088 2084 o 0:9092f1db7931 added a
2089 2085
2090 2086 $ hg phase -r 6 --public
2091 2087
2092 2088 $ hg graft --abort
2093 2089 cannot clean up public changesets 6ec71c037d94
2094 2090 graft aborted
2095 2091 working directory is now at 6ec71c037d94
2096 2092
2097 2093 when we created new changesets on top of existing one
2098 2094
2099 2095 $ hg up '.^^'
2100 2096 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
2101 2097 $ echo y > y
2102 2098 $ hg ci -Aqm "added y"
2103 2099 $ echo z > z
2104 2100 $ hg ci -Aqm "added z"
2105 2101
2106 2102 $ hg up 3
2107 2103 1 files updated, 0 files merged, 3 files removed, 0 files unresolved
2108 2104 $ hg log -GT "{rev}:{node|short} {desc}"
2109 2105 o 8:637f9e9bbfd4 added z
2110 2106 |
2111 2107 o 7:123221671fd4 added y
2112 2108 |
2113 2109 | o 6:6ec71c037d94 added x
2114 2110 | |
2115 2111 | | o 5:36b793615f78 added foo to c
2116 2112 | | |
2117 2113 | | | o 4:863a25e1a9ea added x
2118 2114 | | |/
2119 2115 | @ | 3:9150fe93bec6 added d
2120 2116 |/ /
2121 2117 o / 2:155349b645be added c
2122 2118 |/
2123 2119 o 1:5f6d8a4bf34a added b
2124 2120 |
2125 2121 o 0:9092f1db7931 added a
2126 2122
2127 2123 $ hg graft -r 8 -r 7 -r 5
2128 2124 grafting 8:637f9e9bbfd4 "added z" (tip)
2129 2125 grafting 7:123221671fd4 "added y"
2130 2126 grafting 5:36b793615f78 "added foo to c"
2131 2127 merging c
2132 2128 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
2133 2129 abort: unresolved conflicts, can't continue
2134 2130 (use 'hg resolve' and 'hg graft --continue')
2135 2131 [255]
2136 2132
2137 2133 $ cd ..
2138 2134 $ hg init pullrepo
2139 2135 $ cd pullrepo
2140 2136 $ cat >> .hg/hgrc <<EOF
2141 2137 > [phases]
2142 2138 > publish=False
2143 2139 > EOF
2144 2140 $ hg pull ../abortgraft --config phases.publish=False
2145 2141 pulling from ../abortgraft
2146 2142 requesting all changes
2147 2143 adding changesets
2148 2144 adding manifests
2149 2145 adding file changes
2150 2146 added 11 changesets with 9 changes to 8 files (+4 heads)
2151 2147 new changesets 9092f1db7931:6b98ff0062dd (6 drafts)
2152 2148 (run 'hg heads' to see heads, 'hg merge' to merge)
2153 2149 $ hg up 9
2154 2150 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
2155 2151 $ echo w > w
2156 2152 $ hg ci -Aqm "added w" --config phases.publish=False
2157 2153
2158 2154 $ cd ../abortgraft
2159 2155 $ hg pull ../pullrepo
2160 2156 pulling from ../pullrepo
2161 2157 searching for changes
2162 2158 adding changesets
2163 2159 adding manifests
2164 2160 adding file changes
2165 2161 added 1 changesets with 1 changes to 1 files (+1 heads)
2166 2162 new changesets 311dfc6cf3bf (1 drafts)
2167 2163 (run 'hg heads .' to see heads, 'hg merge' to merge)
2168 2164
2169 2165 $ hg graft --abort
2170 2166 new changesets detected on destination branch, can't strip
2171 2167 graft aborted
2172 2168 working directory is now at 6b98ff0062dd
2173 2169
2174 2170 $ cd ..
2175 2171
2176 2172 ============================
2177 2173 Testing --no-commit option:|
2178 2174 ============================
2179 2175
2180 2176 $ hg init nocommit
2181 2177 $ cd nocommit
2182 2178 $ echo a > a
2183 2179 $ hg ci -qAma
2184 2180 $ echo b > b
2185 2181 $ hg ci -qAmb
2186 2182 $ hg up -q 0
2187 2183 $ echo c > c
2188 2184 $ hg ci -qAmc
2189 2185 $ hg log -GT "{rev}:{node|short} {desc}\n"
2190 2186 @ 2:d36c0562f908 c
2191 2187 |
2192 2188 | o 1:d2ae7f538514 b
2193 2189 |/
2194 2190 o 0:cb9a9f314b8b a
2195 2191
2196 2192
2197 2193 Check reporting when --no-commit used with non-applicable options:
2198 2194
2199 2195 $ hg graft 1 --no-commit -e
2200 2196 abort: cannot specify --no-commit and --edit together
2201 2197 [255]
2202 2198
2203 2199 $ hg graft 1 --no-commit --log
2204 2200 abort: cannot specify --no-commit and --log together
2205 2201 [255]
2206 2202
2207 2203 $ hg graft 1 --no-commit -D
2208 2204 abort: cannot specify --no-commit and --currentdate together
2209 2205 [255]
2210 2206
2211 2207 Test --no-commit is working:
2212 2208 $ hg graft 1 --no-commit
2213 2209 grafting 1:d2ae7f538514 "b"
2214 2210
2215 2211 $ hg log -GT "{rev}:{node|short} {desc}\n"
2216 2212 @ 2:d36c0562f908 c
2217 2213 |
2218 2214 | o 1:d2ae7f538514 b
2219 2215 |/
2220 2216 o 0:cb9a9f314b8b a
2221 2217
2222 2218
2223 2219 $ hg diff
2224 2220 diff -r d36c0562f908 b
2225 2221 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2226 2222 +++ b/b Thu Jan 01 00:00:00 1970 +0000
2227 2223 @@ -0,0 +1,1 @@
2228 2224 +b
2229 2225
2230 2226 Prepare wrdir to check --no-commit is resepected after --continue:
2231 2227
2232 2228 $ hg up -qC
2233 2229 $ echo A>a
2234 2230 $ hg ci -qm "A in file a"
2235 2231 $ hg up -q 1
2236 2232 $ echo B>a
2237 2233 $ hg ci -qm "B in file a"
2238 2234 $ hg log -GT "{rev}:{node|short} {desc}\n"
2239 2235 @ 4:2aa9ad1006ff B in file a
2240 2236 |
2241 2237 | o 3:09e253b87e17 A in file a
2242 2238 | |
2243 2239 | o 2:d36c0562f908 c
2244 2240 | |
2245 2241 o | 1:d2ae7f538514 b
2246 2242 |/
2247 2243 o 0:cb9a9f314b8b a
2248 2244
2249 2245
2250 2246 $ hg graft 3 --no-commit
2251 2247 grafting 3:09e253b87e17 "A in file a"
2252 2248 merging a
2253 2249 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
2254 2250 abort: unresolved conflicts, can't continue
2255 2251 (use 'hg resolve' and 'hg graft --continue')
2256 2252 [255]
2257 2253
2258 2254 Resolve conflict:
2259 2255 $ echo A>a
2260 2256 $ hg resolve --mark
2261 2257 (no more unresolved files)
2262 2258 continue: hg graft --continue
2263 2259
2264 2260 $ hg graft --continue
2265 2261 grafting 3:09e253b87e17 "A in file a"
2266 2262 $ hg log -GT "{rev}:{node|short} {desc}\n"
2267 2263 @ 4:2aa9ad1006ff B in file a
2268 2264 |
2269 2265 | o 3:09e253b87e17 A in file a
2270 2266 | |
2271 2267 | o 2:d36c0562f908 c
2272 2268 | |
2273 2269 o | 1:d2ae7f538514 b
2274 2270 |/
2275 2271 o 0:cb9a9f314b8b a
2276 2272
2277 2273 $ hg diff
2278 2274 diff -r 2aa9ad1006ff a
2279 2275 --- a/a Thu Jan 01 00:00:00 1970 +0000
2280 2276 +++ b/a Thu Jan 01 00:00:00 1970 +0000
2281 2277 @@ -1,1 +1,1 @@
2282 2278 -B
2283 2279 +A
2284 2280
2285 2281 $ hg up -qC
2286 2282
2287 2283 Check --no-commit is resepected when passed with --continue:
2288 2284
2289 2285 $ hg graft 3
2290 2286 grafting 3:09e253b87e17 "A in file a"
2291 2287 merging a
2292 2288 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
2293 2289 abort: unresolved conflicts, can't continue
2294 2290 (use 'hg resolve' and 'hg graft --continue')
2295 2291 [255]
2296 2292
2297 2293 Resolve conflict:
2298 2294 $ echo A>a
2299 2295 $ hg resolve --mark
2300 2296 (no more unresolved files)
2301 2297 continue: hg graft --continue
2302 2298
2303 2299 $ hg graft --continue --no-commit
2304 2300 grafting 3:09e253b87e17 "A in file a"
2305 2301 $ hg diff
2306 2302 diff -r 2aa9ad1006ff a
2307 2303 --- a/a Thu Jan 01 00:00:00 1970 +0000
2308 2304 +++ b/a Thu Jan 01 00:00:00 1970 +0000
2309 2305 @@ -1,1 +1,1 @@
2310 2306 -B
2311 2307 +A
2312 2308
2313 2309 $ hg log -GT "{rev}:{node|short} {desc}\n"
2314 2310 @ 4:2aa9ad1006ff B in file a
2315 2311 |
2316 2312 | o 3:09e253b87e17 A in file a
2317 2313 | |
2318 2314 | o 2:d36c0562f908 c
2319 2315 | |
2320 2316 o | 1:d2ae7f538514 b
2321 2317 |/
2322 2318 o 0:cb9a9f314b8b a
2323 2319
2324 2320 $ hg up -qC
2325 2321
2326 2322 Test --no-commit when graft multiple revisions:
2327 2323 When there is conflict:
2328 2324 $ hg graft -r "2::3" --no-commit
2329 2325 grafting 2:d36c0562f908 "c"
2330 2326 grafting 3:09e253b87e17 "A in file a"
2331 2327 merging a
2332 2328 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
2333 2329 abort: unresolved conflicts, can't continue
2334 2330 (use 'hg resolve' and 'hg graft --continue')
2335 2331 [255]
2336 2332
2337 2333 $ echo A>a
2338 2334 $ hg resolve --mark
2339 2335 (no more unresolved files)
2340 2336 continue: hg graft --continue
2341 2337 $ hg graft --continue
2342 2338 grafting 3:09e253b87e17 "A in file a"
2343 2339 $ hg diff
2344 2340 diff -r 2aa9ad1006ff a
2345 2341 --- a/a Thu Jan 01 00:00:00 1970 +0000
2346 2342 +++ b/a Thu Jan 01 00:00:00 1970 +0000
2347 2343 @@ -1,1 +1,1 @@
2348 2344 -B
2349 2345 +A
2350 2346 diff -r 2aa9ad1006ff c
2351 2347 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2352 2348 +++ b/c Thu Jan 01 00:00:00 1970 +0000
2353 2349 @@ -0,0 +1,1 @@
2354 2350 +c
2355 2351
2356 2352 $ hg log -GT "{rev}:{node|short} {desc}\n"
2357 2353 @ 4:2aa9ad1006ff B in file a
2358 2354 |
2359 2355 | o 3:09e253b87e17 A in file a
2360 2356 | |
2361 2357 | o 2:d36c0562f908 c
2362 2358 | |
2363 2359 o | 1:d2ae7f538514 b
2364 2360 |/
2365 2361 o 0:cb9a9f314b8b a
2366 2362
2367 2363 $ hg up -qC
2368 2364
2369 2365 When there is no conflict:
2370 2366 $ echo d>d
2371 2367 $ hg add d -q
2372 2368 $ hg ci -qmd
2373 2369 $ hg up 3 -q
2374 2370 $ hg log -GT "{rev}:{node|short} {desc}\n"
2375 2371 o 5:baefa8927fc0 d
2376 2372 |
2377 2373 o 4:2aa9ad1006ff B in file a
2378 2374 |
2379 2375 | @ 3:09e253b87e17 A in file a
2380 2376 | |
2381 2377 | o 2:d36c0562f908 c
2382 2378 | |
2383 2379 o | 1:d2ae7f538514 b
2384 2380 |/
2385 2381 o 0:cb9a9f314b8b a
2386 2382
2387 2383
2388 2384 $ hg graft -r 1 -r 5 --no-commit
2389 2385 grafting 1:d2ae7f538514 "b"
2390 2386 grafting 5:baefa8927fc0 "d" (tip)
2391 2387 $ hg diff
2392 2388 diff -r 09e253b87e17 b
2393 2389 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2394 2390 +++ b/b Thu Jan 01 00:00:00 1970 +0000
2395 2391 @@ -0,0 +1,1 @@
2396 2392 +b
2397 2393 diff -r 09e253b87e17 d
2398 2394 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2399 2395 +++ b/d Thu Jan 01 00:00:00 1970 +0000
2400 2396 @@ -0,0 +1,1 @@
2401 2397 +d
2402 2398 $ hg log -GT "{rev}:{node|short} {desc}\n"
2403 2399 o 5:baefa8927fc0 d
2404 2400 |
2405 2401 o 4:2aa9ad1006ff B in file a
2406 2402 |
2407 2403 | @ 3:09e253b87e17 A in file a
2408 2404 | |
2409 2405 | o 2:d36c0562f908 c
2410 2406 | |
2411 2407 o | 1:d2ae7f538514 b
2412 2408 |/
2413 2409 o 0:cb9a9f314b8b a
2414 2410
2415 2411 $ cd ..
@@ -1,73 +1,72 b''
1 1 #require execbit
2 2
3 3 Create extension that can disable exec checks:
4 4
5 5 $ cat > noexec.py <<EOF
6 6 > from mercurial import extensions, util
7 7 > def setflags(orig, f, l, x):
8 8 > pass
9 9 > def checkexec(orig, path):
10 10 > return False
11 11 > def extsetup(ui):
12 12 > extensions.wrapfunction(util, 'setflags', setflags)
13 13 > extensions.wrapfunction(util, 'checkexec', checkexec)
14 14 > EOF
15 15
16 16 $ hg init unix-repo
17 17 $ cd unix-repo
18 18 $ touch a
19 19 $ hg add a
20 20 $ hg commit -m 'unix: add a'
21 21 $ hg clone . ../win-repo
22 22 updating to branch default
23 23 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
24 24 $ chmod +x a
25 25 $ hg commit -m 'unix: chmod a'
26 26 $ hg manifest -v
27 27 755 * a
28 28
29 29 $ cd ../win-repo
30 30
31 31 $ touch b
32 32 $ hg add b
33 33 $ hg commit -m 'win: add b'
34 34
35 35 $ hg manifest -v
36 36 644 a
37 37 644 b
38 38
39 39 $ hg pull
40 40 pulling from $TESTTMP/unix-repo
41 41 searching for changes
42 42 adding changesets
43 43 adding manifests
44 44 adding file changes
45 45 added 1 changesets with 0 changes to 0 files (+1 heads)
46 46 new changesets 2d8bcf2dda39
47 47 (run 'hg heads' to see heads, 'hg merge' to merge)
48 48
49 49 $ hg manifest -v -r tip
50 50 755 * a
51 51
52 52 Simulate a Windows merge:
53 53
54 54 $ hg --config extensions.n=$TESTTMP/noexec.py merge --debug
55 searching for copies back to rev 1
56 55 unmatched files in local:
57 56 b
58 57 resolving manifests
59 58 branchmerge: True, force: False, partial: False
60 59 ancestor: a03b0deabf2b, local: d6fa54f68ae1+, remote: 2d8bcf2dda39
61 60 a: update permissions -> e
62 61 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
63 62 (branch merge, don't forget to commit)
64 63
65 64 Simulate a Windows commit:
66 65
67 66 $ hg --config extensions.n=$TESTTMP/noexec.py commit -m 'win: merge'
68 67
69 68 $ hg manifest -v
70 69 755 * a
71 70 644 b
72 71
73 72 $ cd ..
@@ -1,55 +1,54 b''
1 1 https://bz.mercurial-scm.org/522
2 2
3 3 In the merge below, the file "foo" has the same contents in both
4 4 parents, but if we look at the file-level history, we'll notice that
5 5 the version in p1 is an ancestor of the version in p2. This test makes
6 6 sure that we'll use the version from p2 in the manifest of the merge
7 7 revision.
8 8
9 9 $ hg init
10 10
11 11 $ echo foo > foo
12 12 $ hg ci -qAm 'add foo'
13 13
14 14 $ echo bar >> foo
15 15 $ hg ci -m 'change foo'
16 16
17 17 $ hg backout -r tip -m 'backout changed foo'
18 18 reverting foo
19 19 changeset 2:4d9e78aaceee backs out changeset 1:b515023e500e
20 20
21 21 $ hg up -C 0
22 22 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
23 23
24 24 $ touch bar
25 25 $ hg ci -qAm 'add bar'
26 26
27 27 $ hg merge --debug
28 searching for copies back to rev 1
29 28 unmatched files in local:
30 29 bar
31 30 resolving manifests
32 31 branchmerge: True, force: False, partial: False
33 32 ancestor: bbd179dfa0a7, local: 71766447bdbb+, remote: 4d9e78aaceee
34 33 foo: remote is newer -> g
35 34 getting foo
36 35 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
37 36 (branch merge, don't forget to commit)
38 37
39 38 $ hg debugstate | grep foo
40 39 m 0 -2 unset foo
41 40
42 41 $ hg st -A foo
43 42 M foo
44 43
45 44 $ hg ci -m 'merge'
46 45
47 46 $ hg manifest --debug | grep foo
48 47 c6fc755d7e68f49f880599da29f15add41f42f5a 644 foo
49 48
50 49 $ hg debugindex foo
51 50 rev linkrev nodeid p1 p2
52 51 0 0 2ed2a3912a0b 000000000000 000000000000
53 52 1 1 6f4310b00b9a 2ed2a3912a0b 000000000000
54 53 2 2 c6fc755d7e68 6f4310b00b9a 000000000000
55 54
@@ -1,99 +1,96 b''
1 1 https://bz.mercurial-scm.org/672
2 2
3 3 # 0-2-4
4 4 # \ \ \
5 5 # 1-3-5
6 6 #
7 7 # rename in #1, content change in #4.
8 8
9 9 $ hg init
10 10
11 11 $ touch 1
12 12 $ touch 2
13 13 $ hg commit -Am init # 0
14 14 adding 1
15 15 adding 2
16 16
17 17 $ hg rename 1 1a
18 18 $ hg commit -m rename # 1
19 19
20 20 $ hg co -C 0
21 21 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
22 22
23 23 $ echo unrelated >> 2
24 24 $ hg ci -m unrelated1 # 2
25 25 created new head
26 26
27 27 $ hg merge --debug 1
28 searching for copies back to rev 1
29 28 unmatched files in other:
30 29 1a
31 30 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
32 31 src: '1' -> dst: '1a'
33 32 checking for directory renames
34 33 resolving manifests
35 34 branchmerge: True, force: False, partial: False
36 35 ancestor: 81f4b099af3d, local: c64f439569a9+, remote: c12dcd37c90a
37 36 1: other deleted -> r
38 37 removing 1
39 38 1a: remote created -> g
40 39 getting 1a
41 40 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
42 41 (branch merge, don't forget to commit)
43 42
44 43 $ hg ci -m merge1 # 3
45 44
46 45 $ hg co -C 2
47 46 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
48 47
49 48 $ echo hello >> 1
50 49 $ hg ci -m unrelated2 # 4
51 50 created new head
52 51
53 52 $ hg co -C 3
54 53 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
55 54
56 55 $ hg merge -y --debug 4
57 searching for copies back to rev 1
58 56 unmatched files in local:
59 57 1a
60 58 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
61 59 src: '1' -> dst: '1a' *
62 60 checking for directory renames
63 61 resolving manifests
64 62 branchmerge: True, force: False, partial: False
65 63 ancestor: c64f439569a9, local: e327dca35ac8+, remote: 746e9549ea96
66 64 preserving 1a for resolve of 1a
65 1a: local copied/moved from 1 -> m (premerge)
67 66 starting 4 threads for background file closing (?)
68 1a: local copied/moved from 1 -> m (premerge)
69 67 picked tool ':merge' for 1a (binary False symlink False changedelete False)
70 68 merging 1a and 1 to 1a
71 69 my 1a@e327dca35ac8+ other 1@746e9549ea96 ancestor 1@c64f439569a9
72 70 premerge successful
73 71 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
74 72 (branch merge, don't forget to commit)
75 73
76 74 $ hg co -C 4
77 75 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
78 76
79 77 $ hg merge -y --debug 3
80 searching for copies back to rev 1
81 78 unmatched files in other:
82 79 1a
83 80 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
84 81 src: '1' -> dst: '1a' *
85 82 checking for directory renames
86 83 resolving manifests
87 84 branchmerge: True, force: False, partial: False
88 85 ancestor: c64f439569a9, local: 746e9549ea96+, remote: e327dca35ac8
89 86 preserving 1 for resolve of 1a
90 87 removing 1
88 1a: remote moved from 1 -> m (premerge)
91 89 starting 4 threads for background file closing (?)
92 1a: remote moved from 1 -> m (premerge)
93 90 picked tool ':merge' for 1a (binary False symlink False changedelete False)
94 91 merging 1 and 1a to 1a
95 92 my 1a@746e9549ea96+ other 1a@e327dca35ac8 ancestor 1@c64f439569a9
96 93 premerge successful
97 94 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
98 95 (branch merge, don't forget to commit)
99 96
@@ -1,185 +1,183 b''
1 1 Check that renames are correctly saved by a commit after a merge
2 2
3 3 Test with the merge on 3 having the rename on the local parent
4 4
5 5 $ hg init a
6 6 $ cd a
7 7
8 8 $ echo line1 > foo
9 9 $ hg add foo
10 10 $ hg ci -m '0: add foo'
11 11
12 12 $ echo line2 >> foo
13 13 $ hg ci -m '1: change foo'
14 14
15 15 $ hg up -C 0
16 16 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
17 17
18 18 $ hg mv foo bar
19 19 $ rm bar
20 20 $ echo line0 > bar
21 21 $ echo line1 >> bar
22 22 $ hg ci -m '2: mv foo bar; change bar'
23 23 created new head
24 24
25 25 $ hg merge 1
26 26 merging bar and foo to bar
27 27 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
28 28 (branch merge, don't forget to commit)
29 29
30 30 $ cat bar
31 31 line0
32 32 line1
33 33 line2
34 34
35 35 $ hg ci -m '3: merge with local rename'
36 36
37 37 $ hg debugindex bar
38 38 rev linkrev nodeid p1 p2
39 39 0 2 d35118874825 000000000000 000000000000
40 40 1 3 5345f5ab8abd 000000000000 d35118874825
41 41
42 42 $ hg debugrename bar
43 43 bar renamed from foo:9e25c27b87571a1edee5ae4dddee5687746cc8e2
44 44
45 45 $ hg debugindex foo
46 46 rev linkrev nodeid p1 p2
47 47 0 0 690b295714ae 000000000000 000000000000
48 48 1 1 9e25c27b8757 690b295714ae 000000000000
49 49
50 50
51 51 Revert the content change from rev 2:
52 52
53 53 $ hg up -C 2
54 54 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
55 55 $ rm bar
56 56 $ echo line1 > bar
57 57 $ hg ci -m '4: revert content change from rev 2'
58 58 created new head
59 59
60 60 $ hg log --template '{rev}:{node|short} {parents}\n'
61 61 4:2263c1be0967 2:0f2ff26688b9
62 62 3:0555950ead28 2:0f2ff26688b9 1:5cd961e4045d
63 63 2:0f2ff26688b9 0:2665aaee66e9
64 64 1:5cd961e4045d
65 65 0:2665aaee66e9
66 66
67 67 This should use bar@rev2 as the ancestor:
68 68
69 69 $ hg --debug merge 3
70 searching for copies back to rev 1
71 70 resolving manifests
72 71 branchmerge: True, force: False, partial: False
73 72 ancestor: 0f2ff26688b9, local: 2263c1be0967+, remote: 0555950ead28
74 73 preserving bar for resolve of bar
75 74 starting 4 threads for background file closing (?)
76 75 bar: versions differ -> m (premerge)
77 76 picked tool ':merge' for bar (binary False symlink False changedelete False)
78 77 merging bar
79 78 my bar@2263c1be0967+ other bar@0555950ead28 ancestor bar@0f2ff26688b9
80 79 premerge successful
81 80 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
82 81 (branch merge, don't forget to commit)
83 82
84 83 $ cat bar
85 84 line1
86 85 line2
87 86
88 87 $ hg ci -m '5: merge'
89 88
90 89 $ hg debugindex bar
91 90 rev linkrev nodeid p1 p2
92 91 0 2 d35118874825 000000000000 000000000000
93 92 1 3 5345f5ab8abd 000000000000 d35118874825
94 93 2 4 ff4b45017382 d35118874825 000000000000
95 94 3 5 3701b4893544 ff4b45017382 5345f5ab8abd
96 95
97 96
98 97 Same thing, but with the merge on 3 having the rename
99 98 on the remote parent:
100 99
101 100 $ cd ..
102 101 $ hg clone -U -r 1 -r 2 a b
103 102 adding changesets
104 103 adding manifests
105 104 adding file changes
106 105 added 3 changesets with 3 changes to 2 files (+1 heads)
107 106 new changesets 2665aaee66e9:0f2ff26688b9
108 107 $ cd b
109 108
110 109 $ hg up -C 1
111 110 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
112 111
113 112 $ hg merge 2
114 113 merging foo and bar to bar
115 114 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
116 115 (branch merge, don't forget to commit)
117 116
118 117 $ cat bar
119 118 line0
120 119 line1
121 120 line2
122 121
123 122 $ hg ci -m '3: merge with remote rename'
124 123
125 124 $ hg debugindex bar
126 125 rev linkrev nodeid p1 p2
127 126 0 2 d35118874825 000000000000 000000000000
128 127 1 3 5345f5ab8abd 000000000000 d35118874825
129 128
130 129 $ hg debugrename bar
131 130 bar renamed from foo:9e25c27b87571a1edee5ae4dddee5687746cc8e2
132 131
133 132 $ hg debugindex foo
134 133 rev linkrev nodeid p1 p2
135 134 0 0 690b295714ae 000000000000 000000000000
136 135 1 1 9e25c27b8757 690b295714ae 000000000000
137 136
138 137
139 138 Revert the content change from rev 2:
140 139
141 140 $ hg up -C 2
142 141 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
143 142 $ rm bar
144 143 $ echo line1 > bar
145 144 $ hg ci -m '4: revert content change from rev 2'
146 145 created new head
147 146
148 147 $ hg log --template '{rev}:{node|short} {parents}\n'
149 148 4:2263c1be0967 2:0f2ff26688b9
150 149 3:3ffa6b9e35f0 1:5cd961e4045d 2:0f2ff26688b9
151 150 2:0f2ff26688b9 0:2665aaee66e9
152 151 1:5cd961e4045d
153 152 0:2665aaee66e9
154 153
155 154 This should use bar@rev2 as the ancestor:
156 155
157 156 $ hg --debug merge 3
158 searching for copies back to rev 1
159 157 resolving manifests
160 158 branchmerge: True, force: False, partial: False
161 159 ancestor: 0f2ff26688b9, local: 2263c1be0967+, remote: 3ffa6b9e35f0
162 160 preserving bar for resolve of bar
163 161 starting 4 threads for background file closing (?)
164 162 bar: versions differ -> m (premerge)
165 163 picked tool ':merge' for bar (binary False symlink False changedelete False)
166 164 merging bar
167 165 my bar@2263c1be0967+ other bar@3ffa6b9e35f0 ancestor bar@0f2ff26688b9
168 166 premerge successful
169 167 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
170 168 (branch merge, don't forget to commit)
171 169
172 170 $ cat bar
173 171 line1
174 172 line2
175 173
176 174 $ hg ci -m '5: merge'
177 175
178 176 $ hg debugindex bar
179 177 rev linkrev nodeid p1 p2
180 178 0 2 d35118874825 000000000000 000000000000
181 179 1 3 5345f5ab8abd 000000000000 d35118874825
182 180 2 4 ff4b45017382 d35118874825 000000000000
183 181 3 5 3701b4893544 ff4b45017382 5345f5ab8abd
184 182
185 183 $ cd ..
@@ -1,459 +1,450 b''
1 1 Criss cross merging
2 2
3 3 $ hg init criss-cross
4 4 $ cd criss-cross
5 5 $ echo '0 base' > f1
6 6 $ echo '0 base' > f2
7 7 $ hg ci -Aqm '0 base'
8 8
9 9 $ echo '1 first change' > f1
10 10 $ hg ci -m '1 first change f1'
11 11
12 12 $ hg up -qr0
13 13 $ echo '2 first change' > f2
14 14 $ hg ci -qm '2 first change f2'
15 15
16 16 $ hg merge -qr 1
17 17 $ hg ci -m '3 merge'
18 18
19 19 $ hg up -qr2
20 20 $ hg merge -qr1
21 21 $ hg ci -qm '4 merge'
22 22
23 23 $ echo '5 second change' > f1
24 24 $ hg ci -m '5 second change f1'
25 25
26 26 $ hg up -r3
27 27 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
28 28 $ echo '6 second change' > f2
29 29 $ hg ci -m '6 second change f2'
30 30
31 31 $ hg log -G
32 32 @ changeset: 6:3b08d01b0ab5
33 33 | tag: tip
34 34 | parent: 3:cf89f02107e5
35 35 | user: test
36 36 | date: Thu Jan 01 00:00:00 1970 +0000
37 37 | summary: 6 second change f2
38 38 |
39 39 | o changeset: 5:adfe50279922
40 40 | | user: test
41 41 | | date: Thu Jan 01 00:00:00 1970 +0000
42 42 | | summary: 5 second change f1
43 43 | |
44 44 | o changeset: 4:7d3e55501ae6
45 45 | |\ parent: 2:40663881a6dd
46 46 | | | parent: 1:0f6b37dbe527
47 47 | | | user: test
48 48 | | | date: Thu Jan 01 00:00:00 1970 +0000
49 49 | | | summary: 4 merge
50 50 | | |
51 51 o---+ changeset: 3:cf89f02107e5
52 52 | | | parent: 2:40663881a6dd
53 53 |/ / parent: 1:0f6b37dbe527
54 54 | | user: test
55 55 | | date: Thu Jan 01 00:00:00 1970 +0000
56 56 | | summary: 3 merge
57 57 | |
58 58 | o changeset: 2:40663881a6dd
59 59 | | parent: 0:40494bf2444c
60 60 | | user: test
61 61 | | date: Thu Jan 01 00:00:00 1970 +0000
62 62 | | summary: 2 first change f2
63 63 | |
64 64 o | changeset: 1:0f6b37dbe527
65 65 |/ user: test
66 66 | date: Thu Jan 01 00:00:00 1970 +0000
67 67 | summary: 1 first change f1
68 68 |
69 69 o changeset: 0:40494bf2444c
70 70 user: test
71 71 date: Thu Jan 01 00:00:00 1970 +0000
72 72 summary: 0 base
73 73
74 74
75 75 $ hg merge -v --debug --tool internal:dump 5 --config merge.preferancestor='!'
76 76 note: using 0f6b37dbe527 as ancestor of 3b08d01b0ab5 and adfe50279922
77 77 alternatively, use --config merge.preferancestor=40663881a6dd
78 searching for copies back to rev 3
79 78 resolving manifests
80 79 branchmerge: True, force: False, partial: False
81 80 ancestor: 0f6b37dbe527, local: 3b08d01b0ab5+, remote: adfe50279922
82 81 preserving f2 for resolve of f2
83 82 f1: remote is newer -> g
84 83 getting f1
85 84 f2: versions differ -> m (premerge)
86 85 picked tool ':dump' for f2 (binary False symlink False changedelete False)
87 86 merging f2
88 87 my f2@3b08d01b0ab5+ other f2@adfe50279922 ancestor f2@0f6b37dbe527
89 88 f2: versions differ -> m (merge)
90 89 picked tool ':dump' for f2 (binary False symlink False changedelete False)
91 90 my f2@3b08d01b0ab5+ other f2@adfe50279922 ancestor f2@0f6b37dbe527
92 91 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
93 92 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
94 93 [1]
95 94
96 95 $ f --dump *
97 96 f1:
98 97 >>>
99 98 5 second change
100 99 <<<
101 100 f2:
102 101 >>>
103 102 6 second change
104 103 <<<
105 104 f2.base:
106 105 >>>
107 106 0 base
108 107 <<<
109 108 f2.local:
110 109 >>>
111 110 6 second change
112 111 <<<
113 112 f2.orig:
114 113 >>>
115 114 6 second change
116 115 <<<
117 116 f2.other:
118 117 >>>
119 118 2 first change
120 119 <<<
121 120
122 121 $ hg up -qC .
123 122 $ hg merge -v --tool internal:dump 5 --config merge.preferancestor="null 40663881 3b08d"
124 123 note: using 40663881a6dd as ancestor of 3b08d01b0ab5 and adfe50279922
125 124 alternatively, use --config merge.preferancestor=0f6b37dbe527
126 125 resolving manifests
127 126 merging f1
128 127 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
129 128 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
130 129 [1]
131 130
132 131 Redo merge with merge.preferancestor="*" to enable bid merge
133 132
134 133 $ rm f*
135 134 $ hg up -qC .
136 135 $ hg merge -v --debug --tool internal:dump 5 --config merge.preferancestor="*"
137 136 note: merging 3b08d01b0ab5+ and adfe50279922 using bids from ancestors 0f6b37dbe527 and 40663881a6dd
138 137
139 138 calculating bids for ancestor 0f6b37dbe527
140 searching for copies back to rev 3
141 139 resolving manifests
142 140 branchmerge: True, force: False, partial: False
143 141 ancestor: 0f6b37dbe527, local: 3b08d01b0ab5+, remote: adfe50279922
144 142 f1: remote is newer -> g
145 143 f2: versions differ -> m
146 144
147 145 calculating bids for ancestor 40663881a6dd
148 searching for copies back to rev 3
149 146 resolving manifests
150 147 branchmerge: True, force: False, partial: False
151 148 ancestor: 40663881a6dd, local: 3b08d01b0ab5+, remote: adfe50279922
152 149 f1: versions differ -> m
153 150 f2: remote unchanged -> k
154 151
155 152 auction for merging merge bids
156 153 f1: picking 'get' action
157 154 f2: picking 'keep' action
158 155 end of auction
159 156
160 157 f1: remote is newer -> g
161 158 getting f1
162 159 f2: remote unchanged -> k
163 160 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
164 161 (branch merge, don't forget to commit)
165 162
166 163 $ f --dump *
167 164 f1:
168 165 >>>
169 166 5 second change
170 167 <<<
171 168 f2:
172 169 >>>
173 170 6 second change
174 171 <<<
175 172
176 173
177 174 The other way around:
178 175
179 176 $ hg up -C -r5
180 177 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
181 178 $ hg merge -v --debug --config merge.preferancestor="*"
182 179 note: merging adfe50279922+ and 3b08d01b0ab5 using bids from ancestors 0f6b37dbe527 and 40663881a6dd
183 180
184 181 calculating bids for ancestor 0f6b37dbe527
185 searching for copies back to rev 3
186 182 resolving manifests
187 183 branchmerge: True, force: False, partial: False
188 184 ancestor: 0f6b37dbe527, local: adfe50279922+, remote: 3b08d01b0ab5
189 185 f1: remote unchanged -> k
190 186 f2: versions differ -> m
191 187
192 188 calculating bids for ancestor 40663881a6dd
193 searching for copies back to rev 3
194 189 resolving manifests
195 190 branchmerge: True, force: False, partial: False
196 191 ancestor: 40663881a6dd, local: adfe50279922+, remote: 3b08d01b0ab5
197 192 f1: versions differ -> m
198 193 f2: remote is newer -> g
199 194
200 195 auction for merging merge bids
201 196 f1: picking 'keep' action
202 197 f2: picking 'get' action
203 198 end of auction
204 199
205 200 f2: remote is newer -> g
206 201 getting f2
207 202 f1: remote unchanged -> k
208 203 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
209 204 (branch merge, don't forget to commit)
210 205
211 206 $ f --dump *
212 207 f1:
213 208 >>>
214 209 5 second change
215 210 <<<
216 211 f2:
217 212 >>>
218 213 6 second change
219 214 <<<
220 215
221 216 Verify how the output looks and and how verbose it is:
222 217
223 218 $ hg up -qC
224 219 $ hg merge
225 220 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
226 221 (branch merge, don't forget to commit)
227 222
228 223 $ hg up -qC tip
229 224 $ hg merge -v
230 225 note: merging 3b08d01b0ab5+ and adfe50279922 using bids from ancestors 0f6b37dbe527 and 40663881a6dd
231 226
232 227 calculating bids for ancestor 0f6b37dbe527
233 228 resolving manifests
234 229
235 230 calculating bids for ancestor 40663881a6dd
236 231 resolving manifests
237 232
238 233 auction for merging merge bids
239 234 f1: picking 'get' action
240 235 f2: picking 'keep' action
241 236 end of auction
242 237
243 238 getting f1
244 239 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
245 240 (branch merge, don't forget to commit)
246 241
247 242 $ hg up -qC
248 243 $ hg merge -v --debug --config merge.preferancestor="*"
249 244 note: merging 3b08d01b0ab5+ and adfe50279922 using bids from ancestors 0f6b37dbe527 and 40663881a6dd
250 245
251 246 calculating bids for ancestor 0f6b37dbe527
252 searching for copies back to rev 3
253 247 resolving manifests
254 248 branchmerge: True, force: False, partial: False
255 249 ancestor: 0f6b37dbe527, local: 3b08d01b0ab5+, remote: adfe50279922
256 250 f1: remote is newer -> g
257 251 f2: versions differ -> m
258 252
259 253 calculating bids for ancestor 40663881a6dd
260 searching for copies back to rev 3
261 254 resolving manifests
262 255 branchmerge: True, force: False, partial: False
263 256 ancestor: 40663881a6dd, local: 3b08d01b0ab5+, remote: adfe50279922
264 257 f1: versions differ -> m
265 258 f2: remote unchanged -> k
266 259
267 260 auction for merging merge bids
268 261 f1: picking 'get' action
269 262 f2: picking 'keep' action
270 263 end of auction
271 264
272 265 f1: remote is newer -> g
273 266 getting f1
274 267 f2: remote unchanged -> k
275 268 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
276 269 (branch merge, don't forget to commit)
277 270
278 271 Test the greatest common ancestor returning multiple changesets
279 272
280 273 $ hg log -r 'heads(commonancestors(head()))'
281 274 changeset: 1:0f6b37dbe527
282 275 user: test
283 276 date: Thu Jan 01 00:00:00 1970 +0000
284 277 summary: 1 first change f1
285 278
286 279 changeset: 2:40663881a6dd
287 280 parent: 0:40494bf2444c
288 281 user: test
289 282 date: Thu Jan 01 00:00:00 1970 +0000
290 283 summary: 2 first change f2
291 284
292 285
293 286 $ cd ..
294 287
295 288 http://stackoverflow.com/questions/9350005/how-do-i-specify-a-merge-base-to-use-in-a-hg-merge/9430810
296 289
297 290 $ hg init ancestor-merging
298 291 $ cd ancestor-merging
299 292 $ echo a > x
300 293 $ hg commit -A -m a x
301 294 $ hg update -q 0
302 295 $ echo b >> x
303 296 $ hg commit -m b
304 297 $ hg update -q 0
305 298 $ echo c >> x
306 299 $ hg commit -qm c
307 300 $ hg update -q 1
308 301 $ hg merge -q --tool internal:local 2
309 302 $ echo c >> x
310 303 $ hg commit -m bc
311 304 $ hg update -q 2
312 305 $ hg merge -q --tool internal:local 1
313 306 $ echo b >> x
314 307 $ hg commit -qm cb
315 308
316 309 $ hg merge --config merge.preferancestor='!'
317 310 note: using 70008a2163f6 as ancestor of 0d355fdef312 and 4b8b546a3eef
318 311 alternatively, use --config merge.preferancestor=b211bbc6eb3c
319 312 merging x
320 313 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
321 314 (branch merge, don't forget to commit)
322 315 $ cat x
323 316 a
324 317 c
325 318 b
326 319 c
327 320
328 321 $ hg up -qC .
329 322
330 323 $ hg merge --config merge.preferancestor=b211bbc6eb3c
331 324 note: using b211bbc6eb3c as ancestor of 0d355fdef312 and 4b8b546a3eef
332 325 alternatively, use --config merge.preferancestor=70008a2163f6
333 326 merging x
334 327 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
335 328 (branch merge, don't forget to commit)
336 329 $ cat x
337 330 a
338 331 b
339 332 c
340 333 b
341 334
342 335 $ hg up -qC .
343 336
344 337 $ hg merge -v --config merge.preferancestor="*"
345 338 note: merging 0d355fdef312+ and 4b8b546a3eef using bids from ancestors 70008a2163f6 and b211bbc6eb3c
346 339
347 340 calculating bids for ancestor 70008a2163f6
348 341 resolving manifests
349 342
350 343 calculating bids for ancestor b211bbc6eb3c
351 344 resolving manifests
352 345
353 346 auction for merging merge bids
354 347 x: multiple bids for merge action:
355 348 versions differ -> m
356 349 versions differ -> m
357 350 x: ambiguous merge - picked m action
358 351 end of auction
359 352
360 353 merging x
361 354 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
362 355 (branch merge, don't forget to commit)
363 356 $ cat x
364 357 a
365 358 c
366 359 b
367 360 c
368 361
369 362 Verify that the old context ancestor works with / despite preferancestor:
370 363
371 364 $ hg log -r 'ancestor(head())' --config merge.preferancestor=1 -T '{rev}\n'
372 365 1
373 366 $ hg log -r 'ancestor(head())' --config merge.preferancestor=2 -T '{rev}\n'
374 367 2
375 368 $ hg log -r 'ancestor(head())' --config merge.preferancestor=3 -T '{rev}\n'
376 369 1
377 370 $ hg log -r 'ancestor(head())' --config merge.preferancestor='1337 * - 2' -T '{rev}\n'
378 371 2
379 372
380 373 $ cd ..
381 374
382 375 $ hg init issue5020
383 376 $ cd issue5020
384 377
385 378 $ echo a > noop
386 379 $ hg ci -qAm initial
387 380
388 381 $ echo b > noop
389 382 $ hg ci -qAm 'uninteresting change'
390 383
391 384 $ hg up -q 0
392 385 $ mkdir d1
393 386 $ echo a > d1/a
394 387 $ echo b > d1/b
395 388 $ hg ci -qAm 'add d1/a and d1/b'
396 389
397 390 $ hg merge -q 1
398 391 $ hg rm d1/a
399 392 $ hg mv -q d1 d2
400 393 $ hg ci -qm 'merge while removing d1/a and moving d1/b to d2/b'
401 394
402 395 $ hg up -q 1
403 396 $ hg merge -q 2
404 397 $ hg ci -qm 'merge (no changes while merging)'
405 398 $ hg log -G -T '{rev}:{node|short} {desc}'
406 399 @ 4:c0ef19750a22 merge (no changes while merging)
407 400 |\
408 401 +---o 3:6ca01f7342b9 merge while removing d1/a and moving d1/b to d2/b
409 402 | |/
410 403 | o 2:154e6000f54e add d1/a and d1/b
411 404 | |
412 405 o | 1:11b5b303e36c uninteresting change
413 406 |/
414 407 o 0:7b54db1ebf33 initial
415 408
416 409 $ hg merge 3 --debug
417 410 note: merging c0ef19750a22+ and 6ca01f7342b9 using bids from ancestors 11b5b303e36c and 154e6000f54e
418 411
419 412 calculating bids for ancestor 11b5b303e36c
420 searching for copies back to rev 3
421 413 unmatched files in local:
422 414 d1/a
423 415 d1/b
424 416 unmatched files in other:
425 417 d2/b
426 418 resolving manifests
427 419 branchmerge: True, force: False, partial: False
428 420 ancestor: 11b5b303e36c, local: c0ef19750a22+, remote: 6ca01f7342b9
429 421 d2/b: remote created -> g
430 422
431 423 calculating bids for ancestor 154e6000f54e
432 searching for copies back to rev 3
433 424 unmatched files in other:
434 425 d2/b
435 426 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
436 427 src: 'd1/b' -> dst: 'd2/b'
437 428 checking for directory renames
438 429 discovered dir src: 'd1/' -> dst: 'd2/'
439 430 resolving manifests
440 431 branchmerge: True, force: False, partial: False
441 432 ancestor: 154e6000f54e, local: c0ef19750a22+, remote: 6ca01f7342b9
442 433 d1/a: other deleted -> r
443 434 d1/b: other deleted -> r
444 435 d2/b: remote created -> g
445 436
446 437 auction for merging merge bids
447 438 d1/a: consensus for r
448 439 d1/b: consensus for r
449 440 d2/b: consensus for g
450 441 end of auction
451 442
452 443 d1/a: other deleted -> r
453 444 removing d1/a
454 445 d1/b: other deleted -> r
455 446 removing d1/b
456 447 d2/b: remote created -> g
457 448 getting d2/b
458 449 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
459 450 (branch merge, don't forget to commit)
@@ -1,454 +1,448 b''
1 1 #require symlink execbit
2 2
3 3 $ tellmeabout() {
4 4 > if [ -h $1 ]; then
5 5 > echo $1 is a symlink:
6 6 > $TESTDIR/readlink.py $1
7 7 > elif [ -x $1 ]; then
8 8 > echo $1 is an executable file with content:
9 9 > cat $1
10 10 > else
11 11 > echo $1 is a plain file with content:
12 12 > cat $1
13 13 > fi
14 14 > }
15 15
16 16 $ hg init test1
17 17 $ cd test1
18 18
19 19 $ echo a > a
20 20 $ hg ci -Aqmadd
21 21 $ chmod +x a
22 22 $ hg ci -mexecutable
23 23
24 24 $ hg up -q 0
25 25 $ rm a
26 26 $ ln -s symlink a
27 27 $ hg ci -msymlink
28 28 created new head
29 29
30 30 Symlink is local parent, executable is other:
31 31
32 32 $ hg merge --debug
33 searching for copies back to rev 1
34 33 resolving manifests
35 34 branchmerge: True, force: False, partial: False
36 35 ancestor: c334dc3be0da, local: 521a1e40188f+, remote: 3574f3e69b1c
37 36 preserving a for resolve of a
38 37 a: versions differ -> m (premerge)
39 38 tool internal:merge (for pattern a) can't handle symlinks
40 39 couldn't find merge tool hgmerge
41 40 no tool found to merge a
42 41 picked tool ':prompt' for a (binary False symlink True changedelete False)
43 42 keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for a? u
44 43 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
45 44 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
46 45 [1]
47 46
48 47 $ tellmeabout a
49 48 a is a symlink:
50 49 a -> symlink
51 50 $ hg resolve a --tool internal:other
52 51 (no more unresolved files)
53 52 $ tellmeabout a
54 53 a is an executable file with content:
55 54 a
56 55 $ hg st
57 56 M a
58 57 ? a.orig
59 58
60 59 Symlink is other parent, executable is local:
61 60
62 61 $ hg update -C 1
63 62 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
64 63
65 64 $ hg merge --debug --tool :union
66 searching for copies back to rev 1
67 65 resolving manifests
68 66 branchmerge: True, force: False, partial: False
69 67 ancestor: c334dc3be0da, local: 3574f3e69b1c+, remote: 521a1e40188f
70 68 preserving a for resolve of a
71 69 a: versions differ -> m (premerge)
72 70 picked tool ':union' for a (binary False symlink True changedelete False)
73 71 merging a
74 72 my a@3574f3e69b1c+ other a@521a1e40188f ancestor a@c334dc3be0da
75 73 warning: internal :union cannot merge symlinks for a
76 74 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
77 75 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
78 76 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
79 77 [1]
80 78
81 79 $ tellmeabout a
82 80 a is an executable file with content:
83 81 a
84 82
85 83 $ hg update -C 1
86 84 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
87 85
88 86 $ hg merge --debug --tool :merge3
89 searching for copies back to rev 1
90 87 resolving manifests
91 88 branchmerge: True, force: False, partial: False
92 89 ancestor: c334dc3be0da, local: 3574f3e69b1c+, remote: 521a1e40188f
93 90 preserving a for resolve of a
94 91 a: versions differ -> m (premerge)
95 92 picked tool ':merge3' for a (binary False symlink True changedelete False)
96 93 merging a
97 94 my a@3574f3e69b1c+ other a@521a1e40188f ancestor a@c334dc3be0da
98 95 warning: internal :merge3 cannot merge symlinks for a
99 96 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
100 97 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
101 98 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
102 99 [1]
103 100
104 101 $ tellmeabout a
105 102 a is an executable file with content:
106 103 a
107 104
108 105 $ hg update -C 1
109 106 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
110 107
111 108 $ hg merge --debug --tool :merge-local
112 searching for copies back to rev 1
113 109 resolving manifests
114 110 branchmerge: True, force: False, partial: False
115 111 ancestor: c334dc3be0da, local: 3574f3e69b1c+, remote: 521a1e40188f
116 112 preserving a for resolve of a
117 113 a: versions differ -> m (premerge)
118 114 picked tool ':merge-local' for a (binary False symlink True changedelete False)
119 115 merging a
120 116 my a@3574f3e69b1c+ other a@521a1e40188f ancestor a@c334dc3be0da
121 117 warning: internal :merge-local cannot merge symlinks for a
122 118 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
123 119 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
124 120 [1]
125 121
126 122 $ tellmeabout a
127 123 a is an executable file with content:
128 124 a
129 125
130 126 $ hg update -C 1
131 127 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
132 128
133 129 $ hg merge --debug --tool :merge-other
134 searching for copies back to rev 1
135 130 resolving manifests
136 131 branchmerge: True, force: False, partial: False
137 132 ancestor: c334dc3be0da, local: 3574f3e69b1c+, remote: 521a1e40188f
138 133 preserving a for resolve of a
139 134 a: versions differ -> m (premerge)
140 135 picked tool ':merge-other' for a (binary False symlink True changedelete False)
141 136 merging a
142 137 my a@3574f3e69b1c+ other a@521a1e40188f ancestor a@c334dc3be0da
143 138 warning: internal :merge-other cannot merge symlinks for a
144 139 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
145 140 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
146 141 [1]
147 142
148 143 $ tellmeabout a
149 144 a is an executable file with content:
150 145 a
151 146
152 147 Update to link without local change should get us a symlink (issue3316):
153 148
154 149 $ hg up -C 0
155 150 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
156 151 $ hg up
157 152 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
158 153 updated to "521a1e40188f: symlink"
159 154 1 other heads for branch "default"
160 155 $ hg st
161 156 ? a.orig
162 157
163 158 Update to link with local change should cause a merge prompt (issue3200):
164 159
165 160 $ hg up -Cq 0
166 161 $ echo data > a
167 162 $ HGMERGE= hg up -y --debug --config ui.merge=
168 searching for copies back to rev 2
169 163 resolving manifests
170 164 branchmerge: False, force: False, partial: False
171 165 ancestor: c334dc3be0da, local: c334dc3be0da+, remote: 521a1e40188f
172 166 preserving a for resolve of a
173 167 a: versions differ -> m (premerge)
174 168 (couldn't find merge tool hgmerge|tool hgmerge can't handle symlinks) (re)
175 169 no tool found to merge a
176 170 picked tool ':prompt' for a (binary False symlink True changedelete False)
177 171 keep (l)ocal [working copy], take (o)ther [destination], or leave (u)nresolved for a? u
178 172 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
179 173 use 'hg resolve' to retry unresolved file merges
180 174 updated to "521a1e40188f: symlink"
181 175 1 other heads for branch "default"
182 176 [1]
183 177 $ hg diff --git
184 178 diff --git a/a b/a
185 179 old mode 120000
186 180 new mode 100644
187 181 --- a/a
188 182 +++ b/a
189 183 @@ -1,1 +1,1 @@
190 184 -symlink
191 185 \ No newline at end of file
192 186 +data
193 187
194 188
195 189 Test only 'l' change - happens rarely, except when recovering from situations
196 190 where that was what happened.
197 191
198 192 $ hg init test2
199 193 $ cd test2
200 194 $ printf base > f
201 195 $ hg ci -Aqm0
202 196 $ echo file > f
203 197 $ echo content >> f
204 198 $ hg ci -qm1
205 199 $ hg up -qr0
206 200 $ rm f
207 201 $ ln -s base f
208 202 $ hg ci -qm2
209 203 $ hg merge
210 204 tool internal:merge (for pattern f) can't handle symlinks
211 205 no tool found to merge f
212 206 keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for f? u
213 207 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
214 208 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
215 209 [1]
216 210 $ tellmeabout f
217 211 f is a symlink:
218 212 f -> base
219 213
220 214 $ hg up -Cqr1
221 215 $ hg merge
222 216 tool internal:merge (for pattern f) can't handle symlinks
223 217 no tool found to merge f
224 218 keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for f? u
225 219 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
226 220 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
227 221 [1]
228 222 $ tellmeabout f
229 223 f is a plain file with content:
230 224 file
231 225 content
232 226
233 227 $ cd ..
234 228
235 229 Test removed 'x' flag merged with change to symlink
236 230
237 231 $ hg init test3
238 232 $ cd test3
239 233 $ echo f > f
240 234 $ chmod +x f
241 235 $ hg ci -Aqm0
242 236 $ chmod -x f
243 237 $ hg ci -qm1
244 238 $ hg up -qr0
245 239 $ rm f
246 240 $ ln -s dangling f
247 241 $ hg ci -qm2
248 242 $ hg merge
249 243 tool internal:merge (for pattern f) can't handle symlinks
250 244 no tool found to merge f
251 245 keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for f? u
252 246 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
253 247 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
254 248 [1]
255 249 $ tellmeabout f
256 250 f is a symlink:
257 251 f -> dangling
258 252
259 253 $ hg up -Cqr1
260 254 $ hg merge
261 255 tool internal:merge (for pattern f) can't handle symlinks
262 256 no tool found to merge f
263 257 keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for f? u
264 258 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
265 259 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
266 260 [1]
267 261 $ tellmeabout f
268 262 f is a plain file with content:
269 263 f
270 264
271 265 Test removed 'x' flag merged with content change - both ways
272 266
273 267 $ hg up -Cqr0
274 268 $ echo change > f
275 269 $ hg ci -qm3
276 270 $ hg merge -r1
277 271 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
278 272 (branch merge, don't forget to commit)
279 273 $ tellmeabout f
280 274 f is a plain file with content:
281 275 change
282 276
283 277 $ hg up -qCr1
284 278 $ hg merge -r3
285 279 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
286 280 (branch merge, don't forget to commit)
287 281 $ tellmeabout f
288 282 f is a plain file with content:
289 283 change
290 284
291 285 $ cd ..
292 286
293 287 Test merge with no common ancestor:
294 288 a: just different
295 289 b: x vs -, different (cannot calculate x, cannot ask merge tool)
296 290 c: x vs -, same (cannot calculate x, merge tool is no good)
297 291 d: x vs l, different
298 292 e: x vs l, same
299 293 f: - vs l, different
300 294 g: - vs l, same
301 295 h: l vs l, different
302 296 (where same means the filelog entry is shared and there thus is an ancestor!)
303 297
304 298 $ hg init test4
305 299 $ cd test4
306 300 $ echo 0 > 0
307 301 $ hg ci -Aqm0
308 302
309 303 $ echo 1 > a
310 304 $ echo 1 > b
311 305 $ chmod +x b
312 306 $ echo 1 > bx
313 307 $ chmod +x bx
314 308 $ echo x > c
315 309 $ chmod +x c
316 310 $ echo 1 > d
317 311 $ chmod +x d
318 312 $ printf x > e
319 313 $ chmod +x e
320 314 $ echo 1 > f
321 315 $ printf x > g
322 316 $ ln -s 1 h
323 317 $ hg ci -qAm1
324 318
325 319 $ hg up -qr0
326 320 $ echo 2 > a
327 321 $ echo 2 > b
328 322 $ echo 2 > bx
329 323 $ chmod +x bx
330 324 $ echo x > c
331 325 $ ln -s 2 d
332 326 $ ln -s x e
333 327 $ ln -s 2 f
334 328 $ ln -s x g
335 329 $ ln -s 2 h
336 330 $ hg ci -Aqm2
337 331
338 332 $ hg merge
339 333 merging a
340 334 warning: cannot merge flags for b without common ancestor - keeping local flags
341 335 merging b
342 336 merging bx
343 337 warning: cannot merge flags for c without common ancestor - keeping local flags
344 338 tool internal:merge (for pattern d) can't handle symlinks
345 339 no tool found to merge d
346 340 keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for d? u
347 341 tool internal:merge (for pattern f) can't handle symlinks
348 342 no tool found to merge f
349 343 keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for f? u
350 344 tool internal:merge (for pattern h) can't handle symlinks
351 345 no tool found to merge h
352 346 keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for h? u
353 347 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
354 348 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
355 349 warning: conflicts while merging bx! (edit, then use 'hg resolve --mark')
356 350 3 files updated, 0 files merged, 0 files removed, 6 files unresolved
357 351 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
358 352 [1]
359 353 $ hg resolve -l
360 354 U a
361 355 U b
362 356 U bx
363 357 U d
364 358 U f
365 359 U h
366 360 $ tellmeabout a
367 361 a is a plain file with content:
368 362 <<<<<<< working copy: 0c617753b41b - test: 2
369 363 2
370 364 =======
371 365 1
372 366 >>>>>>> merge rev: 2e60aa20b912 - test: 1
373 367 $ tellmeabout b
374 368 b is a plain file with content:
375 369 <<<<<<< working copy: 0c617753b41b - test: 2
376 370 2
377 371 =======
378 372 1
379 373 >>>>>>> merge rev: 2e60aa20b912 - test: 1
380 374 $ tellmeabout c
381 375 c is a plain file with content:
382 376 x
383 377 $ tellmeabout d
384 378 d is a symlink:
385 379 d -> 2
386 380 $ tellmeabout e
387 381 e is a symlink:
388 382 e -> x
389 383 $ tellmeabout f
390 384 f is a symlink:
391 385 f -> 2
392 386 $ tellmeabout g
393 387 g is a symlink:
394 388 g -> x
395 389 $ tellmeabout h
396 390 h is a symlink:
397 391 h -> 2
398 392
399 393 $ hg up -Cqr1
400 394 $ hg merge
401 395 merging a
402 396 warning: cannot merge flags for b without common ancestor - keeping local flags
403 397 merging b
404 398 merging bx
405 399 warning: cannot merge flags for c without common ancestor - keeping local flags
406 400 tool internal:merge (for pattern d) can't handle symlinks
407 401 no tool found to merge d
408 402 keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for d? u
409 403 tool internal:merge (for pattern f) can't handle symlinks
410 404 no tool found to merge f
411 405 keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for f? u
412 406 tool internal:merge (for pattern h) can't handle symlinks
413 407 no tool found to merge h
414 408 keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for h? u
415 409 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
416 410 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
417 411 warning: conflicts while merging bx! (edit, then use 'hg resolve --mark')
418 412 3 files updated, 0 files merged, 0 files removed, 6 files unresolved
419 413 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
420 414 [1]
421 415 $ tellmeabout a
422 416 a is a plain file with content:
423 417 <<<<<<< working copy: 2e60aa20b912 - test: 1
424 418 1
425 419 =======
426 420 2
427 421 >>>>>>> merge rev: 0c617753b41b - test: 2
428 422 $ tellmeabout b
429 423 b is an executable file with content:
430 424 <<<<<<< working copy: 2e60aa20b912 - test: 1
431 425 1
432 426 =======
433 427 2
434 428 >>>>>>> merge rev: 0c617753b41b - test: 2
435 429 $ tellmeabout c
436 430 c is an executable file with content:
437 431 x
438 432 $ tellmeabout d
439 433 d is an executable file with content:
440 434 1
441 435 $ tellmeabout e
442 436 e is an executable file with content:
443 437 x (no-eol)
444 438 $ tellmeabout f
445 439 f is a plain file with content:
446 440 1
447 441 $ tellmeabout g
448 442 g is a plain file with content:
449 443 x (no-eol)
450 444 $ tellmeabout h
451 445 h is a symlink:
452 446 h -> 1
453 447
454 448 $ cd ..
@@ -1,151 +1,150 b''
1 1 initial
2 2 $ hg init test-a
3 3 $ cd test-a
4 4 $ cat >test.txt <<"EOF"
5 5 > 1
6 6 > 2
7 7 > 3
8 8 > EOF
9 9 $ hg add test.txt
10 10 $ hg commit -m "Initial"
11 11
12 12 clone
13 13 $ cd ..
14 14 $ hg clone test-a test-b
15 15 updating to branch default
16 16 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
17 17
18 18 change test-a
19 19 $ cd test-a
20 20 $ cat >test.txt <<"EOF"
21 21 > one
22 22 > two
23 23 > three
24 24 > EOF
25 25 $ hg commit -m "Numbers as words"
26 26
27 27 change test-b
28 28 $ cd ../test-b
29 29 $ cat >test.txt <<"EOF"
30 30 > 1
31 31 > 2.5
32 32 > 3
33 33 > EOF
34 34 $ hg commit -m "2 -> 2.5"
35 35
36 36 now pull and merge from test-a
37 37 $ hg pull ../test-a
38 38 pulling from ../test-a
39 39 searching for changes
40 40 adding changesets
41 41 adding manifests
42 42 adding file changes
43 43 added 1 changesets with 1 changes to 1 files (+1 heads)
44 44 new changesets 96b70246a118
45 45 (run 'hg heads' to see heads, 'hg merge' to merge)
46 46 $ hg merge
47 47 merging test.txt
48 48 warning: conflicts while merging test.txt! (edit, then use 'hg resolve --mark')
49 49 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
50 50 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
51 51 [1]
52 52 resolve conflict
53 53 $ cat >test.txt <<"EOF"
54 54 > one
55 55 > two-point-five
56 56 > three
57 57 > EOF
58 58 $ rm -f *.orig
59 59 $ hg resolve -m test.txt
60 60 (no more unresolved files)
61 61 $ hg commit -m "Merge 1"
62 62
63 63 change test-a again
64 64 $ cd ../test-a
65 65 $ cat >test.txt <<"EOF"
66 66 > one
67 67 > two-point-one
68 68 > three
69 69 > EOF
70 70 $ hg commit -m "two -> two-point-one"
71 71
72 72 pull and merge from test-a again
73 73 $ cd ../test-b
74 74 $ hg pull ../test-a
75 75 pulling from ../test-a
76 76 searching for changes
77 77 adding changesets
78 78 adding manifests
79 79 adding file changes
80 80 added 1 changesets with 1 changes to 1 files (+1 heads)
81 81 new changesets 40d11a4173a8
82 82 (run 'hg heads' to see heads, 'hg merge' to merge)
83 83 $ hg merge --debug
84 searching for copies back to rev 1
85 84 resolving manifests
86 85 branchmerge: True, force: False, partial: False
87 86 ancestor: 96b70246a118, local: 50c3a7e29886+, remote: 40d11a4173a8
88 87 preserving test.txt for resolve of test.txt
89 88 starting 4 threads for background file closing (?)
90 89 test.txt: versions differ -> m (premerge)
91 90 picked tool ':merge' for test.txt (binary False symlink False changedelete False)
92 91 merging test.txt
93 92 my test.txt@50c3a7e29886+ other test.txt@40d11a4173a8 ancestor test.txt@96b70246a118
94 93 test.txt: versions differ -> m (merge)
95 94 picked tool ':merge' for test.txt (binary False symlink False changedelete False)
96 95 my test.txt@50c3a7e29886+ other test.txt@40d11a4173a8 ancestor test.txt@96b70246a118
97 96 warning: conflicts while merging test.txt! (edit, then use 'hg resolve --mark')
98 97 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
99 98 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
100 99 [1]
101 100
102 101 $ cat test.txt
103 102 one
104 103 <<<<<<< working copy: 50c3a7e29886 - test: Merge 1
105 104 two-point-five
106 105 =======
107 106 two-point-one
108 107 >>>>>>> merge rev: 40d11a4173a8 - test: two -> two-point-one
109 108 three
110 109
111 110 $ hg debugindex test.txt
112 111 rev linkrev nodeid p1 p2
113 112 0 0 01365c4cca56 000000000000 000000000000
114 113 1 1 7b013192566a 01365c4cca56 000000000000
115 114 2 2 8fe46a3eb557 01365c4cca56 000000000000
116 115 3 3 fc3148072371 7b013192566a 8fe46a3eb557
117 116 4 4 d40249267ae3 8fe46a3eb557 000000000000
118 117
119 118 $ hg log
120 119 changeset: 4:40d11a4173a8
121 120 tag: tip
122 121 parent: 2:96b70246a118
123 122 user: test
124 123 date: Thu Jan 01 00:00:00 1970 +0000
125 124 summary: two -> two-point-one
126 125
127 126 changeset: 3:50c3a7e29886
128 127 parent: 1:d1e159716d41
129 128 parent: 2:96b70246a118
130 129 user: test
131 130 date: Thu Jan 01 00:00:00 1970 +0000
132 131 summary: Merge 1
133 132
134 133 changeset: 2:96b70246a118
135 134 parent: 0:b1832b9d912a
136 135 user: test
137 136 date: Thu Jan 01 00:00:00 1970 +0000
138 137 summary: Numbers as words
139 138
140 139 changeset: 1:d1e159716d41
141 140 user: test
142 141 date: Thu Jan 01 00:00:00 1970 +0000
143 142 summary: 2 -> 2.5
144 143
145 144 changeset: 0:b1832b9d912a
146 145 user: test
147 146 date: Thu Jan 01 00:00:00 1970 +0000
148 147 summary: Initial
149 148
150 149
151 150 $ cd ..
@@ -1,436 +1,434 b''
1 1 $ cat >> $HGRCPATH <<EOF
2 2 > [extensions]
3 3 > rebase=
4 4 > drawdag=$TESTDIR/drawdag.py
5 5 >
6 6 > [phases]
7 7 > publish=False
8 8 >
9 9 > [alias]
10 10 > tglog = log -G --template "{rev}:{phase} '{desc}' {branches} {bookmarks}\n"
11 11 > EOF
12 12
13 13 $ hg init a
14 14 $ cd a
15 15 $ echo c1 >common
16 16 $ hg add common
17 17 $ hg ci -m C1
18 18
19 19 $ echo c2 >>common
20 20 $ hg ci -m C2
21 21
22 22 $ echo c3 >>common
23 23 $ hg ci -m C3
24 24
25 25 $ hg up -q -C 1
26 26
27 27 $ echo l1 >>extra
28 28 $ hg add extra
29 29 $ hg ci -m L1
30 30 created new head
31 31
32 32 $ sed -e 's/c2/l2/' common > common.new
33 33 $ mv common.new common
34 34 $ hg ci -m L2
35 35
36 36 $ echo l3 >> extra2
37 37 $ hg add extra2
38 38 $ hg ci -m L3
39 39 $ hg bookmark mybook
40 40
41 41 $ hg phase --force --secret 4
42 42
43 43 $ hg tglog
44 44 @ 5:secret 'L3' mybook
45 45 |
46 46 o 4:secret 'L2'
47 47 |
48 48 o 3:draft 'L1'
49 49 |
50 50 | o 2:draft 'C3'
51 51 |/
52 52 o 1:draft 'C2'
53 53 |
54 54 o 0:draft 'C1'
55 55
56 56 Try to call --continue:
57 57
58 58 $ hg rebase --continue
59 59 abort: no rebase in progress
60 60 [255]
61 61
62 62 Conflicting rebase:
63 63
64 64 $ hg rebase -s 3 -d 2
65 65 rebasing 3:3163e20567cc "L1"
66 66 rebasing 4:46f0b057b5c0 "L2"
67 67 merging common
68 68 warning: conflicts while merging common! (edit, then use 'hg resolve --mark')
69 69 unresolved conflicts (see hg resolve, then hg rebase --continue)
70 70 [1]
71 71
72 72 $ hg status --config commands.status.verbose=1
73 73 M common
74 74 ? common.orig
75 75 # The repository is in an unfinished *rebase* state.
76 76
77 77 # Unresolved merge conflicts:
78 78 #
79 79 # common
80 80 #
81 81 # To mark files as resolved: hg resolve --mark FILE
82 82
83 83 # To continue: hg rebase --continue
84 84 # To abort: hg rebase --abort
85 85
86 86
87 87 Try to continue without solving the conflict:
88 88
89 89 $ hg rebase --continue
90 90 abort: unresolved merge conflicts (see 'hg help resolve')
91 91 [255]
92 92
93 93 Conclude rebase:
94 94
95 95 $ echo 'resolved merge' >common
96 96 $ hg resolve -m common
97 97 (no more unresolved files)
98 98 continue: hg rebase --continue
99 99 $ hg rebase --continue
100 100 already rebased 3:3163e20567cc "L1" as 3e046f2ecedb
101 101 rebasing 4:46f0b057b5c0 "L2"
102 102 rebasing 5:8029388f38dc "L3" (mybook)
103 103 saved backup bundle to $TESTTMP/a/.hg/strip-backup/3163e20567cc-5ca4656e-rebase.hg
104 104
105 105 $ hg tglog
106 106 @ 5:secret 'L3' mybook
107 107 |
108 108 o 4:secret 'L2'
109 109 |
110 110 o 3:draft 'L1'
111 111 |
112 112 o 2:draft 'C3'
113 113 |
114 114 o 1:draft 'C2'
115 115 |
116 116 o 0:draft 'C1'
117 117
118 118 Check correctness:
119 119
120 120 $ hg cat -r 0 common
121 121 c1
122 122
123 123 $ hg cat -r 1 common
124 124 c1
125 125 c2
126 126
127 127 $ hg cat -r 2 common
128 128 c1
129 129 c2
130 130 c3
131 131
132 132 $ hg cat -r 3 common
133 133 c1
134 134 c2
135 135 c3
136 136
137 137 $ hg cat -r 4 common
138 138 resolved merge
139 139
140 140 $ hg cat -r 5 common
141 141 resolved merge
142 142
143 143 Bookmark stays active after --continue
144 144 $ hg bookmarks
145 145 * mybook 5:d67b21408fc0
146 146
147 147 $ cd ..
148 148
149 149 Check that the right ancestors is used while rebasing a merge (issue4041)
150 150
151 151 $ hg init issue4041
152 152 $ cd issue4041
153 153 $ hg unbundle "$TESTDIR/bundles/issue4041.hg"
154 154 adding changesets
155 155 adding manifests
156 156 adding file changes
157 157 added 11 changesets with 8 changes to 3 files (+1 heads)
158 158 new changesets 24797d4f68de:2f2496ddf49d (11 drafts)
159 159 (run 'hg heads' to see heads)
160 160 $ hg up default
161 161 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
162 162 $ hg log -G
163 163 o changeset: 10:2f2496ddf49d
164 164 |\ branch: f1
165 165 | | tag: tip
166 166 | | parent: 7:4c9fbe56a16f
167 167 | | parent: 9:e31216eec445
168 168 | | user: szhang
169 169 | | date: Thu Sep 05 12:59:39 2013 -0400
170 170 | | summary: merge
171 171 | |
172 172 | o changeset: 9:e31216eec445
173 173 | | branch: f1
174 174 | | user: szhang
175 175 | | date: Thu Sep 05 12:59:10 2013 -0400
176 176 | | summary: more changes to f1
177 177 | |
178 178 | o changeset: 8:8e4e2c1a07ae
179 179 | |\ branch: f1
180 180 | | | parent: 2:4bc80088dc6b
181 181 | | | parent: 6:400110238667
182 182 | | | user: szhang
183 183 | | | date: Thu Sep 05 12:57:59 2013 -0400
184 184 | | | summary: bad merge
185 185 | | |
186 186 o | | changeset: 7:4c9fbe56a16f
187 187 |/ / branch: f1
188 188 | | parent: 2:4bc80088dc6b
189 189 | | user: szhang
190 190 | | date: Thu Sep 05 12:54:00 2013 -0400
191 191 | | summary: changed f1
192 192 | |
193 193 | o changeset: 6:400110238667
194 194 | | branch: f2
195 195 | | parent: 4:12e8ec6bb010
196 196 | | user: szhang
197 197 | | date: Tue Sep 03 13:58:02 2013 -0400
198 198 | | summary: changed f2 on f2
199 199 | |
200 200 | | @ changeset: 5:d79e2059b5c0
201 201 | | | parent: 3:8a951942e016
202 202 | | | user: szhang
203 203 | | | date: Tue Sep 03 13:57:39 2013 -0400
204 204 | | | summary: changed f2 on default
205 205 | | |
206 206 | o | changeset: 4:12e8ec6bb010
207 207 | |/ branch: f2
208 208 | | user: szhang
209 209 | | date: Tue Sep 03 13:57:18 2013 -0400
210 210 | | summary: created f2 branch
211 211 | |
212 212 | o changeset: 3:8a951942e016
213 213 | | parent: 0:24797d4f68de
214 214 | | user: szhang
215 215 | | date: Tue Sep 03 13:57:11 2013 -0400
216 216 | | summary: added f2.txt
217 217 | |
218 218 o | changeset: 2:4bc80088dc6b
219 219 | | branch: f1
220 220 | | user: szhang
221 221 | | date: Tue Sep 03 13:56:20 2013 -0400
222 222 | | summary: added f1.txt
223 223 | |
224 224 o | changeset: 1:ef53c9e6b608
225 225 |/ branch: f1
226 226 | user: szhang
227 227 | date: Tue Sep 03 13:55:26 2013 -0400
228 228 | summary: created f1 branch
229 229 |
230 230 o changeset: 0:24797d4f68de
231 231 user: szhang
232 232 date: Tue Sep 03 13:55:08 2013 -0400
233 233 summary: added default.txt
234 234
235 235 $ hg rebase -s9 -d2 --debug # use debug to really check merge base used
236 236 rebase onto 4bc80088dc6b starting from e31216eec445
237 237 rebasing on disk
238 238 rebase status stored
239 239 rebasing 9:e31216eec445 "more changes to f1"
240 240 future parents are 2 and -1
241 241 update to 2:4bc80088dc6b
242 242 resolving manifests
243 243 branchmerge: False, force: True, partial: False
244 244 ancestor: d79e2059b5c0+, local: d79e2059b5c0+, remote: 4bc80088dc6b
245 245 f2.txt: other deleted -> r
246 246 removing f2.txt
247 247 f1.txt: remote created -> g
248 248 getting f1.txt
249 249 merge against 9:e31216eec445
250 250 detach base 8:8e4e2c1a07ae
251 searching for copies back to rev 3
252 251 unmatched files in other (from topological common ancestor):
253 252 f2.txt
254 253 resolving manifests
255 254 branchmerge: True, force: True, partial: False
256 255 ancestor: 8e4e2c1a07ae, local: 4bc80088dc6b+, remote: e31216eec445
257 256 f1.txt: remote is newer -> g
258 257 getting f1.txt
259 258 committing files:
260 259 f1.txt
261 260 committing manifest
262 261 committing changelog
263 262 updating the branch cache
264 263 rebased as 19c888675e13
265 264 rebase status stored
266 265 rebasing 10:2f2496ddf49d "merge" (tip)
267 266 future parents are 11 and 7
268 267 already in destination
269 268 merge against 10:2f2496ddf49d
270 269 detach base 9:e31216eec445
271 searching for copies back to rev 3
272 270 unmatched files in other (from topological common ancestor):
273 271 f2.txt
274 272 resolving manifests
275 273 branchmerge: True, force: True, partial: False
276 274 ancestor: e31216eec445, local: 19c888675e13+, remote: 2f2496ddf49d
277 275 f1.txt: remote is newer -> g
278 276 getting f1.txt
279 277 committing files:
280 278 f1.txt
281 279 committing manifest
282 280 committing changelog
283 281 updating the branch cache
284 282 rebased as 2a7f09cac94c
285 283 rebase status stored
286 284 rebase merging completed
287 285 update back to initial working directory parent
288 286 resolving manifests
289 287 branchmerge: False, force: False, partial: False
290 288 ancestor: 2a7f09cac94c, local: 2a7f09cac94c+, remote: d79e2059b5c0
291 289 f1.txt: other deleted -> r
292 290 removing f1.txt
293 291 f2.txt: remote created -> g
294 292 getting f2.txt
295 293 2 changesets found
296 294 list of changesets:
297 295 e31216eec445e44352c5f01588856059466a24c9
298 296 2f2496ddf49d69b5ef23ad8cf9fb2e0e4faf0ac2
299 297 bundle2-output-bundle: "HG20", (1 params) 3 parts total
300 298 bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload
301 299 bundle2-output-part: "cache:rev-branch-cache" (advisory) streamed payload
302 300 bundle2-output-part: "phase-heads" 24 bytes payload
303 301 saved backup bundle to $TESTTMP/issue4041/.hg/strip-backup/e31216eec445-15f7a814-rebase.hg
304 302 3 changesets found
305 303 list of changesets:
306 304 4c9fbe56a16f30c0d5dcc40ec1a97bbe3325209c
307 305 19c888675e133ab5dff84516926a65672eaf04d9
308 306 2a7f09cac94c7f4b73ebd5cd1a62d3b2e8e336bf
309 307 bundle2-output-bundle: "HG20", 3 parts total
310 308 bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload
311 309 bundle2-output-part: "cache:rev-branch-cache" (advisory) streamed payload
312 310 bundle2-output-part: "phase-heads" 24 bytes payload
313 311 adding branch
314 312 bundle2-input-bundle: with-transaction
315 313 bundle2-input-part: "changegroup" (params: 1 mandatory 1 advisory) supported
316 314 adding changesets
317 315 add changeset 4c9fbe56a16f
318 316 add changeset 19c888675e13
319 317 add changeset 2a7f09cac94c
320 318 adding manifests
321 319 adding file changes
322 320 adding f1.txt revisions
323 321 added 2 changesets with 2 changes to 1 files
324 322 bundle2-input-part: total payload size 1686
325 323 bundle2-input-part: "cache:rev-branch-cache" (advisory) supported
326 324 bundle2-input-part: total payload size 74
327 325 truncating cache/rbc-revs-v1 to 56
328 326 bundle2-input-part: "phase-heads" supported
329 327 bundle2-input-part: total payload size 24
330 328 bundle2-input-bundle: 2 parts total
331 329 updating the branch cache
332 330 invalid branchheads cache (served): tip differs
333 331 invalid branchheads cache (served.hidden): tip differs
334 332 rebase completed
335 333
336 334 Test minimization of merge conflicts
337 335 $ hg up -q null
338 336 $ echo a > a
339 337 $ hg add a
340 338 $ hg commit -q -m 'a'
341 339 $ echo b >> a
342 340 $ hg commit -q -m 'ab'
343 341 $ hg bookmark ab
344 342 $ hg up -q '.^'
345 343 $ echo b >> a
346 344 $ echo c >> a
347 345 $ hg commit -q -m 'abc'
348 346 $ hg rebase -s 7bc217434fc1 -d ab --keep
349 347 rebasing 13:7bc217434fc1 "abc" (tip)
350 348 merging a
351 349 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
352 350 unresolved conflicts (see hg resolve, then hg rebase --continue)
353 351 [1]
354 352 $ hg diff
355 353 diff -r 328e4ab1f7cc a
356 354 --- a/a Thu Jan 01 00:00:00 1970 +0000
357 355 +++ b/a * (glob)
358 356 @@ -1,2 +1,6 @@
359 357 a
360 358 b
361 359 +<<<<<<< dest: 328e4ab1f7cc ab - test: ab
362 360 +=======
363 361 +c
364 362 +>>>>>>> source: 7bc217434fc1 - test: abc
365 363 $ hg rebase --abort
366 364 rebase aborted
367 365 $ hg up -q -C 7bc217434fc1
368 366 $ hg rebase -s . -d ab --keep -t internal:merge3
369 367 rebasing 13:7bc217434fc1 "abc" (tip)
370 368 merging a
371 369 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
372 370 unresolved conflicts (see hg resolve, then hg rebase --continue)
373 371 [1]
374 372 $ hg diff
375 373 diff -r 328e4ab1f7cc a
376 374 --- a/a Thu Jan 01 00:00:00 1970 +0000
377 375 +++ b/a * (glob)
378 376 @@ -1,2 +1,8 @@
379 377 a
380 378 +<<<<<<< dest: 328e4ab1f7cc ab - test: ab
381 379 b
382 380 +||||||| base
383 381 +=======
384 382 +b
385 383 +c
386 384 +>>>>>>> source: 7bc217434fc1 - test: abc
387 385
388 386 Test rebase with obsstore turned on and off (issue5606)
389 387
390 388 $ cd $TESTTMP
391 389 $ hg init b
392 390 $ cd b
393 391 $ hg debugdrawdag <<'EOS'
394 392 > D
395 393 > |
396 394 > C
397 395 > |
398 396 > B E
399 397 > |/
400 398 > A
401 399 > EOS
402 400
403 401 $ hg update E -q
404 402 $ echo 3 > B
405 403 $ hg commit --amend -m E -A B -q
406 404 $ hg rebase -r B+D -d . --config experimental.evolution=true
407 405 rebasing 1:112478962961 "B" (B)
408 406 merging B
409 407 warning: conflicts while merging B! (edit, then use 'hg resolve --mark')
410 408 unresolved conflicts (see hg resolve, then hg rebase --continue)
411 409 [1]
412 410
413 411 $ echo 4 > B
414 412 $ hg resolve -m
415 413 (no more unresolved files)
416 414 continue: hg rebase --continue
417 415 $ hg rebase --continue --config experimental.evolution=none
418 416 rebasing 1:112478962961 "B" (B)
419 417 rebasing 3:f585351a92f8 "D" (D)
420 418 warning: orphaned descendants detected, not stripping 112478962961
421 419 saved backup bundle to $TESTTMP/b/.hg/strip-backup/f585351a92f8-e536a9e4-rebase.hg
422 420
423 421 $ rm .hg/localtags
424 422 $ hg tglog
425 423 o 5:draft 'D'
426 424 |
427 425 o 4:draft 'B'
428 426 |
429 427 @ 3:draft 'E'
430 428 |
431 429 | o 2:draft 'C'
432 430 | |
433 431 | o 1:draft 'B'
434 432 |/
435 433 o 0:draft 'A'
436 434
@@ -1,296 +1,294 b''
1 1 $ hg init t
2 2 $ cd t
3 3
4 4 $ mkdir a
5 5 $ echo foo > a/a
6 6 $ echo bar > a/b
7 7 $ hg ci -Am "0"
8 8 adding a/a
9 9 adding a/b
10 10
11 11 $ hg co -C 0
12 12 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
13 13 $ hg mv a b
14 14 moving a/a to b/a
15 15 moving a/b to b/b
16 16 $ hg ci -m "1 mv a/ b/"
17 17
18 18 $ hg co -C 0
19 19 2 files updated, 0 files merged, 2 files removed, 0 files unresolved
20 20 $ echo baz > a/c
21 21 $ echo quux > a/d
22 22 $ hg add a/c
23 23 $ hg ci -m "2 add a/c"
24 24 created new head
25 25
26 26 $ hg merge --debug 1
27 searching for copies back to rev 1
28 27 unmatched files in local:
29 28 a/c
30 29 unmatched files in other:
31 30 b/a
32 31 b/b
33 32 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
34 33 src: 'a/a' -> dst: 'b/a'
35 34 src: 'a/b' -> dst: 'b/b'
36 35 checking for directory renames
37 36 discovered dir src: 'a/' -> dst: 'b/'
38 37 pending file src: 'a/c' -> dst: 'b/c'
39 38 resolving manifests
40 39 branchmerge: True, force: False, partial: False
41 40 ancestor: f9b20c0d4c51, local: ce36d17b18fb+, remote: 397f8b00a740
42 41 a/a: other deleted -> r
43 42 removing a/a
44 43 a/b: other deleted -> r
45 44 removing a/b
46 45 b/a: remote created -> g
47 46 getting b/a
48 47 b/b: remote created -> g
49 48 getting b/b
50 49 b/c: remote directory rename - move from a/c -> dm
51 50 moving a/c to b/c
52 51 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
53 52 (branch merge, don't forget to commit)
54 53
55 54 $ echo a/* b/*
56 55 a/d b/a b/b b/c
57 56 $ hg st -C
58 57 M b/a
59 58 M b/b
60 59 A b/c
61 60 a/c
62 61 R a/a
63 62 R a/b
64 63 R a/c
65 64 ? a/d
66 65 $ hg ci -m "3 merge 2+1"
67 66 $ hg debugrename b/c
68 67 b/c renamed from a/c:354ae8da6e890359ef49ade27b68bbc361f3ca88
69 68
70 69 $ hg co -C 1
71 70 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
72 71 $ hg merge --debug 2
73 searching for copies back to rev 1
74 72 unmatched files in local:
75 73 b/a
76 74 b/b
77 75 unmatched files in other:
78 76 a/c
79 77 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
80 78 src: 'a/a' -> dst: 'b/a'
81 79 src: 'a/b' -> dst: 'b/b'
82 80 checking for directory renames
83 81 discovered dir src: 'a/' -> dst: 'b/'
84 82 pending file src: 'a/c' -> dst: 'b/c'
85 83 resolving manifests
86 84 branchmerge: True, force: False, partial: False
87 85 ancestor: f9b20c0d4c51, local: 397f8b00a740+, remote: ce36d17b18fb
88 86 starting 4 threads for background file closing (?)
89 87 b/c: local directory rename - get from a/c -> dg
90 88 getting a/c to b/c
91 89 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
92 90 (branch merge, don't forget to commit)
93 91
94 92 $ echo a/* b/*
95 93 a/d b/a b/b b/c
96 94 $ hg st -C
97 95 A b/c
98 96 a/c
99 97 ? a/d
100 98 $ hg ci -m "4 merge 1+2"
101 99 created new head
102 100 $ hg debugrename b/c
103 101 b/c renamed from a/c:354ae8da6e890359ef49ade27b68bbc361f3ca88
104 102
105 103 Local directory rename with conflicting file added in remote source directory
106 104 and untracked in local target directory.
107 105
108 106 $ hg co -qC 1
109 107 $ echo target > b/c
110 108 $ hg merge 2
111 109 b/c: untracked file differs
112 110 abort: untracked files in working directory differ from files in requested revision
113 111 [255]
114 112 $ cat b/c
115 113 target
116 114 but it should succeed if the content matches
117 115 $ hg cat -r 2 a/c > b/c
118 116 $ hg merge 2
119 117 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
120 118 (branch merge, don't forget to commit)
121 119 $ hg st -C
122 120 A b/c
123 121 a/c
124 122 ? a/d
125 123
126 124 Local directory rename with conflicting file added in remote source directory
127 125 and committed in local target directory.
128 126
129 127 $ hg co -qC 1
130 128 $ echo target > b/c
131 129 $ hg add b/c
132 130 $ hg commit -qm 'new file in target directory'
133 131 $ hg merge 2
134 132 merging b/c and a/c to b/c
135 133 warning: conflicts while merging b/c! (edit, then use 'hg resolve --mark')
136 134 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
137 135 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
138 136 [1]
139 137 $ hg st -A
140 138 M b/c
141 139 a/c
142 140 ? a/d
143 141 ? b/c.orig
144 142 C b/a
145 143 C b/b
146 144 $ cat b/c
147 145 <<<<<<< working copy: f1c50ca4f127 - test: new file in target directory
148 146 target
149 147 =======
150 148 baz
151 149 >>>>>>> merge rev: ce36d17b18fb - test: 2 add a/c
152 150 $ rm b/c.orig
153 151
154 152 Remote directory rename with conflicting file added in remote target directory
155 153 and committed in local source directory.
156 154
157 155 $ hg co -qC 2
158 156 $ hg st -A
159 157 ? a/d
160 158 C a/a
161 159 C a/b
162 160 C a/c
163 161 $ hg merge 5
164 162 merging a/c and b/c to b/c
165 163 warning: conflicts while merging b/c! (edit, then use 'hg resolve --mark')
166 164 2 files updated, 0 files merged, 2 files removed, 1 files unresolved
167 165 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
168 166 [1]
169 167 $ hg st -A
170 168 M b/a
171 169 M b/b
172 170 M b/c
173 171 a/c
174 172 R a/a
175 173 R a/b
176 174 R a/c
177 175 ? a/d
178 176 ? b/c.orig
179 177 $ cat b/c
180 178 <<<<<<< working copy: ce36d17b18fb - test: 2 add a/c
181 179 baz
182 180 =======
183 181 target
184 182 >>>>>>> merge rev: f1c50ca4f127 - test: new file in target directory
185 183
186 184 Second scenario with two repos:
187 185
188 186 $ cd ..
189 187 $ hg init r1
190 188 $ cd r1
191 189 $ mkdir a
192 190 $ echo foo > a/f
193 191 $ hg add a
194 192 adding a/f
195 193 $ hg ci -m "a/f == foo"
196 194 $ cd ..
197 195
198 196 $ hg clone r1 r2
199 197 updating to branch default
200 198 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
201 199 $ cd r2
202 200 $ hg mv a b
203 201 moving a/f to b/f
204 202 $ echo foo1 > b/f
205 203 $ hg ci -m" a -> b, b/f == foo1"
206 204 $ cd ..
207 205
208 206 $ cd r1
209 207 $ mkdir a/aa
210 208 $ echo bar > a/aa/g
211 209 $ hg add a/aa
212 210 adding a/aa/g
213 211 $ hg ci -m "a/aa/g"
214 212 $ hg pull ../r2
215 213 pulling from ../r2
216 214 searching for changes
217 215 adding changesets
218 216 adding manifests
219 217 adding file changes
220 218 added 1 changesets with 1 changes to 1 files (+1 heads)
221 219 new changesets 7d51ed18da25
222 220 1 local changesets published
223 221 (run 'hg heads' to see heads, 'hg merge' to merge)
224 222
225 223 $ hg merge
226 224 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
227 225 (branch merge, don't forget to commit)
228 226
229 227 $ hg st -C
230 228 M b/f
231 229 A b/aa/g
232 230 a/aa/g
233 231 R a/aa/g
234 232 R a/f
235 233
236 234 $ cd ..
237 235
238 236 Test renames to separate directories
239 237
240 238 $ hg init a
241 239 $ cd a
242 240 $ mkdir a
243 241 $ touch a/s
244 242 $ touch a/t
245 243 $ hg ci -Am0
246 244 adding a/s
247 245 adding a/t
248 246
249 247 Add more files
250 248
251 249 $ touch a/s2
252 250 $ touch a/t2
253 251 $ hg ci -Am1
254 252 adding a/s2
255 253 adding a/t2
256 254
257 255 Do moves on a branch
258 256
259 257 $ hg up 0
260 258 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
261 259 $ mkdir s
262 260 $ mkdir t
263 261 $ hg mv a/s s
264 262 $ hg mv a/t t
265 263 $ hg ci -Am2
266 264 created new head
267 265 $ hg st --copies --change .
268 266 A s/s
269 267 a/s
270 268 A t/t
271 269 a/t
272 270 R a/s
273 271 R a/t
274 272
275 273 Merge shouldn't move s2, t2
276 274
277 275 $ hg merge
278 276 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
279 277 (branch merge, don't forget to commit)
280 278 $ hg st --copies
281 279 M a/s2
282 280 M a/t2
283 281
284 282 Try the merge in the other direction. It may or may not be appropriate for
285 283 status to list copies here.
286 284
287 285 $ hg up -C 1
288 286 4 files updated, 0 files merged, 2 files removed, 0 files unresolved
289 287 $ hg merge
290 288 2 files updated, 0 files merged, 2 files removed, 0 files unresolved
291 289 (branch merge, don't forget to commit)
292 290 $ hg st --copies
293 291 M s/s
294 292 M t/t
295 293 R a/s
296 294 R a/t
@@ -1,188 +1,186 b''
1 1 $ hg init
2 2
3 3 $ echo "[merge]" >> .hg/hgrc
4 4 $ echo "followcopies = 1" >> .hg/hgrc
5 5
6 6 $ echo foo > a
7 7 $ echo foo > a2
8 8 $ hg add a a2
9 9 $ hg ci -m "start"
10 10
11 11 $ hg mv a b
12 12 $ hg mv a2 b2
13 13 $ hg ci -m "rename"
14 14
15 15 $ hg co 0
16 16 2 files updated, 0 files merged, 2 files removed, 0 files unresolved
17 17
18 18 $ echo blahblah > a
19 19 $ echo blahblah > a2
20 20 $ hg mv a2 c2
21 21 $ hg ci -m "modify"
22 22 created new head
23 23
24 24 $ hg merge -y --debug
25 searching for copies back to rev 1
26 25 unmatched files in local:
27 26 c2
28 27 unmatched files in other:
29 28 b
30 29 b2
31 30 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
32 31 src: 'a' -> dst: 'b' *
33 32 src: 'a2' -> dst: 'b2' !
34 33 src: 'a2' -> dst: 'c2' !
35 34 checking for directory renames
36 35 resolving manifests
37 36 branchmerge: True, force: False, partial: False
38 37 ancestor: af1939970a1c, local: 044f8520aeeb+, remote: 85c198ef2f6c
39 38 note: possible conflict - a2 was renamed multiple times to:
40 39 b2
41 40 c2
42 41 preserving a for resolve of b
43 42 removing a
44 43 b2: remote created -> g
45 44 getting b2
46 45 b: remote moved from a -> m (premerge)
47 46 picked tool ':merge' for b (binary False symlink False changedelete False)
48 47 merging a and b to b
49 48 my b@044f8520aeeb+ other b@85c198ef2f6c ancestor a@af1939970a1c
50 49 premerge successful
51 50 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
52 51 (branch merge, don't forget to commit)
53 52
54 53 $ hg status -AC
55 54 M b
56 55 a
57 56 M b2
58 57 R a
59 58 C c2
60 59
61 60 $ cat b
62 61 blahblah
63 62
64 63 $ hg ci -m "merge"
65 64
66 65 $ hg debugindex b
67 66 rev linkrev nodeid p1 p2
68 67 0 1 57eacc201a7f 000000000000 000000000000
69 68 1 3 4727ba907962 000000000000 57eacc201a7f
70 69
71 70 $ hg debugrename b
72 71 b renamed from a:dd03b83622e78778b403775d0d074b9ac7387a66
73 72
74 73 This used to trigger a "divergent renames" warning, despite no renames
75 74
76 75 $ hg cp b b3
77 76 $ hg cp b b4
78 77 $ hg ci -A -m 'copy b twice'
79 78 $ hg up eb92d88a9712
80 79 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
81 80 $ hg up
82 81 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
83 82 $ hg rm b3 b4
84 83 $ hg ci -m 'clean up a bit of our mess'
85 84
86 85 We'd rather not warn on divergent renames done in the same changeset (issue2113)
87 86
88 87 $ hg cp b b3
89 88 $ hg mv b b4
90 89 $ hg ci -A -m 'divergent renames in same changeset'
91 90 $ hg up c761c6948de0
92 91 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
93 92 $ hg up
94 93 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
95 94
96 95 Check for issue2642
97 96
98 97 $ hg init t
99 98 $ cd t
100 99
101 100 $ echo c0 > f1
102 101 $ hg ci -Aqm0
103 102
104 103 $ hg up null -q
105 104 $ echo c1 > f1 # backport
106 105 $ hg ci -Aqm1
107 106 $ hg mv f1 f2
108 107 $ hg ci -qm2
109 108
110 109 $ hg up 0 -q
111 110 $ hg merge 1 -q --tool internal:local
112 111 $ hg ci -qm3
113 112
114 113 $ hg merge 2
115 114 merging f1 and f2 to f2
116 115 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
117 116 (branch merge, don't forget to commit)
118 117
119 118 $ cat f2
120 119 c0
121 120
122 121 $ cd ..
123 122
124 123 Check for issue2089
125 124
126 125 $ hg init repo2089
127 126 $ cd repo2089
128 127
129 128 $ echo c0 > f1
130 129 $ hg ci -Aqm0
131 130
132 131 $ hg up null -q
133 132 $ echo c1 > f1
134 133 $ hg ci -Aqm1
135 134
136 135 $ hg up 0 -q
137 136 $ hg merge 1 -q --tool internal:local
138 137 $ echo c2 > f1
139 138 $ hg ci -qm2
140 139
141 140 $ hg up 1 -q
142 141 $ hg mv f1 f2
143 142 $ hg ci -Aqm3
144 143
145 144 $ hg up 2 -q
146 145 $ hg merge 3
147 146 merging f1 and f2 to f2
148 147 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
149 148 (branch merge, don't forget to commit)
150 149
151 150 $ cat f2
152 151 c2
153 152
154 153 $ cd ..
155 154
156 155 Check for issue3074
157 156
158 157 $ hg init repo3074
159 158 $ cd repo3074
160 159 $ echo foo > file
161 160 $ hg add file
162 161 $ hg commit -m "added file"
163 162 $ hg mv file newfile
164 163 $ hg commit -m "renamed file"
165 164 $ hg update 0
166 165 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
167 166 $ hg rm file
168 167 $ hg commit -m "deleted file"
169 168 created new head
170 169 $ hg merge --debug
171 searching for copies back to rev 1
172 170 unmatched files in other:
173 171 newfile
174 172 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
175 173 src: 'file' -> dst: 'newfile' %
176 174 checking for directory renames
177 175 resolving manifests
178 176 branchmerge: True, force: False, partial: False
179 177 ancestor: 19d7f95df299, local: 0084274f6b67+, remote: 5d32493049f0
180 178 note: possible conflict - file was deleted and renamed to:
181 179 newfile
182 180 newfile: remote created -> g
183 181 getting newfile
184 182 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
185 183 (branch merge, don't forget to commit)
186 184 $ hg status
187 185 M newfile
188 186 $ cd ..
@@ -1,1074 +1,1052 b''
1 1
2 2 $ mkdir -p t
3 3 $ cd t
4 4 $ cat <<EOF > merge
5 5 > import sys, os
6 6 > f = open(sys.argv[1], "w")
7 7 > f.write("merge %s %s %s" % (sys.argv[1], sys.argv[2], sys.argv[3]))
8 8 > f.close()
9 9 > EOF
10 10
11 11 perform a test merge with possible renaming
12 12 args:
13 13 $1 = action in local branch
14 14 $2 = action in remote branch
15 15 $3 = action in working dir
16 16 $4 = expected result
17 17
18 18 $ tm()
19 19 > {
20 20 > hg init t
21 21 > cd t
22 22 > echo "[merge]" >> .hg/hgrc
23 23 > echo "followcopies = 1" >> .hg/hgrc
24 24 >
25 25 > # base
26 26 > echo base > a
27 27 > echo base > rev # used to force commits
28 28 > hg add a rev
29 29 > hg ci -m "base"
30 30 >
31 31 > # remote
32 32 > echo remote > rev
33 33 > if [ "$2" != "" ] ; then $2 ; fi
34 34 > hg ci -m "remote"
35 35 >
36 36 > # local
37 37 > hg co -q 0
38 38 > echo local > rev
39 39 > if [ "$1" != "" ] ; then $1 ; fi
40 40 > hg ci -m "local"
41 41 >
42 42 > # working dir
43 43 > echo local > rev
44 44 > if [ "$3" != "" ] ; then $3 ; fi
45 45 >
46 46 > # merge
47 47 > echo "--------------"
48 48 > echo "test L:$1 R:$2 W:$3 - $4"
49 49 > echo "--------------"
50 50 > hg merge -y --debug --traceback --tool="\"$PYTHON\" ../merge"
51 51 >
52 52 > echo "--------------"
53 53 > hg status -camC -X rev
54 54 >
55 55 > hg ci -m "merge"
56 56 >
57 57 > echo "--------------"
58 58 > echo
59 59 >
60 60 > cd ..
61 61 > rm -r t
62 62 > }
63 63 $ up() {
64 64 > cp rev $1
65 65 > hg add $1 2> /dev/null
66 66 > if [ "$2" != "" ] ; then
67 67 > cp rev $2
68 68 > hg add $2 2> /dev/null
69 69 > fi
70 70 > }
71 71 $ um() { up $1; hg mv $1 $2; }
72 72 $ nc() { hg cp $1 $2; } # just copy
73 73 $ nm() { hg mv $1 $2; } # just move
74 74 $ tm "up a " "nc a b" " " "1 get local a to b"
75 75 created new head
76 76 --------------
77 77 test L:up a R:nc a b W: - 1 get local a to b
78 78 --------------
79 searching for copies back to rev 1
80 79 unmatched files in other:
81 80 b
82 81 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
83 82 src: 'a' -> dst: 'b' *
84 83 checking for directory renames
85 84 resolving manifests
86 85 branchmerge: True, force: False, partial: False
87 86 ancestor: 924404dff337, local: e300d1c794ec+, remote: 4ce40f5aca24
88 87 preserving a for resolve of b
89 88 preserving rev for resolve of rev
90 89 starting 4 threads for background file closing (?)
91 90 b: remote copied from a -> m (premerge)
92 91 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
93 92 merging a and b to b
94 93 my b@e300d1c794ec+ other b@4ce40f5aca24 ancestor a@924404dff337
95 94 premerge successful
96 95 rev: versions differ -> m (premerge)
97 96 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
98 97 merging rev
99 98 my rev@e300d1c794ec+ other rev@4ce40f5aca24 ancestor rev@924404dff337
100 99 rev: versions differ -> m (merge)
101 100 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
102 101 my rev@e300d1c794ec+ other rev@4ce40f5aca24 ancestor rev@924404dff337
103 102 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
104 103 merge tool returned: 0
105 104 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
106 105 (branch merge, don't forget to commit)
107 106 --------------
108 107 M b
109 108 a
110 109 C a
111 110 --------------
112 111
113 112 $ tm "nc a b" "up a " " " "2 get rem change to a and b"
114 113 created new head
115 114 --------------
116 115 test L:nc a b R:up a W: - 2 get rem change to a and b
117 116 --------------
118 searching for copies back to rev 1
119 117 unmatched files in local:
120 118 b
121 119 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
122 120 src: 'a' -> dst: 'b' *
123 121 checking for directory renames
124 122 resolving manifests
125 123 branchmerge: True, force: False, partial: False
126 124 ancestor: 924404dff337, local: 86a2aa42fc76+, remote: f4db7e329e71
127 125 preserving b for resolve of b
128 126 preserving rev for resolve of rev
129 127 a: remote is newer -> g
130 128 getting a
131 129 b: local copied/moved from a -> m (premerge)
132 130 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
133 131 merging b and a to b
134 132 my b@86a2aa42fc76+ other a@f4db7e329e71 ancestor a@924404dff337
135 133 premerge successful
136 134 rev: versions differ -> m (premerge)
137 135 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
138 136 merging rev
139 137 my rev@86a2aa42fc76+ other rev@f4db7e329e71 ancestor rev@924404dff337
140 138 rev: versions differ -> m (merge)
141 139 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
142 140 my rev@86a2aa42fc76+ other rev@f4db7e329e71 ancestor rev@924404dff337
143 141 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
144 142 merge tool returned: 0
145 143 1 files updated, 2 files merged, 0 files removed, 0 files unresolved
146 144 (branch merge, don't forget to commit)
147 145 --------------
148 146 M a
149 147 M b
150 148 a
151 149 --------------
152 150
153 151 $ tm "up a " "nm a b" " " "3 get local a change to b, remove a"
154 152 created new head
155 153 --------------
156 154 test L:up a R:nm a b W: - 3 get local a change to b, remove a
157 155 --------------
158 searching for copies back to rev 1
159 156 unmatched files in other:
160 157 b
161 158 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
162 159 src: 'a' -> dst: 'b' *
163 160 checking for directory renames
164 161 resolving manifests
165 162 branchmerge: True, force: False, partial: False
166 163 ancestor: 924404dff337, local: e300d1c794ec+, remote: bdb19105162a
167 164 preserving a for resolve of b
168 165 preserving rev for resolve of rev
169 166 removing a
170 167 starting 4 threads for background file closing (?)
171 168 b: remote moved from a -> m (premerge)
172 169 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
173 170 merging a and b to b
174 171 my b@e300d1c794ec+ other b@bdb19105162a ancestor a@924404dff337
175 172 premerge successful
176 173 rev: versions differ -> m (premerge)
177 174 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
178 175 merging rev
179 176 my rev@e300d1c794ec+ other rev@bdb19105162a ancestor rev@924404dff337
180 177 rev: versions differ -> m (merge)
181 178 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
182 179 my rev@e300d1c794ec+ other rev@bdb19105162a ancestor rev@924404dff337
183 180 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
184 181 merge tool returned: 0
185 182 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
186 183 (branch merge, don't forget to commit)
187 184 --------------
188 185 M b
189 186 a
190 187 --------------
191 188
192 189 $ tm "nm a b" "up a " " " "4 get remote change to b"
193 190 created new head
194 191 --------------
195 192 test L:nm a b R:up a W: - 4 get remote change to b
196 193 --------------
197 searching for copies back to rev 1
198 194 unmatched files in local:
199 195 b
200 196 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
201 197 src: 'a' -> dst: 'b' *
202 198 checking for directory renames
203 199 resolving manifests
204 200 branchmerge: True, force: False, partial: False
205 201 ancestor: 924404dff337, local: 02963e448370+, remote: f4db7e329e71
206 202 preserving b for resolve of b
207 203 preserving rev for resolve of rev
208 204 starting 4 threads for background file closing (?)
209 205 b: local copied/moved from a -> m (premerge)
210 206 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
211 207 merging b and a to b
212 208 my b@02963e448370+ other a@f4db7e329e71 ancestor a@924404dff337
213 209 premerge successful
214 210 rev: versions differ -> m (premerge)
215 211 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
216 212 merging rev
217 213 my rev@02963e448370+ other rev@f4db7e329e71 ancestor rev@924404dff337
218 214 rev: versions differ -> m (merge)
219 215 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
220 216 my rev@02963e448370+ other rev@f4db7e329e71 ancestor rev@924404dff337
221 217 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
222 218 merge tool returned: 0
223 219 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
224 220 (branch merge, don't forget to commit)
225 221 --------------
226 222 M b
227 223 a
228 224 --------------
229 225
230 226 $ tm " " "nc a b" " " "5 get b"
231 227 created new head
232 228 --------------
233 229 test L: R:nc a b W: - 5 get b
234 230 --------------
235 searching for copies back to rev 1
236 231 unmatched files in other:
237 232 b
238 233 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
239 234 src: 'a' -> dst: 'b'
240 235 checking for directory renames
241 236 resolving manifests
242 237 branchmerge: True, force: False, partial: False
243 238 ancestor: 924404dff337, local: 94b33a1b7f2d+, remote: 4ce40f5aca24
244 239 preserving rev for resolve of rev
245 240 b: remote created -> g
246 241 getting b
247 242 rev: versions differ -> m (premerge)
248 243 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
249 244 merging rev
250 245 my rev@94b33a1b7f2d+ other rev@4ce40f5aca24 ancestor rev@924404dff337
251 246 rev: versions differ -> m (merge)
252 247 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
253 248 my rev@94b33a1b7f2d+ other rev@4ce40f5aca24 ancestor rev@924404dff337
254 249 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
255 250 merge tool returned: 0
256 251 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
257 252 (branch merge, don't forget to commit)
258 253 --------------
259 254 M b
260 255 C a
261 256 --------------
262 257
263 258 $ tm "nc a b" " " " " "6 nothing"
264 259 created new head
265 260 --------------
266 261 test L:nc a b R: W: - 6 nothing
267 262 --------------
268 searching for copies back to rev 1
269 263 unmatched files in local:
270 264 b
271 265 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
272 266 src: 'a' -> dst: 'b'
273 267 checking for directory renames
274 268 resolving manifests
275 269 branchmerge: True, force: False, partial: False
276 270 ancestor: 924404dff337, local: 86a2aa42fc76+, remote: 97c705ade336
277 271 preserving rev for resolve of rev
278 272 starting 4 threads for background file closing (?)
279 273 rev: versions differ -> m (premerge)
280 274 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
281 275 merging rev
282 276 my rev@86a2aa42fc76+ other rev@97c705ade336 ancestor rev@924404dff337
283 277 rev: versions differ -> m (merge)
284 278 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
285 279 my rev@86a2aa42fc76+ other rev@97c705ade336 ancestor rev@924404dff337
286 280 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
287 281 merge tool returned: 0
288 282 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
289 283 (branch merge, don't forget to commit)
290 284 --------------
291 285 C a
292 286 C b
293 287 --------------
294 288
295 289 $ tm " " "nm a b" " " "7 get b"
296 290 created new head
297 291 --------------
298 292 test L: R:nm a b W: - 7 get b
299 293 --------------
300 searching for copies back to rev 1
301 294 unmatched files in other:
302 295 b
303 296 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
304 297 src: 'a' -> dst: 'b'
305 298 checking for directory renames
306 299 resolving manifests
307 300 branchmerge: True, force: False, partial: False
308 301 ancestor: 924404dff337, local: 94b33a1b7f2d+, remote: bdb19105162a
309 302 preserving rev for resolve of rev
310 303 a: other deleted -> r
311 304 removing a
312 305 b: remote created -> g
313 306 getting b
314 307 rev: versions differ -> m (premerge)
315 308 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
316 309 merging rev
317 310 my rev@94b33a1b7f2d+ other rev@bdb19105162a ancestor rev@924404dff337
318 311 rev: versions differ -> m (merge)
319 312 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
320 313 my rev@94b33a1b7f2d+ other rev@bdb19105162a ancestor rev@924404dff337
321 314 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
322 315 merge tool returned: 0
323 316 1 files updated, 1 files merged, 1 files removed, 0 files unresolved
324 317 (branch merge, don't forget to commit)
325 318 --------------
326 319 M b
327 320 --------------
328 321
329 322 $ tm "nm a b" " " " " "8 nothing"
330 323 created new head
331 324 --------------
332 325 test L:nm a b R: W: - 8 nothing
333 326 --------------
334 searching for copies back to rev 1
335 327 unmatched files in local:
336 328 b
337 329 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
338 330 src: 'a' -> dst: 'b'
339 331 checking for directory renames
340 332 resolving manifests
341 333 branchmerge: True, force: False, partial: False
342 334 ancestor: 924404dff337, local: 02963e448370+, remote: 97c705ade336
343 335 preserving rev for resolve of rev
344 336 starting 4 threads for background file closing (?)
345 337 rev: versions differ -> m (premerge)
346 338 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
347 339 merging rev
348 340 my rev@02963e448370+ other rev@97c705ade336 ancestor rev@924404dff337
349 341 rev: versions differ -> m (merge)
350 342 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
351 343 my rev@02963e448370+ other rev@97c705ade336 ancestor rev@924404dff337
352 344 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
353 345 merge tool returned: 0
354 346 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
355 347 (branch merge, don't forget to commit)
356 348 --------------
357 349 C b
358 350 --------------
359 351
360 352 $ tm "um a b" "um a b" " " "9 do merge with ancestor in a"
361 353 created new head
362 354 --------------
363 355 test L:um a b R:um a b W: - 9 do merge with ancestor in a
364 356 --------------
365 searching for copies back to rev 1
366 357 unmatched files new in both:
367 358 b
368 359 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
369 360 src: 'a' -> dst: 'b' *
370 361 checking for directory renames
371 362 resolving manifests
372 363 branchmerge: True, force: False, partial: False
373 364 ancestor: 924404dff337, local: 62e7bf090eba+, remote: 49b6d8032493
374 365 preserving b for resolve of b
375 366 preserving rev for resolve of rev
376 367 starting 4 threads for background file closing (?)
377 368 b: both renamed from a -> m (premerge)
378 369 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
379 370 merging b
380 371 my b@62e7bf090eba+ other b@49b6d8032493 ancestor a@924404dff337
381 372 rev: versions differ -> m (premerge)
382 373 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
383 374 merging rev
384 375 my rev@62e7bf090eba+ other rev@49b6d8032493 ancestor rev@924404dff337
385 376 b: both renamed from a -> m (merge)
386 377 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
387 378 my b@62e7bf090eba+ other b@49b6d8032493 ancestor a@924404dff337
388 379 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
389 380 merge tool returned: 0
390 381 rev: versions differ -> m (merge)
391 382 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
392 383 my rev@62e7bf090eba+ other rev@49b6d8032493 ancestor rev@924404dff337
393 384 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
394 385 merge tool returned: 0
395 386 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
396 387 (branch merge, don't forget to commit)
397 388 --------------
398 389 M b
399 390 --------------
400 391
401 392
402 393 m "um a c" "um x c" " " "10 do merge with no ancestor"
403 394
404 395 $ tm "nm a b" "nm a c" " " "11 get c, keep b"
405 396 created new head
406 397 --------------
407 398 test L:nm a b R:nm a c W: - 11 get c, keep b
408 399 --------------
409 searching for copies back to rev 1
410 400 unmatched files in local:
411 401 b
412 402 unmatched files in other:
413 403 c
414 404 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
415 405 src: 'a' -> dst: 'b' !
416 406 src: 'a' -> dst: 'c' !
417 407 checking for directory renames
418 408 resolving manifests
419 409 branchmerge: True, force: False, partial: False
420 410 ancestor: 924404dff337, local: 02963e448370+, remote: fe905ef2c33e
421 411 note: possible conflict - a was renamed multiple times to:
422 412 b
423 413 c
424 414 preserving rev for resolve of rev
425 415 c: remote created -> g
426 416 getting c
427 417 rev: versions differ -> m (premerge)
428 418 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
429 419 merging rev
430 420 my rev@02963e448370+ other rev@fe905ef2c33e ancestor rev@924404dff337
431 421 rev: versions differ -> m (merge)
432 422 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
433 423 my rev@02963e448370+ other rev@fe905ef2c33e ancestor rev@924404dff337
434 424 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
435 425 merge tool returned: 0
436 426 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
437 427 (branch merge, don't forget to commit)
438 428 --------------
439 429 M c
440 430 C b
441 431 --------------
442 432
443 433 $ tm "nc a b" "up b " " " "12 merge b no ancestor"
444 434 created new head
445 435 --------------
446 436 test L:nc a b R:up b W: - 12 merge b no ancestor
447 437 --------------
448 searching for copies back to rev 1
449 438 unmatched files new in both:
450 439 b
451 440 resolving manifests
452 441 branchmerge: True, force: False, partial: False
453 442 ancestor: 924404dff337, local: 86a2aa42fc76+, remote: af30c7647fc7
454 443 preserving b for resolve of b
455 444 preserving rev for resolve of rev
456 445 starting 4 threads for background file closing (?)
457 446 b: both created -> m (premerge)
458 447 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
459 448 merging b
460 449 my b@86a2aa42fc76+ other b@af30c7647fc7 ancestor b@000000000000
461 450 rev: versions differ -> m (premerge)
462 451 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
463 452 merging rev
464 453 my rev@86a2aa42fc76+ other rev@af30c7647fc7 ancestor rev@924404dff337
465 454 b: both created -> m (merge)
466 455 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
467 456 my b@86a2aa42fc76+ other b@af30c7647fc7 ancestor b@000000000000
468 457 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
469 458 merge tool returned: 0
470 459 rev: versions differ -> m (merge)
471 460 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
472 461 my rev@86a2aa42fc76+ other rev@af30c7647fc7 ancestor rev@924404dff337
473 462 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
474 463 merge tool returned: 0
475 464 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
476 465 (branch merge, don't forget to commit)
477 466 --------------
478 467 M b
479 468 C a
480 469 --------------
481 470
482 471 $ tm "up b " "nm a b" " " "13 merge b no ancestor"
483 472 created new head
484 473 --------------
485 474 test L:up b R:nm a b W: - 13 merge b no ancestor
486 475 --------------
487 searching for copies back to rev 1
488 476 unmatched files new in both:
489 477 b
490 478 resolving manifests
491 479 branchmerge: True, force: False, partial: False
492 480 ancestor: 924404dff337, local: 59318016310c+, remote: bdb19105162a
493 481 preserving b for resolve of b
494 482 preserving rev for resolve of rev
495 483 a: other deleted -> r
496 484 removing a
497 485 starting 4 threads for background file closing (?)
498 486 b: both created -> m (premerge)
499 487 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
500 488 merging b
501 489 my b@59318016310c+ other b@bdb19105162a ancestor b@000000000000
502 490 rev: versions differ -> m (premerge)
503 491 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
504 492 merging rev
505 493 my rev@59318016310c+ other rev@bdb19105162a ancestor rev@924404dff337
506 494 b: both created -> m (merge)
507 495 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
508 496 my b@59318016310c+ other b@bdb19105162a ancestor b@000000000000
509 497 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
510 498 merge tool returned: 0
511 499 rev: versions differ -> m (merge)
512 500 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
513 501 my rev@59318016310c+ other rev@bdb19105162a ancestor rev@924404dff337
514 502 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
515 503 merge tool returned: 0
516 504 0 files updated, 2 files merged, 1 files removed, 0 files unresolved
517 505 (branch merge, don't forget to commit)
518 506 --------------
519 507 M b
520 508 --------------
521 509
522 510 $ tm "nc a b" "up a b" " " "14 merge b no ancestor"
523 511 created new head
524 512 --------------
525 513 test L:nc a b R:up a b W: - 14 merge b no ancestor
526 514 --------------
527 searching for copies back to rev 1
528 515 unmatched files new in both:
529 516 b
530 517 resolving manifests
531 518 branchmerge: True, force: False, partial: False
532 519 ancestor: 924404dff337, local: 86a2aa42fc76+, remote: 8dbce441892a
533 520 preserving b for resolve of b
534 521 preserving rev for resolve of rev
535 522 a: remote is newer -> g
536 523 getting a
537 524 b: both created -> m (premerge)
538 525 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
539 526 merging b
540 527 my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000
541 528 rev: versions differ -> m (premerge)
542 529 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
543 530 merging rev
544 531 my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337
545 532 b: both created -> m (merge)
546 533 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
547 534 my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000
548 535 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
549 536 merge tool returned: 0
550 537 rev: versions differ -> m (merge)
551 538 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
552 539 my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337
553 540 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
554 541 merge tool returned: 0
555 542 1 files updated, 2 files merged, 0 files removed, 0 files unresolved
556 543 (branch merge, don't forget to commit)
557 544 --------------
558 545 M a
559 546 M b
560 547 --------------
561 548
562 549 $ tm "up b " "nm a b" " " "15 merge b no ancestor, remove a"
563 550 created new head
564 551 --------------
565 552 test L:up b R:nm a b W: - 15 merge b no ancestor, remove a
566 553 --------------
567 searching for copies back to rev 1
568 554 unmatched files new in both:
569 555 b
570 556 resolving manifests
571 557 branchmerge: True, force: False, partial: False
572 558 ancestor: 924404dff337, local: 59318016310c+, remote: bdb19105162a
573 559 preserving b for resolve of b
574 560 preserving rev for resolve of rev
575 561 a: other deleted -> r
576 562 removing a
577 563 starting 4 threads for background file closing (?)
578 564 b: both created -> m (premerge)
579 565 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
580 566 merging b
581 567 my b@59318016310c+ other b@bdb19105162a ancestor b@000000000000
582 568 rev: versions differ -> m (premerge)
583 569 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
584 570 merging rev
585 571 my rev@59318016310c+ other rev@bdb19105162a ancestor rev@924404dff337
586 572 b: both created -> m (merge)
587 573 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
588 574 my b@59318016310c+ other b@bdb19105162a ancestor b@000000000000
589 575 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
590 576 merge tool returned: 0
591 577 rev: versions differ -> m (merge)
592 578 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
593 579 my rev@59318016310c+ other rev@bdb19105162a ancestor rev@924404dff337
594 580 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
595 581 merge tool returned: 0
596 582 0 files updated, 2 files merged, 1 files removed, 0 files unresolved
597 583 (branch merge, don't forget to commit)
598 584 --------------
599 585 M b
600 586 --------------
601 587
602 588 $ tm "nc a b" "up a b" " " "16 get a, merge b no ancestor"
603 589 created new head
604 590 --------------
605 591 test L:nc a b R:up a b W: - 16 get a, merge b no ancestor
606 592 --------------
607 searching for copies back to rev 1
608 593 unmatched files new in both:
609 594 b
610 595 resolving manifests
611 596 branchmerge: True, force: False, partial: False
612 597 ancestor: 924404dff337, local: 86a2aa42fc76+, remote: 8dbce441892a
613 598 preserving b for resolve of b
614 599 preserving rev for resolve of rev
615 600 a: remote is newer -> g
616 601 getting a
617 602 b: both created -> m (premerge)
618 603 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
619 604 merging b
620 605 my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000
621 606 rev: versions differ -> m (premerge)
622 607 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
623 608 merging rev
624 609 my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337
625 610 b: both created -> m (merge)
626 611 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
627 612 my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000
628 613 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
629 614 merge tool returned: 0
630 615 rev: versions differ -> m (merge)
631 616 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
632 617 my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337
633 618 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
634 619 merge tool returned: 0
635 620 1 files updated, 2 files merged, 0 files removed, 0 files unresolved
636 621 (branch merge, don't forget to commit)
637 622 --------------
638 623 M a
639 624 M b
640 625 --------------
641 626
642 627 $ tm "up a b" "nc a b" " " "17 keep a, merge b no ancestor"
643 628 created new head
644 629 --------------
645 630 test L:up a b R:nc a b W: - 17 keep a, merge b no ancestor
646 631 --------------
647 searching for copies back to rev 1
648 632 unmatched files new in both:
649 633 b
650 634 resolving manifests
651 635 branchmerge: True, force: False, partial: False
652 636 ancestor: 924404dff337, local: 0b76e65c8289+, remote: 4ce40f5aca24
653 637 preserving b for resolve of b
654 638 preserving rev for resolve of rev
655 639 starting 4 threads for background file closing (?)
656 640 b: both created -> m (premerge)
657 641 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
658 642 merging b
659 643 my b@0b76e65c8289+ other b@4ce40f5aca24 ancestor b@000000000000
660 644 rev: versions differ -> m (premerge)
661 645 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
662 646 merging rev
663 647 my rev@0b76e65c8289+ other rev@4ce40f5aca24 ancestor rev@924404dff337
664 648 b: both created -> m (merge)
665 649 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
666 650 my b@0b76e65c8289+ other b@4ce40f5aca24 ancestor b@000000000000
667 651 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
668 652 merge tool returned: 0
669 653 rev: versions differ -> m (merge)
670 654 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
671 655 my rev@0b76e65c8289+ other rev@4ce40f5aca24 ancestor rev@924404dff337
672 656 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
673 657 merge tool returned: 0
674 658 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
675 659 (branch merge, don't forget to commit)
676 660 --------------
677 661 M b
678 662 C a
679 663 --------------
680 664
681 665 $ tm "nm a b" "up a b" " " "18 merge b no ancestor"
682 666 created new head
683 667 --------------
684 668 test L:nm a b R:up a b W: - 18 merge b no ancestor
685 669 --------------
686 searching for copies back to rev 1
687 670 unmatched files new in both:
688 671 b
689 672 resolving manifests
690 673 branchmerge: True, force: False, partial: False
691 674 ancestor: 924404dff337, local: 02963e448370+, remote: 8dbce441892a
692 675 preserving b for resolve of b
693 676 preserving rev for resolve of rev
694 677 starting 4 threads for background file closing (?)
695 678 a: prompt deleted/changed -> m (premerge)
696 679 picked tool ':prompt' for a (binary False symlink False changedelete True)
697 680 file 'a' was deleted in local [working copy] but was modified in other [merge rev].
698 681 What do you want to do?
699 682 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
700 683 b: both created -> m (premerge)
701 684 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
702 685 merging b
703 686 my b@02963e448370+ other b@8dbce441892a ancestor b@000000000000
704 687 rev: versions differ -> m (premerge)
705 688 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
706 689 merging rev
707 690 my rev@02963e448370+ other rev@8dbce441892a ancestor rev@924404dff337
708 691 b: both created -> m (merge)
709 692 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
710 693 my b@02963e448370+ other b@8dbce441892a ancestor b@000000000000
711 694 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
712 695 merge tool returned: 0
713 696 rev: versions differ -> m (merge)
714 697 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
715 698 my rev@02963e448370+ other rev@8dbce441892a ancestor rev@924404dff337
716 699 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
717 700 merge tool returned: 0
718 701 0 files updated, 2 files merged, 0 files removed, 1 files unresolved
719 702 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
720 703 --------------
721 704 M a
722 705 M b
723 706 abort: unresolved merge conflicts (see 'hg help resolve')
724 707 --------------
725 708
726 709 $ tm "up a b" "nm a b" " " "19 merge b no ancestor, prompt remove a"
727 710 created new head
728 711 --------------
729 712 test L:up a b R:nm a b W: - 19 merge b no ancestor, prompt remove a
730 713 --------------
731 searching for copies back to rev 1
732 714 unmatched files new in both:
733 715 b
734 716 resolving manifests
735 717 branchmerge: True, force: False, partial: False
736 718 ancestor: 924404dff337, local: 0b76e65c8289+, remote: bdb19105162a
737 719 preserving a for resolve of a
738 720 preserving b for resolve of b
739 721 preserving rev for resolve of rev
740 722 starting 4 threads for background file closing (?)
741 723 a: prompt changed/deleted -> m (premerge)
742 724 picked tool ':prompt' for a (binary False symlink False changedelete True)
743 725 file 'a' was deleted in other [merge rev] but was modified in local [working copy].
744 726 What do you want to do?
745 727 use (c)hanged version, (d)elete, or leave (u)nresolved? u
746 728 b: both created -> m (premerge)
747 729 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
748 730 merging b
749 731 my b@0b76e65c8289+ other b@bdb19105162a ancestor b@000000000000
750 732 rev: versions differ -> m (premerge)
751 733 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
752 734 merging rev
753 735 my rev@0b76e65c8289+ other rev@bdb19105162a ancestor rev@924404dff337
754 736 b: both created -> m (merge)
755 737 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
756 738 my b@0b76e65c8289+ other b@bdb19105162a ancestor b@000000000000
757 739 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
758 740 merge tool returned: 0
759 741 rev: versions differ -> m (merge)
760 742 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
761 743 my rev@0b76e65c8289+ other rev@bdb19105162a ancestor rev@924404dff337
762 744 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
763 745 merge tool returned: 0
764 746 0 files updated, 2 files merged, 0 files removed, 1 files unresolved
765 747 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
766 748 --------------
767 749 M b
768 750 C a
769 751 abort: unresolved merge conflicts (see 'hg help resolve')
770 752 --------------
771 753
772 754 $ tm "up a " "um a b" " " "20 merge a and b to b, remove a"
773 755 created new head
774 756 --------------
775 757 test L:up a R:um a b W: - 20 merge a and b to b, remove a
776 758 --------------
777 searching for copies back to rev 1
778 759 unmatched files in other:
779 760 b
780 761 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
781 762 src: 'a' -> dst: 'b' *
782 763 checking for directory renames
783 764 resolving manifests
784 765 branchmerge: True, force: False, partial: False
785 766 ancestor: 924404dff337, local: e300d1c794ec+, remote: 49b6d8032493
786 767 preserving a for resolve of b
787 768 preserving rev for resolve of rev
788 769 removing a
789 770 starting 4 threads for background file closing (?)
790 771 b: remote moved from a -> m (premerge)
791 772 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
792 773 merging a and b to b
793 774 my b@e300d1c794ec+ other b@49b6d8032493 ancestor a@924404dff337
794 775 rev: versions differ -> m (premerge)
795 776 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
796 777 merging rev
797 778 my rev@e300d1c794ec+ other rev@49b6d8032493 ancestor rev@924404dff337
798 779 b: remote moved from a -> m (merge)
799 780 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
800 781 my b@e300d1c794ec+ other b@49b6d8032493 ancestor a@924404dff337
801 782 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
802 783 merge tool returned: 0
803 784 rev: versions differ -> m (merge)
804 785 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
805 786 my rev@e300d1c794ec+ other rev@49b6d8032493 ancestor rev@924404dff337
806 787 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
807 788 merge tool returned: 0
808 789 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
809 790 (branch merge, don't forget to commit)
810 791 --------------
811 792 M b
812 793 a
813 794 --------------
814 795
815 796 $ tm "um a b" "up a " " " "21 merge a and b to b"
816 797 created new head
817 798 --------------
818 799 test L:um a b R:up a W: - 21 merge a and b to b
819 800 --------------
820 searching for copies back to rev 1
821 801 unmatched files in local:
822 802 b
823 803 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
824 804 src: 'a' -> dst: 'b' *
825 805 checking for directory renames
826 806 resolving manifests
827 807 branchmerge: True, force: False, partial: False
828 808 ancestor: 924404dff337, local: 62e7bf090eba+, remote: f4db7e329e71
829 809 preserving b for resolve of b
830 810 preserving rev for resolve of rev
831 811 starting 4 threads for background file closing (?)
832 812 b: local copied/moved from a -> m (premerge)
833 813 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
834 814 merging b and a to b
835 815 my b@62e7bf090eba+ other a@f4db7e329e71 ancestor a@924404dff337
836 816 rev: versions differ -> m (premerge)
837 817 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
838 818 merging rev
839 819 my rev@62e7bf090eba+ other rev@f4db7e329e71 ancestor rev@924404dff337
840 820 b: local copied/moved from a -> m (merge)
841 821 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
842 822 my b@62e7bf090eba+ other a@f4db7e329e71 ancestor a@924404dff337
843 823 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
844 824 merge tool returned: 0
845 825 rev: versions differ -> m (merge)
846 826 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
847 827 my rev@62e7bf090eba+ other rev@f4db7e329e71 ancestor rev@924404dff337
848 828 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
849 829 merge tool returned: 0
850 830 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
851 831 (branch merge, don't forget to commit)
852 832 --------------
853 833 M b
854 834 a
855 835 --------------
856 836
857 837
858 838 m "nm a b" "um x a" " " "22 get a, keep b"
859 839
860 840 $ tm "nm a b" "up a c" " " "23 get c, keep b"
861 841 created new head
862 842 --------------
863 843 test L:nm a b R:up a c W: - 23 get c, keep b
864 844 --------------
865 searching for copies back to rev 1
866 845 unmatched files in local:
867 846 b
868 847 unmatched files in other:
869 848 c
870 849 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
871 850 src: 'a' -> dst: 'b' *
872 851 checking for directory renames
873 852 resolving manifests
874 853 branchmerge: True, force: False, partial: False
875 854 ancestor: 924404dff337, local: 02963e448370+, remote: 2b958612230f
876 855 preserving b for resolve of b
877 856 preserving rev for resolve of rev
878 857 c: remote created -> g
879 858 getting c
880 859 b: local copied/moved from a -> m (premerge)
881 860 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
882 861 merging b and a to b
883 862 my b@02963e448370+ other a@2b958612230f ancestor a@924404dff337
884 863 premerge successful
885 864 rev: versions differ -> m (premerge)
886 865 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
887 866 merging rev
888 867 my rev@02963e448370+ other rev@2b958612230f ancestor rev@924404dff337
889 868 rev: versions differ -> m (merge)
890 869 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
891 870 my rev@02963e448370+ other rev@2b958612230f ancestor rev@924404dff337
892 871 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
893 872 merge tool returned: 0
894 873 1 files updated, 2 files merged, 0 files removed, 0 files unresolved
895 874 (branch merge, don't forget to commit)
896 875 --------------
897 876 M b
898 877 a
899 878 M c
900 879 --------------
901 880
902 881
903 882 $ cd ..
904 883
905 884
906 885 Systematic and terse testing of merge merges and ancestor calculation:
907 886
908 887 Expected result:
909 888
910 889 \ a m1 m2 dst
911 890 0 - f f f "versions differ"
912 891 1 f g g g "versions differ"
913 892 2 f f f f "versions differ"
914 893 3 f f g f+g "remote copied to " + f
915 894 4 f f g g "remote moved to " + f
916 895 5 f g f f+g "local copied to " + f2
917 896 6 f g f g "local moved to " + f2
918 897 7 - (f) f f "remote differs from untracked local"
919 898 8 f (f) f f "remote differs from untracked local"
920 899
921 900 $ hg init ancestortest
922 901 $ cd ancestortest
923 902 $ for x in 1 2 3 4 5 6 8; do mkdir $x; echo a > $x/f; done
924 903 $ hg ci -Aqm "a"
925 904 $ mkdir 0
926 905 $ touch 0/f
927 906 $ hg mv 1/f 1/g
928 907 $ hg cp 5/f 5/g
929 908 $ hg mv 6/f 6/g
930 909 $ hg rm 8/f
931 910 $ for x in */*; do echo m1 > $x; done
932 911 $ hg ci -Aqm "m1"
933 912 $ hg up -qr0
934 913 $ mkdir 0 7
935 914 $ touch 0/f 7/f
936 915 $ hg mv 1/f 1/g
937 916 $ hg cp 3/f 3/g
938 917 $ hg mv 4/f 4/g
939 918 $ for x in */*; do echo m2 > $x; done
940 919 $ hg ci -Aqm "m2"
941 920 $ hg up -qr1
942 921 $ mkdir 7 8
943 922 $ echo m > 7/f
944 923 $ echo m > 8/f
945 924 $ hg merge -f --tool internal:dump -v --debug -r2 | sed '/^resolving manifests/,$d' 2> /dev/null
946 searching for copies back to rev 1
947 925 unmatched files in local:
948 926 5/g
949 927 6/g
950 928 unmatched files in other:
951 929 3/g
952 930 4/g
953 931 7/f
954 932 unmatched files new in both:
955 933 0/f
956 934 1/g
957 935 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
958 936 src: '1/f' -> dst: '1/g' *
959 937 src: '3/f' -> dst: '3/g' *
960 938 src: '4/f' -> dst: '4/g' *
961 939 src: '5/f' -> dst: '5/g' *
962 940 src: '6/f' -> dst: '6/g' *
963 941 checking for directory renames
964 942 $ hg mani
965 943 0/f
966 944 1/g
967 945 2/f
968 946 3/f
969 947 4/f
970 948 5/f
971 949 5/g
972 950 6/g
973 951 $ for f in */*; do echo $f:; cat $f; done
974 952 0/f:
975 953 m1
976 954 0/f.base:
977 955 0/f.local:
978 956 m1
979 957 0/f.orig:
980 958 m1
981 959 0/f.other:
982 960 m2
983 961 1/g:
984 962 m1
985 963 1/g.base:
986 964 a
987 965 1/g.local:
988 966 m1
989 967 1/g.orig:
990 968 m1
991 969 1/g.other:
992 970 m2
993 971 2/f:
994 972 m1
995 973 2/f.base:
996 974 a
997 975 2/f.local:
998 976 m1
999 977 2/f.orig:
1000 978 m1
1001 979 2/f.other:
1002 980 m2
1003 981 3/f:
1004 982 m1
1005 983 3/f.base:
1006 984 a
1007 985 3/f.local:
1008 986 m1
1009 987 3/f.orig:
1010 988 m1
1011 989 3/f.other:
1012 990 m2
1013 991 3/g:
1014 992 m1
1015 993 3/g.base:
1016 994 a
1017 995 3/g.local:
1018 996 m1
1019 997 3/g.orig:
1020 998 m1
1021 999 3/g.other:
1022 1000 m2
1023 1001 4/g:
1024 1002 m1
1025 1003 4/g.base:
1026 1004 a
1027 1005 4/g.local:
1028 1006 m1
1029 1007 4/g.orig:
1030 1008 m1
1031 1009 4/g.other:
1032 1010 m2
1033 1011 5/f:
1034 1012 m1
1035 1013 5/f.base:
1036 1014 a
1037 1015 5/f.local:
1038 1016 m1
1039 1017 5/f.orig:
1040 1018 m1
1041 1019 5/f.other:
1042 1020 m2
1043 1021 5/g:
1044 1022 m1
1045 1023 5/g.base:
1046 1024 a
1047 1025 5/g.local:
1048 1026 m1
1049 1027 5/g.orig:
1050 1028 m1
1051 1029 5/g.other:
1052 1030 m2
1053 1031 6/g:
1054 1032 m1
1055 1033 6/g.base:
1056 1034 a
1057 1035 6/g.local:
1058 1036 m1
1059 1037 6/g.orig:
1060 1038 m1
1061 1039 6/g.other:
1062 1040 m2
1063 1041 7/f:
1064 1042 m
1065 1043 7/f.base:
1066 1044 7/f.local:
1067 1045 m
1068 1046 7/f.orig:
1069 1047 m
1070 1048 7/f.other:
1071 1049 m2
1072 1050 8/f:
1073 1051 m2
1074 1052 $ cd ..
@@ -1,2010 +1,2007 b''
1 1 Let commit recurse into subrepos by default to match pre-2.0 behavior:
2 2
3 3 $ echo "[ui]" >> $HGRCPATH
4 4 $ echo "commitsubrepos = Yes" >> $HGRCPATH
5 5
6 6 $ hg init t
7 7 $ cd t
8 8
9 9 first revision, no sub
10 10
11 11 $ echo a > a
12 12 $ hg ci -Am0
13 13 adding a
14 14
15 15 add first sub
16 16
17 17 $ echo s = s > .hgsub
18 18 $ hg add .hgsub
19 19 $ hg init s
20 20 $ echo a > s/a
21 21
22 22 Issue2232: committing a subrepo without .hgsub
23 23
24 24 $ hg ci -mbad s
25 25 abort: can't commit subrepos without .hgsub
26 26 [255]
27 27
28 28 $ hg -R s add s/a
29 29 $ hg files -S
30 30 .hgsub
31 31 a
32 32 s/a
33 33
34 34 `hg files` respects ui.relative-paths
35 35 BROKEN: shows subrepo paths relative to the subrepo
36 36 $ hg files -S --config ui.relative-paths=no
37 37 .hgsub
38 38 a
39 39 s/a
40 40
41 41 $ hg -R s ci -Ams0
42 42 $ hg sum
43 43 parent: 0:f7b1eb17ad24 tip
44 44 0
45 45 branch: default
46 46 commit: 1 added, 1 subrepos
47 47 update: (current)
48 48 phases: 1 draft
49 49 $ hg ci -m1
50 50
51 51 test handling .hgsubstate "added" explicitly.
52 52
53 53 $ hg parents --template '{node}\n{files}\n'
54 54 7cf8cfea66e410e8e3336508dfeec07b3192de51
55 55 .hgsub .hgsubstate
56 56 $ hg rollback -q
57 57 $ hg add .hgsubstate
58 58 $ hg ci -m1
59 59 $ hg parents --template '{node}\n{files}\n'
60 60 7cf8cfea66e410e8e3336508dfeec07b3192de51
61 61 .hgsub .hgsubstate
62 62
63 63 Subrepopath which overlaps with filepath, does not change warnings in remove()
64 64
65 65 $ mkdir snot
66 66 $ touch snot/file
67 67 $ hg remove -S snot/file
68 68 not removing snot/file: file is untracked
69 69 [1]
70 70 $ hg cat snot/filenot
71 71 snot/filenot: no such file in rev 7cf8cfea66e4
72 72 [1]
73 73 $ rm -r snot
74 74
75 75 Revert subrepo and test subrepo fileset keyword:
76 76
77 77 $ echo b > s/a
78 78 $ hg revert --dry-run "set:subrepo('glob:s*')"
79 79 reverting subrepo s
80 80 reverting s/a
81 81 $ cat s/a
82 82 b
83 83 $ hg revert "set:subrepo('glob:s*')"
84 84 reverting subrepo s
85 85 reverting s/a
86 86 $ cat s/a
87 87 a
88 88 $ rm s/a.orig
89 89
90 90 Revert subrepo with no backup. The "reverting s/a" line is gone since
91 91 we're really running 'hg update' in the subrepo:
92 92
93 93 $ echo b > s/a
94 94 $ hg revert --no-backup s
95 95 reverting subrepo s
96 96
97 97 Issue2022: update -C
98 98
99 99 $ echo b > s/a
100 100 $ hg sum
101 101 parent: 1:7cf8cfea66e4 tip
102 102 1
103 103 branch: default
104 104 commit: 1 subrepos
105 105 update: (current)
106 106 phases: 2 draft
107 107 $ hg co -C 1
108 108 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
109 109 $ hg sum
110 110 parent: 1:7cf8cfea66e4 tip
111 111 1
112 112 branch: default
113 113 commit: (clean)
114 114 update: (current)
115 115 phases: 2 draft
116 116
117 117 commands that require a clean repo should respect subrepos
118 118
119 119 $ echo b >> s/a
120 120 $ hg backout tip
121 121 abort: uncommitted changes in subrepository "s"
122 122 [255]
123 123 $ hg revert -C -R s s/a
124 124
125 125 add sub sub
126 126
127 127 $ echo ss = ss > s/.hgsub
128 128 $ hg init s/ss
129 129 $ echo a > s/ss/a
130 130 $ hg -R s add s/.hgsub
131 131 $ hg -R s/ss add s/ss/a
132 132 $ hg sum
133 133 parent: 1:7cf8cfea66e4 tip
134 134 1
135 135 branch: default
136 136 commit: 1 subrepos
137 137 update: (current)
138 138 phases: 2 draft
139 139 $ hg ci -m2
140 140 committing subrepository s
141 141 committing subrepository s/ss
142 142 $ hg sum
143 143 parent: 2:df30734270ae tip
144 144 2
145 145 branch: default
146 146 commit: (clean)
147 147 update: (current)
148 148 phases: 3 draft
149 149
150 150 test handling .hgsubstate "modified" explicitly.
151 151
152 152 $ hg parents --template '{node}\n{files}\n'
153 153 df30734270ae757feb35e643b7018e818e78a9aa
154 154 .hgsubstate
155 155 $ hg rollback -q
156 156 $ hg status -A .hgsubstate
157 157 M .hgsubstate
158 158 $ hg ci -m2
159 159 $ hg parents --template '{node}\n{files}\n'
160 160 df30734270ae757feb35e643b7018e818e78a9aa
161 161 .hgsubstate
162 162
163 163 bump sub rev (and check it is ignored by ui.commitsubrepos)
164 164
165 165 $ echo b > s/a
166 166 $ hg -R s ci -ms1
167 167 $ hg --config ui.commitsubrepos=no ci -m3
168 168
169 169 leave sub dirty (and check ui.commitsubrepos=no aborts the commit)
170 170
171 171 $ echo c > s/a
172 172 $ hg --config ui.commitsubrepos=no ci -m4
173 173 abort: uncommitted changes in subrepository "s"
174 174 (use --subrepos for recursive commit)
175 175 [255]
176 176 $ hg id
177 177 f6affe3fbfaa+ tip
178 178 $ hg -R s ci -mc
179 179 $ hg id
180 180 f6affe3fbfaa+ tip
181 181 $ echo d > s/a
182 182 $ hg ci -m4
183 183 committing subrepository s
184 184 $ hg tip -R s
185 185 changeset: 4:02dcf1d70411
186 186 tag: tip
187 187 user: test
188 188 date: Thu Jan 01 00:00:00 1970 +0000
189 189 summary: 4
190 190
191 191
192 192 check caching
193 193
194 194 $ hg co 0
195 195 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
196 196 $ hg debugsub
197 197
198 198 restore
199 199
200 200 $ hg co
201 201 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
202 202 $ hg debugsub
203 203 path s
204 204 source s
205 205 revision 02dcf1d704118aee3ee306ccfa1910850d5b05ef
206 206
207 207 new branch for merge tests
208 208
209 209 $ hg co 1
210 210 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
211 211 $ echo t = t >> .hgsub
212 212 $ hg init t
213 213 $ echo t > t/t
214 214 $ hg -R t add t
215 215 adding t/t
216 216
217 217 5
218 218
219 219 $ hg ci -m5 # add sub
220 220 committing subrepository t
221 221 created new head
222 222 $ echo t2 > t/t
223 223
224 224 6
225 225
226 226 $ hg st -R s
227 227 $ hg ci -m6 # change sub
228 228 committing subrepository t
229 229 $ hg debugsub
230 230 path s
231 231 source s
232 232 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
233 233 path t
234 234 source t
235 235 revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad
236 236 $ echo t3 > t/t
237 237
238 238 7
239 239
240 240 $ hg ci -m7 # change sub again for conflict test
241 241 committing subrepository t
242 242 $ hg rm .hgsub
243 243
244 244 8
245 245
246 246 $ hg ci -m8 # remove sub
247 247
248 248 test handling .hgsubstate "removed" explicitly.
249 249
250 250 $ hg parents --template '{node}\n{files}\n'
251 251 96615c1dad2dc8e3796d7332c77ce69156f7b78e
252 252 .hgsub .hgsubstate
253 253 $ hg rollback -q
254 254 $ hg remove .hgsubstate
255 255 $ hg ci -m8
256 256 $ hg parents --template '{node}\n{files}\n'
257 257 96615c1dad2dc8e3796d7332c77ce69156f7b78e
258 258 .hgsub .hgsubstate
259 259
260 260 merge tests
261 261
262 262 $ hg co -C 3
263 263 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
264 264 $ hg merge 5 # test adding
265 265 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
266 266 (branch merge, don't forget to commit)
267 267 $ hg debugsub
268 268 path s
269 269 source s
270 270 revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
271 271 path t
272 272 source t
273 273 revision 60ca1237c19474e7a3978b0dc1ca4e6f36d51382
274 274 $ hg ci -m9
275 275 created new head
276 276 $ hg merge 6 --debug # test change
277 searching for copies back to rev 2
278 277 resolving manifests
279 278 branchmerge: True, force: False, partial: False
280 279 ancestor: 1f14a2e2d3ec, local: f0d2028bf86d+, remote: 1831e14459c4
281 280 starting 4 threads for background file closing (?)
282 281 .hgsubstate: versions differ -> m (premerge)
283 282 subrepo merge f0d2028bf86d+ 1831e14459c4 1f14a2e2d3ec
284 283 subrepo t: other changed, get t:6747d179aa9a688023c4b0cad32e4c92bb7f34ad:hg
285 284 getting subrepo t
286 285 resolving manifests
287 286 branchmerge: False, force: False, partial: False
288 287 ancestor: 60ca1237c194, local: 60ca1237c194+, remote: 6747d179aa9a
289 288 t: remote is newer -> g
290 289 getting t
291 290 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
292 291 (branch merge, don't forget to commit)
293 292 $ hg debugsub
294 293 path s
295 294 source s
296 295 revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
297 296 path t
298 297 source t
299 298 revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad
300 299 $ echo conflict > t/t
301 300 $ hg ci -m10
302 301 committing subrepository t
303 302 $ HGMERGE=internal:merge hg merge --debug 7 # test conflict
304 searching for copies back to rev 2
305 303 resolving manifests
306 304 branchmerge: True, force: False, partial: False
307 305 ancestor: 1831e14459c4, local: e45c8b14af55+, remote: f94576341bcf
308 306 starting 4 threads for background file closing (?)
309 307 .hgsubstate: versions differ -> m (premerge)
310 308 subrepo merge e45c8b14af55+ f94576341bcf 1831e14459c4
311 309 subrepo t: both sides changed
312 310 subrepository t diverged (local revision: 20a0db6fbf6c, remote revision: 7af322bc1198)
313 311 starting 4 threads for background file closing (?)
314 312 (M)erge, keep (l)ocal [working copy] or keep (r)emote [merge rev]? m
315 313 merging subrepository "t"
316 searching for copies back to rev 2
317 314 resolving manifests
318 315 branchmerge: True, force: False, partial: False
319 316 ancestor: 6747d179aa9a, local: 20a0db6fbf6c+, remote: 7af322bc1198
320 317 preserving t for resolve of t
321 318 starting 4 threads for background file closing (?)
322 319 t: versions differ -> m (premerge)
323 320 picked tool ':merge' for t (binary False symlink False changedelete False)
324 321 merging t
325 322 my t@20a0db6fbf6c+ other t@7af322bc1198 ancestor t@6747d179aa9a
326 323 t: versions differ -> m (merge)
327 324 picked tool ':merge' for t (binary False symlink False changedelete False)
328 325 my t@20a0db6fbf6c+ other t@7af322bc1198 ancestor t@6747d179aa9a
329 326 warning: conflicts while merging t! (edit, then use 'hg resolve --mark')
330 327 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
331 328 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
332 329 subrepo t: merge with t:7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4:hg
333 330 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
334 331 (branch merge, don't forget to commit)
335 332
336 333 should conflict
337 334
338 335 $ cat t/t
339 336 <<<<<<< local: 20a0db6fbf6c - test: 10
340 337 conflict
341 338 =======
342 339 t3
343 340 >>>>>>> other: 7af322bc1198 - test: 7
344 341
345 342 11: remove subrepo t
346 343
347 344 $ hg co -C 5
348 345 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
349 346 $ hg revert -r 4 .hgsub # remove t
350 347 $ hg ci -m11
351 348 created new head
352 349 $ hg debugsub
353 350 path s
354 351 source s
355 352 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
356 353
357 354 local removed, remote changed, keep changed
358 355
359 356 $ hg merge 6
360 357 remote [merge rev] changed subrepository t which local [working copy] removed
361 358 use (c)hanged version or (d)elete? c
362 359 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
363 360 (branch merge, don't forget to commit)
364 361 BROKEN: should include subrepo t
365 362 $ hg debugsub
366 363 path s
367 364 source s
368 365 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
369 366 $ cat .hgsubstate
370 367 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
371 368 6747d179aa9a688023c4b0cad32e4c92bb7f34ad t
372 369 $ hg ci -m 'local removed, remote changed, keep changed'
373 370 BROKEN: should include subrepo t
374 371 $ hg debugsub
375 372 path s
376 373 source s
377 374 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
378 375 BROKEN: should include subrepo t
379 376 $ cat .hgsubstate
380 377 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
381 378 $ cat t/t
382 379 t2
383 380
384 381 local removed, remote changed, keep removed
385 382
386 383 $ hg co -C 11
387 384 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
388 385 $ hg merge --config ui.interactive=true 6 <<EOF
389 386 > d
390 387 > EOF
391 388 remote [merge rev] changed subrepository t which local [working copy] removed
392 389 use (c)hanged version or (d)elete? d
393 390 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
394 391 (branch merge, don't forget to commit)
395 392 $ hg debugsub
396 393 path s
397 394 source s
398 395 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
399 396 $ cat .hgsubstate
400 397 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
401 398 $ hg ci -m 'local removed, remote changed, keep removed'
402 399 created new head
403 400 $ hg debugsub
404 401 path s
405 402 source s
406 403 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
407 404 $ cat .hgsubstate
408 405 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
409 406
410 407 local changed, remote removed, keep changed
411 408
412 409 $ hg co -C 6
413 410 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
414 411 $ hg merge 11
415 412 local [working copy] changed subrepository t which remote [merge rev] removed
416 413 use (c)hanged version or (d)elete? c
417 414 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
418 415 (branch merge, don't forget to commit)
419 416 BROKEN: should include subrepo t
420 417 $ hg debugsub
421 418 path s
422 419 source s
423 420 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
424 421 BROKEN: should include subrepo t
425 422 $ cat .hgsubstate
426 423 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
427 424 $ hg ci -m 'local changed, remote removed, keep changed'
428 425 created new head
429 426 BROKEN: should include subrepo t
430 427 $ hg debugsub
431 428 path s
432 429 source s
433 430 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
434 431 BROKEN: should include subrepo t
435 432 $ cat .hgsubstate
436 433 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
437 434 $ cat t/t
438 435 t2
439 436
440 437 local changed, remote removed, keep removed
441 438
442 439 $ hg co -C 6
443 440 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
444 441 $ hg merge --config ui.interactive=true 11 <<EOF
445 442 > d
446 443 > EOF
447 444 local [working copy] changed subrepository t which remote [merge rev] removed
448 445 use (c)hanged version or (d)elete? d
449 446 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
450 447 (branch merge, don't forget to commit)
451 448 $ hg debugsub
452 449 path s
453 450 source s
454 451 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
455 452 $ cat .hgsubstate
456 453 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
457 454 $ hg ci -m 'local changed, remote removed, keep removed'
458 455 created new head
459 456 $ hg debugsub
460 457 path s
461 458 source s
462 459 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
463 460 $ cat .hgsubstate
464 461 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
465 462
466 463 clean up to avoid having to fix up the tests below
467 464
468 465 $ hg co -C 10
469 466 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
470 467 $ cat >> $HGRCPATH <<EOF
471 468 > [extensions]
472 469 > strip=
473 470 > EOF
474 471 $ hg strip -r 11:15
475 472 saved backup bundle to $TESTTMP/t/.hg/strip-backup/*-backup.hg (glob)
476 473
477 474 clone
478 475
479 476 $ cd ..
480 477 $ hg clone t tc
481 478 updating to branch default
482 479 cloning subrepo s from $TESTTMP/t/s
483 480 cloning subrepo s/ss from $TESTTMP/t/s/ss
484 481 cloning subrepo t from $TESTTMP/t/t
485 482 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
486 483 $ cd tc
487 484 $ hg debugsub
488 485 path s
489 486 source s
490 487 revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
491 488 path t
492 489 source t
493 490 revision 20a0db6fbf6c3d2836e6519a642ae929bfc67c0e
494 491 $ cd ..
495 492
496 493 clone with subrepo disabled (update should fail)
497 494
498 495 $ hg clone t -U tc2 --config subrepos.allowed=false
499 496 $ hg update -R tc2 --config subrepos.allowed=false
500 497 abort: subrepos not enabled
501 498 (see 'hg help config.subrepos' for details)
502 499 [255]
503 500 $ ls tc2
504 501 a
505 502
506 503 $ hg clone t tc3 --config subrepos.allowed=false
507 504 updating to branch default
508 505 abort: subrepos not enabled
509 506 (see 'hg help config.subrepos' for details)
510 507 [255]
511 508 $ ls tc3
512 509 a
513 510
514 511 And again with just the hg type disabled
515 512
516 513 $ hg clone t -U tc4 --config subrepos.hg:allowed=false
517 514 $ hg update -R tc4 --config subrepos.hg:allowed=false
518 515 abort: hg subrepos not allowed
519 516 (see 'hg help config.subrepos' for details)
520 517 [255]
521 518 $ ls tc4
522 519 a
523 520
524 521 $ hg clone t tc5 --config subrepos.hg:allowed=false
525 522 updating to branch default
526 523 abort: hg subrepos not allowed
527 524 (see 'hg help config.subrepos' for details)
528 525 [255]
529 526 $ ls tc5
530 527 a
531 528
532 529 push
533 530
534 531 $ cd tc
535 532 $ echo bah > t/t
536 533 $ hg ci -m11
537 534 committing subrepository t
538 535 $ hg push
539 536 pushing to $TESTTMP/t
540 537 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss
541 538 no changes made to subrepo s since last push to $TESTTMP/t/s
542 539 pushing subrepo t to $TESTTMP/t/t
543 540 searching for changes
544 541 adding changesets
545 542 adding manifests
546 543 adding file changes
547 544 added 1 changesets with 1 changes to 1 files
548 545 searching for changes
549 546 adding changesets
550 547 adding manifests
551 548 adding file changes
552 549 added 1 changesets with 1 changes to 1 files
553 550
554 551 push -f
555 552
556 553 $ echo bah > s/a
557 554 $ hg ci -m12
558 555 committing subrepository s
559 556 $ hg push
560 557 pushing to $TESTTMP/t
561 558 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss
562 559 pushing subrepo s to $TESTTMP/t/s
563 560 searching for changes
564 561 abort: push creates new remote head 12a213df6fa9! (in subrepository "s")
565 562 (merge or see 'hg help push' for details about pushing new heads)
566 563 [255]
567 564 $ hg push -f
568 565 pushing to $TESTTMP/t
569 566 pushing subrepo s/ss to $TESTTMP/t/s/ss
570 567 searching for changes
571 568 no changes found
572 569 pushing subrepo s to $TESTTMP/t/s
573 570 searching for changes
574 571 adding changesets
575 572 adding manifests
576 573 adding file changes
577 574 added 1 changesets with 1 changes to 1 files (+1 heads)
578 575 pushing subrepo t to $TESTTMP/t/t
579 576 searching for changes
580 577 no changes found
581 578 searching for changes
582 579 adding changesets
583 580 adding manifests
584 581 adding file changes
585 582 added 1 changesets with 1 changes to 1 files
586 583
587 584 check that unmodified subrepos are not pushed
588 585
589 586 $ hg clone . ../tcc
590 587 updating to branch default
591 588 cloning subrepo s from $TESTTMP/tc/s
592 589 cloning subrepo s/ss from $TESTTMP/tc/s/ss
593 590 cloning subrepo t from $TESTTMP/tc/t
594 591 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
595 592
596 593 the subrepos on the new clone have nothing to push to its source
597 594
598 595 $ hg push -R ../tcc .
599 596 pushing to .
600 597 no changes made to subrepo s/ss since last push to s/ss
601 598 no changes made to subrepo s since last push to s
602 599 no changes made to subrepo t since last push to t
603 600 searching for changes
604 601 no changes found
605 602 [1]
606 603
607 604 the subrepos on the source do not have a clean store versus the clone target
608 605 because they were never explicitly pushed to the source
609 606
610 607 $ hg push ../tcc
611 608 pushing to ../tcc
612 609 pushing subrepo s/ss to ../tcc/s/ss
613 610 searching for changes
614 611 no changes found
615 612 pushing subrepo s to ../tcc/s
616 613 searching for changes
617 614 no changes found
618 615 pushing subrepo t to ../tcc/t
619 616 searching for changes
620 617 no changes found
621 618 searching for changes
622 619 no changes found
623 620 [1]
624 621
625 622 after push their stores become clean
626 623
627 624 $ hg push ../tcc
628 625 pushing to ../tcc
629 626 no changes made to subrepo s/ss since last push to ../tcc/s/ss
630 627 no changes made to subrepo s since last push to ../tcc/s
631 628 no changes made to subrepo t since last push to ../tcc/t
632 629 searching for changes
633 630 no changes found
634 631 [1]
635 632
636 633 updating a subrepo to a different revision or changing
637 634 its working directory does not make its store dirty
638 635
639 636 $ hg -R s update '.^'
640 637 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
641 638 $ hg push
642 639 pushing to $TESTTMP/t
643 640 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss
644 641 no changes made to subrepo s since last push to $TESTTMP/t/s
645 642 no changes made to subrepo t since last push to $TESTTMP/t/t
646 643 searching for changes
647 644 no changes found
648 645 [1]
649 646 $ echo foo >> s/a
650 647 $ hg push
651 648 pushing to $TESTTMP/t
652 649 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss
653 650 no changes made to subrepo s since last push to $TESTTMP/t/s
654 651 no changes made to subrepo t since last push to $TESTTMP/t/t
655 652 searching for changes
656 653 no changes found
657 654 [1]
658 655 $ hg -R s update -C tip
659 656 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
660 657
661 658 committing into a subrepo makes its store (but not its parent's store) dirty
662 659
663 660 $ echo foo >> s/ss/a
664 661 $ hg -R s/ss commit -m 'test dirty store detection'
665 662
666 663 $ hg out -S -r `hg log -r tip -T "{node|short}"`
667 664 comparing with $TESTTMP/t
668 665 searching for changes
669 666 no changes found
670 667 comparing with $TESTTMP/t/s
671 668 searching for changes
672 669 no changes found
673 670 comparing with $TESTTMP/t/s/ss
674 671 searching for changes
675 672 changeset: 1:79ea5566a333
676 673 tag: tip
677 674 user: test
678 675 date: Thu Jan 01 00:00:00 1970 +0000
679 676 summary: test dirty store detection
680 677
681 678 comparing with $TESTTMP/t/t
682 679 searching for changes
683 680 no changes found
684 681
685 682 $ hg push
686 683 pushing to $TESTTMP/t
687 684 pushing subrepo s/ss to $TESTTMP/t/s/ss
688 685 searching for changes
689 686 adding changesets
690 687 adding manifests
691 688 adding file changes
692 689 added 1 changesets with 1 changes to 1 files
693 690 no changes made to subrepo s since last push to $TESTTMP/t/s
694 691 no changes made to subrepo t since last push to $TESTTMP/t/t
695 692 searching for changes
696 693 no changes found
697 694 [1]
698 695
699 696 a subrepo store may be clean versus one repo but not versus another
700 697
701 698 $ hg push
702 699 pushing to $TESTTMP/t
703 700 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss
704 701 no changes made to subrepo s since last push to $TESTTMP/t/s
705 702 no changes made to subrepo t since last push to $TESTTMP/t/t
706 703 searching for changes
707 704 no changes found
708 705 [1]
709 706 $ hg push ../tcc
710 707 pushing to ../tcc
711 708 pushing subrepo s/ss to ../tcc/s/ss
712 709 searching for changes
713 710 adding changesets
714 711 adding manifests
715 712 adding file changes
716 713 added 1 changesets with 1 changes to 1 files
717 714 no changes made to subrepo s since last push to ../tcc/s
718 715 no changes made to subrepo t since last push to ../tcc/t
719 716 searching for changes
720 717 no changes found
721 718 [1]
722 719
723 720 update
724 721
725 722 $ cd ../t
726 723 $ hg up -C # discard our earlier merge
727 724 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
728 725 updated to "c373c8102e68: 12"
729 726 2 other heads for branch "default"
730 727 $ echo blah > t/t
731 728 $ hg ci -m13
732 729 committing subrepository t
733 730
734 731 backout calls revert internally with minimal opts, which should not raise
735 732 KeyError
736 733
737 734 $ hg backout ".^" --no-commit
738 735 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
739 736 changeset c373c8102e68 backed out, don't forget to commit.
740 737
741 738 $ hg up -C # discard changes
742 739 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
743 740 updated to "925c17564ef8: 13"
744 741 2 other heads for branch "default"
745 742
746 743 pull
747 744
748 745 $ cd ../tc
749 746 $ hg pull
750 747 pulling from $TESTTMP/t
751 748 searching for changes
752 749 adding changesets
753 750 adding manifests
754 751 adding file changes
755 752 added 1 changesets with 1 changes to 1 files
756 753 new changesets 925c17564ef8
757 754 (run 'hg update' to get a working copy)
758 755
759 756 should pull t
760 757
761 758 $ hg incoming -S -r `hg log -r tip -T "{node|short}"`
762 759 comparing with $TESTTMP/t
763 760 no changes found
764 761 comparing with $TESTTMP/t/s
765 762 searching for changes
766 763 no changes found
767 764 comparing with $TESTTMP/t/s/ss
768 765 searching for changes
769 766 no changes found
770 767 comparing with $TESTTMP/t/t
771 768 searching for changes
772 769 changeset: 5:52c0adc0515a
773 770 tag: tip
774 771 user: test
775 772 date: Thu Jan 01 00:00:00 1970 +0000
776 773 summary: 13
777 774
778 775
779 776 $ hg up
780 777 pulling subrepo t from $TESTTMP/t/t
781 778 searching for changes
782 779 adding changesets
783 780 adding manifests
784 781 adding file changes
785 782 added 1 changesets with 1 changes to 1 files
786 783 new changesets 52c0adc0515a
787 784 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
788 785 updated to "925c17564ef8: 13"
789 786 2 other heads for branch "default"
790 787 $ cat t/t
791 788 blah
792 789
793 790 bogus subrepo path aborts
794 791
795 792 $ echo 'bogus=[boguspath' >> .hgsub
796 793 $ hg ci -m 'bogus subrepo path'
797 794 abort: missing ] in subrepository source
798 795 [255]
799 796
800 797 Issue1986: merge aborts when trying to merge a subrepo that
801 798 shouldn't need merging
802 799
803 800 # subrepo layout
804 801 #
805 802 # o 5 br
806 803 # /|
807 804 # o | 4 default
808 805 # | |
809 806 # | o 3 br
810 807 # |/|
811 808 # o | 2 default
812 809 # | |
813 810 # | o 1 br
814 811 # |/
815 812 # o 0 default
816 813
817 814 $ cd ..
818 815 $ rm -rf sub
819 816 $ hg init main
820 817 $ cd main
821 818 $ hg init s
822 819 $ cd s
823 820 $ echo a > a
824 821 $ hg ci -Am1
825 822 adding a
826 823 $ hg branch br
827 824 marked working directory as branch br
828 825 (branches are permanent and global, did you want a bookmark?)
829 826 $ echo a >> a
830 827 $ hg ci -m1
831 828 $ hg up default
832 829 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
833 830 $ echo b > b
834 831 $ hg ci -Am1
835 832 adding b
836 833 $ hg up br
837 834 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
838 835 $ hg merge tip
839 836 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
840 837 (branch merge, don't forget to commit)
841 838 $ hg ci -m1
842 839 $ hg up 2
843 840 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
844 841 $ echo c > c
845 842 $ hg ci -Am1
846 843 adding c
847 844 $ hg up 3
848 845 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
849 846 $ hg merge 4
850 847 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
851 848 (branch merge, don't forget to commit)
852 849 $ hg ci -m1
853 850
854 851 # main repo layout:
855 852 #
856 853 # * <-- try to merge default into br again
857 854 # .`|
858 855 # . o 5 br --> substate = 5
859 856 # . |
860 857 # o | 4 default --> substate = 4
861 858 # | |
862 859 # | o 3 br --> substate = 2
863 860 # |/|
864 861 # o | 2 default --> substate = 2
865 862 # | |
866 863 # | o 1 br --> substate = 3
867 864 # |/
868 865 # o 0 default --> substate = 2
869 866
870 867 $ cd ..
871 868 $ echo 's = s' > .hgsub
872 869 $ hg -R s up 2
873 870 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
874 871 $ hg ci -Am1
875 872 adding .hgsub
876 873 $ hg branch br
877 874 marked working directory as branch br
878 875 (branches are permanent and global, did you want a bookmark?)
879 876 $ echo b > b
880 877 $ hg -R s up 3
881 878 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
882 879 $ hg ci -Am1
883 880 adding b
884 881 $ hg up default
885 882 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
886 883 $ echo c > c
887 884 $ hg ci -Am1
888 885 adding c
889 886 $ hg up 1
890 887 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
891 888 $ hg merge 2
892 889 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
893 890 (branch merge, don't forget to commit)
894 891 $ hg ci -m1
895 892 $ hg up 2
896 893 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
897 894 $ hg -R s up 4
898 895 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
899 896 $ echo d > d
900 897 $ hg ci -Am1
901 898 adding d
902 899 $ hg up 3
903 900 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
904 901 $ hg -R s up 5
905 902 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
906 903 $ echo e > e
907 904 $ hg ci -Am1
908 905 adding e
909 906
910 907 $ hg up 5
911 908 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
912 909 $ hg merge 4 # try to merge default into br again
913 910 subrepository s diverged (local revision: f8f13b33206e, remote revision: a3f9062a4f88)
914 911 (M)erge, keep (l)ocal [working copy] or keep (r)emote [merge rev]? m
915 912 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
916 913 (branch merge, don't forget to commit)
917 914 $ cd ..
918 915
919 916 test subrepo delete from .hgsubstate
920 917
921 918 $ hg init testdelete
922 919 $ mkdir testdelete/nested testdelete/nested2
923 920 $ hg init testdelete/nested
924 921 $ hg init testdelete/nested2
925 922 $ echo test > testdelete/nested/foo
926 923 $ echo test > testdelete/nested2/foo
927 924 $ hg -R testdelete/nested add
928 925 adding testdelete/nested/foo
929 926 $ hg -R testdelete/nested2 add
930 927 adding testdelete/nested2/foo
931 928 $ hg -R testdelete/nested ci -m test
932 929 $ hg -R testdelete/nested2 ci -m test
933 930 $ echo nested = nested > testdelete/.hgsub
934 931 $ echo nested2 = nested2 >> testdelete/.hgsub
935 932 $ hg -R testdelete add
936 933 adding testdelete/.hgsub
937 934 $ hg -R testdelete ci -m "nested 1 & 2 added"
938 935 $ echo nested = nested > testdelete/.hgsub
939 936 $ hg -R testdelete ci -m "nested 2 deleted"
940 937 $ cat testdelete/.hgsubstate
941 938 bdf5c9a3103743d900b12ae0db3ffdcfd7b0d878 nested
942 939 $ hg -R testdelete remove testdelete/.hgsub
943 940 $ hg -R testdelete ci -m ".hgsub deleted"
944 941 $ cat testdelete/.hgsubstate
945 942 bdf5c9a3103743d900b12ae0db3ffdcfd7b0d878 nested
946 943
947 944 test repository cloning
948 945
949 946 $ mkdir mercurial mercurial2
950 947 $ hg init nested_absolute
951 948 $ echo test > nested_absolute/foo
952 949 $ hg -R nested_absolute add
953 950 adding nested_absolute/foo
954 951 $ hg -R nested_absolute ci -mtest
955 952 $ cd mercurial
956 953 $ hg init nested_relative
957 954 $ echo test2 > nested_relative/foo2
958 955 $ hg -R nested_relative add
959 956 adding nested_relative/foo2
960 957 $ hg -R nested_relative ci -mtest2
961 958 $ hg init main
962 959 $ echo "nested_relative = ../nested_relative" > main/.hgsub
963 960 $ echo "nested_absolute = `pwd`/nested_absolute" >> main/.hgsub
964 961 $ hg -R main add
965 962 adding main/.hgsub
966 963 $ hg -R main ci -m "add subrepos"
967 964 $ cd ..
968 965 $ hg clone mercurial/main mercurial2/main
969 966 updating to branch default
970 967 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
971 968 $ cat mercurial2/main/nested_absolute/.hg/hgrc \
972 969 > mercurial2/main/nested_relative/.hg/hgrc
973 970 [paths]
974 971 default = $TESTTMP/mercurial/nested_absolute
975 972 [paths]
976 973 default = $TESTTMP/mercurial/nested_relative
977 974 $ rm -rf mercurial mercurial2
978 975
979 976 Issue1977: multirepo push should fail if subrepo push fails
980 977
981 978 $ hg init repo
982 979 $ hg init repo/s
983 980 $ echo a > repo/s/a
984 981 $ hg -R repo/s ci -Am0
985 982 adding a
986 983 $ echo s = s > repo/.hgsub
987 984 $ hg -R repo ci -Am1
988 985 adding .hgsub
989 986 $ hg clone repo repo2
990 987 updating to branch default
991 988 cloning subrepo s from $TESTTMP/repo/s
992 989 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
993 990 $ hg -q -R repo2 pull -u
994 991 $ echo 1 > repo2/s/a
995 992 $ hg -R repo2/s ci -m2
996 993 $ hg -q -R repo2/s push
997 994 $ hg -R repo2/s up -C 0
998 995 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
999 996 $ echo 2 > repo2/s/b
1000 997 $ hg -R repo2/s ci -m3 -A
1001 998 adding b
1002 999 created new head
1003 1000 $ hg -R repo2 ci -m3
1004 1001 $ hg -q -R repo2 push
1005 1002 abort: push creates new remote head cc505f09a8b2! (in subrepository "s")
1006 1003 (merge or see 'hg help push' for details about pushing new heads)
1007 1004 [255]
1008 1005 $ hg -R repo update
1009 1006 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1010 1007
1011 1008 test if untracked file is not overwritten
1012 1009
1013 1010 (this also tests that updated .hgsubstate is treated as "modified",
1014 1011 when 'merge.update()' is aborted before 'merge.recordupdates()', even
1015 1012 if none of mode, size and timestamp of it isn't changed on the
1016 1013 filesystem (see also issue4583))
1017 1014
1018 1015 $ echo issue3276_ok > repo/s/b
1019 1016 $ hg -R repo2 push -f -q
1020 1017 $ touch -t 200001010000 repo/.hgsubstate
1021 1018
1022 1019 $ cat >> repo/.hg/hgrc <<EOF
1023 1020 > [fakedirstatewritetime]
1024 1021 > # emulate invoking dirstate.write() via repo.status()
1025 1022 > # at 2000-01-01 00:00
1026 1023 > fakenow = 200001010000
1027 1024 >
1028 1025 > [extensions]
1029 1026 > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
1030 1027 > EOF
1031 1028 $ hg -R repo update
1032 1029 b: untracked file differs
1033 1030 abort: untracked files in working directory differ from files in requested revision (in subrepository "s")
1034 1031 [255]
1035 1032 $ cat >> repo/.hg/hgrc <<EOF
1036 1033 > [extensions]
1037 1034 > fakedirstatewritetime = !
1038 1035 > EOF
1039 1036
1040 1037 $ cat repo/s/b
1041 1038 issue3276_ok
1042 1039 $ rm repo/s/b
1043 1040 $ touch -t 200001010000 repo/.hgsubstate
1044 1041 $ hg -R repo revert --all
1045 1042 reverting repo/.hgsubstate
1046 1043 reverting subrepo s
1047 1044 $ hg -R repo update
1048 1045 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1049 1046 $ cat repo/s/b
1050 1047 2
1051 1048 $ rm -rf repo2 repo
1052 1049
1053 1050
1054 1051 Issue1852 subrepos with relative paths always push/pull relative to default
1055 1052
1056 1053 Prepare a repo with subrepo
1057 1054
1058 1055 $ hg init issue1852a
1059 1056 $ cd issue1852a
1060 1057 $ hg init sub/repo
1061 1058 $ echo test > sub/repo/foo
1062 1059 $ hg -R sub/repo add sub/repo/foo
1063 1060 $ echo sub/repo = sub/repo > .hgsub
1064 1061 $ hg add .hgsub
1065 1062 $ hg ci -mtest
1066 1063 committing subrepository sub/repo
1067 1064 $ echo test >> sub/repo/foo
1068 1065 $ hg ci -mtest
1069 1066 committing subrepository sub/repo
1070 1067 $ hg cat sub/repo/foo
1071 1068 test
1072 1069 test
1073 1070 $ hg cat sub/repo/foo -Tjson | sed 's|\\\\|/|g'
1074 1071 [
1075 1072 {
1076 1073 "data": "test\ntest\n",
1077 1074 "path": "foo"
1078 1075 }
1079 1076 ]
1080 1077
1081 1078 non-exact match:
1082 1079
1083 1080 $ hg cat -T '{path|relpath}\n' 'glob:**'
1084 1081 .hgsub
1085 1082 .hgsubstate
1086 1083 sub/repo/foo
1087 1084 $ hg cat -T '{path|relpath}\n' 're:^sub'
1088 1085 sub/repo/foo
1089 1086
1090 1087 missing subrepos in working directory:
1091 1088
1092 1089 $ mkdir -p tmp/sub/repo
1093 1090 $ hg cat -r 0 --output tmp/%p_p sub/repo/foo
1094 1091 $ cat tmp/sub/repo/foo_p
1095 1092 test
1096 1093 $ mv sub/repo sub_
1097 1094 $ hg cat sub/repo/baz
1098 1095 skipping missing subrepository: sub/repo
1099 1096 [1]
1100 1097 $ rm -rf sub/repo
1101 1098 $ mv sub_ sub/repo
1102 1099 $ cd ..
1103 1100
1104 1101 Create repo without default path, pull top repo, and see what happens on update
1105 1102
1106 1103 $ hg init issue1852b
1107 1104 $ hg -R issue1852b pull issue1852a
1108 1105 pulling from issue1852a
1109 1106 requesting all changes
1110 1107 adding changesets
1111 1108 adding manifests
1112 1109 adding file changes
1113 1110 added 2 changesets with 3 changes to 2 files
1114 1111 new changesets 19487b456929:be5eb94e7215
1115 1112 (run 'hg update' to get a working copy)
1116 1113 $ hg -R issue1852b update
1117 1114 abort: default path for subrepository not found (in subrepository "sub/repo")
1118 1115 [255]
1119 1116
1120 1117 Ensure a full traceback, not just the SubrepoAbort part
1121 1118
1122 1119 $ hg -R issue1852b update --traceback 2>&1 | grep 'raise error\.Abort'
1123 1120 raise error.Abort(_("default path for subrepository not found"))
1124 1121
1125 1122 Pull -u now doesn't help
1126 1123
1127 1124 $ hg -R issue1852b pull -u issue1852a
1128 1125 pulling from issue1852a
1129 1126 searching for changes
1130 1127 no changes found
1131 1128
1132 1129 Try the same, but with pull -u
1133 1130
1134 1131 $ hg init issue1852c
1135 1132 $ hg -R issue1852c pull -r0 -u issue1852a
1136 1133 pulling from issue1852a
1137 1134 adding changesets
1138 1135 adding manifests
1139 1136 adding file changes
1140 1137 added 1 changesets with 2 changes to 2 files
1141 1138 new changesets 19487b456929
1142 1139 cloning subrepo sub/repo from issue1852a/sub/repo
1143 1140 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1144 1141
1145 1142 Try to push from the other side
1146 1143
1147 1144 $ hg -R issue1852a push `pwd`/issue1852c
1148 1145 pushing to $TESTTMP/issue1852c
1149 1146 pushing subrepo sub/repo to $TESTTMP/issue1852c/sub/repo
1150 1147 searching for changes
1151 1148 no changes found
1152 1149 searching for changes
1153 1150 adding changesets
1154 1151 adding manifests
1155 1152 adding file changes
1156 1153 added 1 changesets with 1 changes to 1 files
1157 1154
1158 1155 Incoming and outgoing should not use the default path:
1159 1156
1160 1157 $ hg clone -q issue1852a issue1852d
1161 1158 $ hg -R issue1852d outgoing --subrepos issue1852c
1162 1159 comparing with issue1852c
1163 1160 searching for changes
1164 1161 no changes found
1165 1162 comparing with issue1852c/sub/repo
1166 1163 searching for changes
1167 1164 no changes found
1168 1165 [1]
1169 1166 $ hg -R issue1852d incoming --subrepos issue1852c
1170 1167 comparing with issue1852c
1171 1168 searching for changes
1172 1169 no changes found
1173 1170 comparing with issue1852c/sub/repo
1174 1171 searching for changes
1175 1172 no changes found
1176 1173 [1]
1177 1174
1178 1175 Check that merge of a new subrepo doesn't write the uncommitted state to
1179 1176 .hgsubstate (issue4622)
1180 1177
1181 1178 $ hg init issue1852a/addedsub
1182 1179 $ echo zzz > issue1852a/addedsub/zz.txt
1183 1180 $ hg -R issue1852a/addedsub ci -Aqm "initial ZZ"
1184 1181
1185 1182 $ hg clone issue1852a/addedsub issue1852d/addedsub
1186 1183 updating to branch default
1187 1184 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1188 1185
1189 1186 $ echo def > issue1852a/sub/repo/foo
1190 1187 $ hg -R issue1852a ci -SAm 'tweaked subrepo'
1191 1188 adding tmp/sub/repo/foo_p
1192 1189 committing subrepository sub/repo
1193 1190
1194 1191 $ echo 'addedsub = addedsub' >> issue1852d/.hgsub
1195 1192 $ echo xyz > issue1852d/sub/repo/foo
1196 1193 $ hg -R issue1852d pull -u
1197 1194 pulling from $TESTTMP/issue1852a
1198 1195 searching for changes
1199 1196 adding changesets
1200 1197 adding manifests
1201 1198 adding file changes
1202 1199 added 1 changesets with 2 changes to 2 files
1203 1200 new changesets c82b79fdcc5b
1204 1201 subrepository sub/repo diverged (local revision: f42d5c7504a8, remote revision: 46cd4aac504c)
1205 1202 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
1206 1203 pulling subrepo sub/repo from $TESTTMP/issue1852a/sub/repo
1207 1204 searching for changes
1208 1205 adding changesets
1209 1206 adding manifests
1210 1207 adding file changes
1211 1208 added 1 changesets with 1 changes to 1 files
1212 1209 new changesets 46cd4aac504c
1213 1210 subrepository sources for sub/repo differ
1214 1211 use (l)ocal source (f42d5c7504a8) or (r)emote source (46cd4aac504c)? l
1215 1212 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1216 1213 $ cat issue1852d/.hgsubstate
1217 1214 f42d5c7504a811dda50f5cf3e5e16c3330b87172 sub/repo
1218 1215
1219 1216 Check status of files when none of them belong to the first
1220 1217 subrepository:
1221 1218
1222 1219 $ hg init subrepo-status
1223 1220 $ cd subrepo-status
1224 1221 $ hg init subrepo-1
1225 1222 $ hg init subrepo-2
1226 1223 $ cd subrepo-2
1227 1224 $ touch file
1228 1225 $ hg add file
1229 1226 $ cd ..
1230 1227 $ echo subrepo-1 = subrepo-1 > .hgsub
1231 1228 $ echo subrepo-2 = subrepo-2 >> .hgsub
1232 1229 $ hg add .hgsub
1233 1230 $ hg ci -m 'Added subrepos'
1234 1231 committing subrepository subrepo-2
1235 1232 $ hg st subrepo-2/file
1236 1233
1237 1234 Check that share works with subrepo
1238 1235 $ hg --config extensions.share= share . ../shared
1239 1236 updating working directory
1240 1237 sharing subrepo subrepo-1 from $TESTTMP/subrepo-status/subrepo-1
1241 1238 sharing subrepo subrepo-2 from $TESTTMP/subrepo-status/subrepo-2
1242 1239 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1243 1240 $ find ../shared/* | sort
1244 1241 ../shared/subrepo-1
1245 1242 ../shared/subrepo-1/.hg
1246 1243 ../shared/subrepo-1/.hg/cache
1247 1244 ../shared/subrepo-1/.hg/cache/storehash
1248 1245 ../shared/subrepo-1/.hg/cache/storehash/* (glob)
1249 1246 ../shared/subrepo-1/.hg/hgrc
1250 1247 ../shared/subrepo-1/.hg/requires
1251 1248 ../shared/subrepo-1/.hg/sharedpath
1252 1249 ../shared/subrepo-1/.hg/wcache
1253 1250 ../shared/subrepo-2
1254 1251 ../shared/subrepo-2/.hg
1255 1252 ../shared/subrepo-2/.hg/branch
1256 1253 ../shared/subrepo-2/.hg/cache
1257 1254 ../shared/subrepo-2/.hg/cache/storehash
1258 1255 ../shared/subrepo-2/.hg/cache/storehash/* (glob)
1259 1256 ../shared/subrepo-2/.hg/dirstate
1260 1257 ../shared/subrepo-2/.hg/hgrc
1261 1258 ../shared/subrepo-2/.hg/requires
1262 1259 ../shared/subrepo-2/.hg/sharedpath
1263 1260 ../shared/subrepo-2/.hg/wcache
1264 1261 ../shared/subrepo-2/.hg/wcache/checkisexec (execbit !)
1265 1262 ../shared/subrepo-2/.hg/wcache/checklink (symlink !)
1266 1263 ../shared/subrepo-2/.hg/wcache/checklink-target (symlink !)
1267 1264 ../shared/subrepo-2/.hg/wcache/manifestfulltextcache (reporevlogstore !)
1268 1265 ../shared/subrepo-2/file
1269 1266 $ hg -R ../shared in
1270 1267 abort: repository default not found!
1271 1268 [255]
1272 1269 $ hg -R ../shared/subrepo-2 showconfig paths
1273 1270 paths.default=$TESTTMP/subrepo-status/subrepo-2
1274 1271 $ hg -R ../shared/subrepo-1 sum --remote
1275 1272 parent: -1:000000000000 tip (empty repository)
1276 1273 branch: default
1277 1274 commit: (clean)
1278 1275 update: (current)
1279 1276 remote: (synced)
1280 1277
1281 1278 Check hg update --clean
1282 1279 $ cd $TESTTMP/t
1283 1280 $ rm -r t/t.orig
1284 1281 $ hg status -S --all
1285 1282 C .hgsub
1286 1283 C .hgsubstate
1287 1284 C a
1288 1285 C s/.hgsub
1289 1286 C s/.hgsubstate
1290 1287 C s/a
1291 1288 C s/ss/a
1292 1289 C t/t
1293 1290 $ echo c1 > s/a
1294 1291 $ cd s
1295 1292 $ echo c1 > b
1296 1293 $ echo c1 > c
1297 1294 $ hg add b
1298 1295 $ cd ..
1299 1296 $ hg status -S
1300 1297 M s/a
1301 1298 A s/b
1302 1299 ? s/c
1303 1300 $ hg update -C
1304 1301 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1305 1302 updated to "925c17564ef8: 13"
1306 1303 2 other heads for branch "default"
1307 1304 $ hg status -S
1308 1305 ? s/b
1309 1306 ? s/c
1310 1307
1311 1308 Sticky subrepositories, no changes
1312 1309 $ cd $TESTTMP/t
1313 1310 $ hg id
1314 1311 925c17564ef8 tip
1315 1312 $ hg -R s id
1316 1313 12a213df6fa9 tip
1317 1314 $ hg -R t id
1318 1315 52c0adc0515a tip
1319 1316 $ hg update 11
1320 1317 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1321 1318 $ hg id
1322 1319 365661e5936a
1323 1320 $ hg -R s id
1324 1321 fc627a69481f
1325 1322 $ hg -R t id
1326 1323 e95bcfa18a35
1327 1324
1328 1325 Sticky subrepositories, file changes
1329 1326 $ touch s/f1
1330 1327 $ touch t/f1
1331 1328 $ hg add -S s/f1
1332 1329 $ hg add -S t/f1
1333 1330 $ hg id
1334 1331 365661e5936a+
1335 1332 $ hg -R s id
1336 1333 fc627a69481f+
1337 1334 $ hg -R t id
1338 1335 e95bcfa18a35+
1339 1336 $ hg update tip
1340 1337 subrepository s diverged (local revision: fc627a69481f, remote revision: 12a213df6fa9)
1341 1338 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
1342 1339 subrepository sources for s differ
1343 1340 use (l)ocal source (fc627a69481f) or (r)emote source (12a213df6fa9)? l
1344 1341 subrepository t diverged (local revision: e95bcfa18a35, remote revision: 52c0adc0515a)
1345 1342 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
1346 1343 subrepository sources for t differ
1347 1344 use (l)ocal source (e95bcfa18a35) or (r)emote source (52c0adc0515a)? l
1348 1345 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1349 1346 $ hg id
1350 1347 925c17564ef8+ tip
1351 1348 $ hg -R s id
1352 1349 fc627a69481f+
1353 1350 $ hg -R t id
1354 1351 e95bcfa18a35+
1355 1352 $ hg update --clean tip
1356 1353 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1357 1354
1358 1355 Sticky subrepository, revision updates
1359 1356 $ hg id
1360 1357 925c17564ef8 tip
1361 1358 $ hg -R s id
1362 1359 12a213df6fa9 tip
1363 1360 $ hg -R t id
1364 1361 52c0adc0515a tip
1365 1362 $ cd s
1366 1363 $ hg update -r -2
1367 1364 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1368 1365 $ cd ../t
1369 1366 $ hg update -r 2
1370 1367 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1371 1368 $ cd ..
1372 1369 $ hg update 10
1373 1370 subrepository s diverged (local revision: 12a213df6fa9, remote revision: fc627a69481f)
1374 1371 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
1375 1372 subrepository t diverged (local revision: 52c0adc0515a, remote revision: 20a0db6fbf6c)
1376 1373 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
1377 1374 subrepository sources for t differ (in checked out version)
1378 1375 use (l)ocal source (7af322bc1198) or (r)emote source (20a0db6fbf6c)? l
1379 1376 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1380 1377 $ hg id
1381 1378 e45c8b14af55+
1382 1379 $ hg -R s id
1383 1380 02dcf1d70411
1384 1381 $ hg -R t id
1385 1382 7af322bc1198
1386 1383
1387 1384 Sticky subrepository, file changes and revision updates
1388 1385 $ touch s/f1
1389 1386 $ touch t/f1
1390 1387 $ hg add -S s/f1
1391 1388 $ hg add -S t/f1
1392 1389 $ hg id
1393 1390 e45c8b14af55+
1394 1391 $ hg -R s id
1395 1392 02dcf1d70411+
1396 1393 $ hg -R t id
1397 1394 7af322bc1198+
1398 1395 $ hg update tip
1399 1396 subrepository s diverged (local revision: 12a213df6fa9, remote revision: 12a213df6fa9)
1400 1397 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
1401 1398 subrepository sources for s differ
1402 1399 use (l)ocal source (02dcf1d70411) or (r)emote source (12a213df6fa9)? l
1403 1400 subrepository t diverged (local revision: 52c0adc0515a, remote revision: 52c0adc0515a)
1404 1401 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
1405 1402 subrepository sources for t differ
1406 1403 use (l)ocal source (7af322bc1198) or (r)emote source (52c0adc0515a)? l
1407 1404 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1408 1405 $ hg id
1409 1406 925c17564ef8+ tip
1410 1407 $ hg -R s id
1411 1408 02dcf1d70411+
1412 1409 $ hg -R t id
1413 1410 7af322bc1198+
1414 1411
1415 1412 Sticky repository, update --clean
1416 1413 $ hg update --clean tip
1417 1414 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1418 1415 $ hg id
1419 1416 925c17564ef8 tip
1420 1417 $ hg -R s id
1421 1418 12a213df6fa9 tip
1422 1419 $ hg -R t id
1423 1420 52c0adc0515a tip
1424 1421
1425 1422 Test subrepo already at intended revision:
1426 1423 $ cd s
1427 1424 $ hg update fc627a69481f
1428 1425 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1429 1426 $ cd ..
1430 1427 $ hg update 11
1431 1428 subrepository s diverged (local revision: 12a213df6fa9, remote revision: fc627a69481f)
1432 1429 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
1433 1430 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1434 1431 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1435 1432 $ hg id -n
1436 1433 11+
1437 1434 $ hg -R s id
1438 1435 fc627a69481f
1439 1436 $ hg -R t id
1440 1437 e95bcfa18a35
1441 1438
1442 1439 Test that removing .hgsubstate doesn't break anything:
1443 1440
1444 1441 $ hg rm -f .hgsubstate
1445 1442 $ hg ci -mrm
1446 1443 nothing changed
1447 1444 [1]
1448 1445 $ hg log -vr tip
1449 1446 changeset: 13:925c17564ef8
1450 1447 tag: tip
1451 1448 user: test
1452 1449 date: Thu Jan 01 00:00:00 1970 +0000
1453 1450 files: .hgsubstate
1454 1451 description:
1455 1452 13
1456 1453
1457 1454
1458 1455
1459 1456 Test that removing .hgsub removes .hgsubstate:
1460 1457
1461 1458 $ hg rm .hgsub
1462 1459 $ hg ci -mrm2
1463 1460 created new head
1464 1461 $ hg log -vr tip
1465 1462 changeset: 14:2400bccd50af
1466 1463 tag: tip
1467 1464 parent: 11:365661e5936a
1468 1465 user: test
1469 1466 date: Thu Jan 01 00:00:00 1970 +0000
1470 1467 files: .hgsub .hgsubstate
1471 1468 description:
1472 1469 rm2
1473 1470
1474 1471
1475 1472 Test issue3153: diff -S with deleted subrepos
1476 1473
1477 1474 $ hg diff --nodates -S -c .
1478 1475 diff -r 365661e5936a -r 2400bccd50af .hgsub
1479 1476 --- a/.hgsub
1480 1477 +++ /dev/null
1481 1478 @@ -1,2 +0,0 @@
1482 1479 -s = s
1483 1480 -t = t
1484 1481 diff -r 365661e5936a -r 2400bccd50af .hgsubstate
1485 1482 --- a/.hgsubstate
1486 1483 +++ /dev/null
1487 1484 @@ -1,2 +0,0 @@
1488 1485 -fc627a69481fcbe5f1135069e8a3881c023e4cf5 s
1489 1486 -e95bcfa18a358dc4936da981ebf4147b4cad1362 t
1490 1487
1491 1488 Test behavior of add for explicit path in subrepo:
1492 1489 $ cd ..
1493 1490 $ hg init explicit
1494 1491 $ cd explicit
1495 1492 $ echo s = s > .hgsub
1496 1493 $ hg add .hgsub
1497 1494 $ hg init s
1498 1495 $ hg ci -m0
1499 1496 Adding with an explicit path in a subrepo adds the file
1500 1497 $ echo c1 > f1
1501 1498 $ echo c2 > s/f2
1502 1499 $ hg st -S
1503 1500 ? f1
1504 1501 ? s/f2
1505 1502 $ hg add s/f2
1506 1503 $ hg st -S
1507 1504 A s/f2
1508 1505 ? f1
1509 1506 $ hg ci -R s -m0
1510 1507 $ hg ci -Am1
1511 1508 adding f1
1512 1509 Adding with an explicit path in a subrepo with -S has the same behavior
1513 1510 $ echo c3 > f3
1514 1511 $ echo c4 > s/f4
1515 1512 $ hg st -S
1516 1513 ? f3
1517 1514 ? s/f4
1518 1515 $ hg add -S s/f4
1519 1516 $ hg st -S
1520 1517 A s/f4
1521 1518 ? f3
1522 1519 $ hg ci -R s -m1
1523 1520 $ hg ci -Ama2
1524 1521 adding f3
1525 1522 Adding without a path or pattern silently ignores subrepos
1526 1523 $ echo c5 > f5
1527 1524 $ echo c6 > s/f6
1528 1525 $ echo c7 > s/f7
1529 1526 $ hg st -S
1530 1527 ? f5
1531 1528 ? s/f6
1532 1529 ? s/f7
1533 1530 $ hg add
1534 1531 adding f5
1535 1532 $ hg st -S
1536 1533 A f5
1537 1534 ? s/f6
1538 1535 ? s/f7
1539 1536 $ hg ci -R s -Am2
1540 1537 adding f6
1541 1538 adding f7
1542 1539 $ hg ci -m3
1543 1540 Adding without a path or pattern with -S also adds files in subrepos
1544 1541 $ echo c8 > f8
1545 1542 $ echo c9 > s/f9
1546 1543 $ echo c10 > s/f10
1547 1544 $ hg st -S
1548 1545 ? f8
1549 1546 ? s/f10
1550 1547 ? s/f9
1551 1548 $ hg add -S
1552 1549 adding f8
1553 1550 adding s/f10
1554 1551 adding s/f9
1555 1552 $ hg st -S
1556 1553 A f8
1557 1554 A s/f10
1558 1555 A s/f9
1559 1556 $ hg ci -R s -m3
1560 1557 $ hg ci -m4
1561 1558 Adding with a pattern silently ignores subrepos
1562 1559 $ echo c11 > fm11
1563 1560 $ echo c12 > fn12
1564 1561 $ echo c13 > s/fm13
1565 1562 $ echo c14 > s/fn14
1566 1563 $ hg st -S
1567 1564 ? fm11
1568 1565 ? fn12
1569 1566 ? s/fm13
1570 1567 ? s/fn14
1571 1568 $ hg add 'glob:**fm*'
1572 1569 adding fm11
1573 1570 $ hg st -S
1574 1571 A fm11
1575 1572 ? fn12
1576 1573 ? s/fm13
1577 1574 ? s/fn14
1578 1575 $ hg ci -R s -Am4
1579 1576 adding fm13
1580 1577 adding fn14
1581 1578 $ hg ci -Am5
1582 1579 adding fn12
1583 1580 Adding with a pattern with -S also adds matches in subrepos
1584 1581 $ echo c15 > fm15
1585 1582 $ echo c16 > fn16
1586 1583 $ echo c17 > s/fm17
1587 1584 $ echo c18 > s/fn18
1588 1585 $ hg st -S
1589 1586 ? fm15
1590 1587 ? fn16
1591 1588 ? s/fm17
1592 1589 ? s/fn18
1593 1590 $ hg add -S 'glob:**fm*'
1594 1591 adding fm15
1595 1592 adding s/fm17
1596 1593 $ hg st -S
1597 1594 A fm15
1598 1595 A s/fm17
1599 1596 ? fn16
1600 1597 ? s/fn18
1601 1598 $ hg ci -R s -Am5
1602 1599 adding fn18
1603 1600 $ hg ci -Am6
1604 1601 adding fn16
1605 1602
1606 1603 Test behavior of forget for explicit path in subrepo:
1607 1604 Forgetting an explicit path in a subrepo untracks the file
1608 1605 $ echo c19 > s/f19
1609 1606 $ hg add s/f19
1610 1607 $ hg st -S
1611 1608 A s/f19
1612 1609 $ hg forget s/f19
1613 1610 $ hg st -S
1614 1611 ? s/f19
1615 1612 $ rm s/f19
1616 1613 $ cd ..
1617 1614
1618 1615 Courtesy phases synchronisation to publishing server does not block the push
1619 1616 (issue3781)
1620 1617
1621 1618 $ cp -R main issue3781
1622 1619 $ cp -R main issue3781-dest
1623 1620 $ cd issue3781-dest/s
1624 1621 $ hg phase tip # show we have draft changeset
1625 1622 5: draft
1626 1623 $ chmod a-w .hg/store/phaseroots # prevent phase push
1627 1624 $ cd ../../issue3781
1628 1625 $ cat >> .hg/hgrc << EOF
1629 1626 > [paths]
1630 1627 > default=../issue3781-dest/
1631 1628 > EOF
1632 1629 $ hg push --config devel.legacy.exchange=bundle1
1633 1630 pushing to $TESTTMP/issue3781-dest
1634 1631 pushing subrepo s to $TESTTMP/issue3781-dest/s
1635 1632 searching for changes
1636 1633 no changes found
1637 1634 searching for changes
1638 1635 no changes found
1639 1636 [1]
1640 1637 # clean the push cache
1641 1638 $ rm s/.hg/cache/storehash/*
1642 1639 $ hg push # bundle2+
1643 1640 pushing to $TESTTMP/issue3781-dest
1644 1641 pushing subrepo s to $TESTTMP/issue3781-dest/s
1645 1642 searching for changes
1646 1643 no changes found
1647 1644 searching for changes
1648 1645 no changes found
1649 1646 [1]
1650 1647 $ cd ..
1651 1648
1652 1649 Test phase choice for newly created commit with "phases.subrepochecks"
1653 1650 configuration
1654 1651
1655 1652 $ cd t
1656 1653 $ hg update -q -r 12
1657 1654
1658 1655 $ cat >> s/ss/.hg/hgrc <<EOF
1659 1656 > [phases]
1660 1657 > new-commit = secret
1661 1658 > EOF
1662 1659 $ cat >> s/.hg/hgrc <<EOF
1663 1660 > [phases]
1664 1661 > new-commit = draft
1665 1662 > EOF
1666 1663 $ echo phasecheck1 >> s/ss/a
1667 1664 $ hg -R s commit -S --config phases.checksubrepos=abort -m phasecheck1
1668 1665 committing subrepository ss
1669 1666 transaction abort!
1670 1667 rollback completed
1671 1668 abort: can't commit in draft phase conflicting secret from subrepository ss
1672 1669 [255]
1673 1670 $ echo phasecheck2 >> s/ss/a
1674 1671 $ hg -R s commit -S --config phases.checksubrepos=ignore -m phasecheck2
1675 1672 committing subrepository ss
1676 1673 $ hg -R s/ss phase tip
1677 1674 3: secret
1678 1675 $ hg -R s phase tip
1679 1676 6: draft
1680 1677 $ echo phasecheck3 >> s/ss/a
1681 1678 $ hg -R s commit -S -m phasecheck3
1682 1679 committing subrepository ss
1683 1680 warning: changes are committed in secret phase from subrepository ss
1684 1681 $ hg -R s/ss phase tip
1685 1682 4: secret
1686 1683 $ hg -R s phase tip
1687 1684 7: secret
1688 1685
1689 1686 $ cat >> t/.hg/hgrc <<EOF
1690 1687 > [phases]
1691 1688 > new-commit = draft
1692 1689 > EOF
1693 1690 $ cat >> .hg/hgrc <<EOF
1694 1691 > [phases]
1695 1692 > new-commit = public
1696 1693 > EOF
1697 1694 $ echo phasecheck4 >> s/ss/a
1698 1695 $ echo phasecheck4 >> t/t
1699 1696 $ hg commit -S -m phasecheck4
1700 1697 committing subrepository s
1701 1698 committing subrepository s/ss
1702 1699 warning: changes are committed in secret phase from subrepository ss
1703 1700 committing subrepository t
1704 1701 warning: changes are committed in secret phase from subrepository s
1705 1702 created new head
1706 1703 $ hg -R s/ss phase tip
1707 1704 5: secret
1708 1705 $ hg -R s phase tip
1709 1706 8: secret
1710 1707 $ hg -R t phase tip
1711 1708 6: draft
1712 1709 $ hg phase tip
1713 1710 15: secret
1714 1711
1715 1712 $ cd ..
1716 1713
1717 1714
1718 1715 Test that commit --secret works on both repo and subrepo (issue4182)
1719 1716
1720 1717 $ cd main
1721 1718 $ echo secret >> b
1722 1719 $ echo secret >> s/b
1723 1720 $ hg commit --secret --subrepo -m "secret"
1724 1721 committing subrepository s
1725 1722 $ hg phase -r .
1726 1723 6: secret
1727 1724 $ cd s
1728 1725 $ hg phase -r .
1729 1726 6: secret
1730 1727 $ cd ../../
1731 1728
1732 1729 Test "subrepos" template keyword
1733 1730
1734 1731 $ cd t
1735 1732 $ hg update -q 15
1736 1733 $ cat > .hgsub <<EOF
1737 1734 > s = s
1738 1735 > EOF
1739 1736 $ hg commit -m "16"
1740 1737 warning: changes are committed in secret phase from subrepository s
1741 1738
1742 1739 (addition of ".hgsub" itself)
1743 1740
1744 1741 $ hg diff --nodates -c 1 .hgsubstate
1745 1742 diff -r f7b1eb17ad24 -r 7cf8cfea66e4 .hgsubstate
1746 1743 --- /dev/null
1747 1744 +++ b/.hgsubstate
1748 1745 @@ -0,0 +1,1 @@
1749 1746 +e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
1750 1747 $ hg log -r 1 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1751 1748 f7b1eb17ad24 000000000000
1752 1749 s
1753 1750
1754 1751 (modification of existing entry)
1755 1752
1756 1753 $ hg diff --nodates -c 2 .hgsubstate
1757 1754 diff -r 7cf8cfea66e4 -r df30734270ae .hgsubstate
1758 1755 --- a/.hgsubstate
1759 1756 +++ b/.hgsubstate
1760 1757 @@ -1,1 +1,1 @@
1761 1758 -e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
1762 1759 +dc73e2e6d2675eb2e41e33c205f4bdab4ea5111d s
1763 1760 $ hg log -r 2 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1764 1761 7cf8cfea66e4 000000000000
1765 1762 s
1766 1763
1767 1764 (addition of entry)
1768 1765
1769 1766 $ hg diff --nodates -c 5 .hgsubstate
1770 1767 diff -r 7cf8cfea66e4 -r 1f14a2e2d3ec .hgsubstate
1771 1768 --- a/.hgsubstate
1772 1769 +++ b/.hgsubstate
1773 1770 @@ -1,1 +1,2 @@
1774 1771 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
1775 1772 +60ca1237c19474e7a3978b0dc1ca4e6f36d51382 t
1776 1773 $ hg log -r 5 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1777 1774 7cf8cfea66e4 000000000000
1778 1775 t
1779 1776
1780 1777 (removal of existing entry)
1781 1778
1782 1779 $ hg diff --nodates -c 16 .hgsubstate
1783 1780 diff -r 8bec38d2bd0b -r f2f70bc3d3c9 .hgsubstate
1784 1781 --- a/.hgsubstate
1785 1782 +++ b/.hgsubstate
1786 1783 @@ -1,2 +1,1 @@
1787 1784 0731af8ca9423976d3743119d0865097c07bdc1b s
1788 1785 -e202dc79b04c88a636ea8913d9182a1346d9b3dc t
1789 1786 $ hg log -r 16 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1790 1787 8bec38d2bd0b 000000000000
1791 1788 t
1792 1789
1793 1790 (merging)
1794 1791
1795 1792 $ hg diff --nodates -c 9 .hgsubstate
1796 1793 diff -r f6affe3fbfaa -r f0d2028bf86d .hgsubstate
1797 1794 --- a/.hgsubstate
1798 1795 +++ b/.hgsubstate
1799 1796 @@ -1,1 +1,2 @@
1800 1797 fc627a69481fcbe5f1135069e8a3881c023e4cf5 s
1801 1798 +60ca1237c19474e7a3978b0dc1ca4e6f36d51382 t
1802 1799 $ hg log -r 9 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1803 1800 f6affe3fbfaa 1f14a2e2d3ec
1804 1801 t
1805 1802
1806 1803 (removal of ".hgsub" itself)
1807 1804
1808 1805 $ hg diff --nodates -c 8 .hgsubstate
1809 1806 diff -r f94576341bcf -r 96615c1dad2d .hgsubstate
1810 1807 --- a/.hgsubstate
1811 1808 +++ /dev/null
1812 1809 @@ -1,2 +0,0 @@
1813 1810 -e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
1814 1811 -7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4 t
1815 1812 $ hg log -r 8 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1816 1813 f94576341bcf 000000000000
1817 1814
1818 1815 Test that '[paths]' is configured correctly at subrepo creation
1819 1816
1820 1817 $ cd $TESTTMP/tc
1821 1818 $ cat > .hgsub <<EOF
1822 1819 > # to clear bogus subrepo path 'bogus=[boguspath'
1823 1820 > s = s
1824 1821 > t = t
1825 1822 > EOF
1826 1823 $ hg update -q --clean null
1827 1824 $ rm -rf s t
1828 1825 $ cat >> .hg/hgrc <<EOF
1829 1826 > [paths]
1830 1827 > default-push = /foo/bar
1831 1828 > EOF
1832 1829 $ hg update -q
1833 1830 $ cat s/.hg/hgrc
1834 1831 [paths]
1835 1832 default = $TESTTMP/t/s
1836 1833 default-push = /foo/bar/s
1837 1834 $ cat s/ss/.hg/hgrc
1838 1835 [paths]
1839 1836 default = $TESTTMP/t/s/ss
1840 1837 default-push = /foo/bar/s/ss
1841 1838 $ cat t/.hg/hgrc
1842 1839 [paths]
1843 1840 default = $TESTTMP/t/t
1844 1841 default-push = /foo/bar/t
1845 1842
1846 1843 $ cd $TESTTMP/t
1847 1844 $ hg up -qC 0
1848 1845 $ echo 'bar' > bar.txt
1849 1846 $ hg ci -Am 'branch before subrepo add'
1850 1847 adding bar.txt
1851 1848 created new head
1852 1849 $ hg merge -r "first(subrepo('s'))"
1853 1850 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1854 1851 (branch merge, don't forget to commit)
1855 1852 $ hg status -S -X '.hgsub*'
1856 1853 A s/a
1857 1854 ? s/b
1858 1855 ? s/c
1859 1856 ? s/f1
1860 1857 $ hg status -S --rev 'p2()'
1861 1858 A bar.txt
1862 1859 ? s/b
1863 1860 ? s/c
1864 1861 ? s/f1
1865 1862 $ hg diff -S -X '.hgsub*' --nodates
1866 1863 diff -r 000000000000 s/a
1867 1864 --- /dev/null
1868 1865 +++ b/s/a
1869 1866 @@ -0,0 +1,1 @@
1870 1867 +a
1871 1868 $ hg diff -S --rev 'p2()' --nodates
1872 1869 diff -r 7cf8cfea66e4 bar.txt
1873 1870 --- /dev/null
1874 1871 +++ b/bar.txt
1875 1872 @@ -0,0 +1,1 @@
1876 1873 +bar
1877 1874
1878 1875 $ hg diff -X '.hgsub*' --nodates s
1879 1876 diff -r 000000000000 s/a
1880 1877 --- /dev/null
1881 1878 +++ b/s/a
1882 1879 @@ -0,0 +1,1 @@
1883 1880 +a
1884 1881 $ hg diff -X '.hgsub*' --nodates s/a
1885 1882 diff -r 000000000000 s/a
1886 1883 --- /dev/null
1887 1884 +++ b/s/a
1888 1885 @@ -0,0 +1,1 @@
1889 1886 +a
1890 1887
1891 1888 $ cd ..
1892 1889
1893 1890 test for ssh exploit 2017-07-25
1894 1891
1895 1892 $ cat >> $HGRCPATH << EOF
1896 1893 > [ui]
1897 1894 > ssh = sh -c "read l; read l; read l"
1898 1895 > EOF
1899 1896
1900 1897 $ hg init malicious-proxycommand
1901 1898 $ cd malicious-proxycommand
1902 1899 $ echo 's = [hg]ssh://-oProxyCommand=touch${IFS}owned/path' > .hgsub
1903 1900 $ hg init s
1904 1901 $ cd s
1905 1902 $ echo init > init
1906 1903 $ hg add
1907 1904 adding init
1908 1905 $ hg commit -m init
1909 1906 $ cd ..
1910 1907 $ hg add .hgsub
1911 1908 $ hg ci -m 'add subrepo'
1912 1909 $ cd ..
1913 1910 $ hg clone malicious-proxycommand malicious-proxycommand-clone
1914 1911 updating to branch default
1915 1912 cloning subrepo s from ssh://-oProxyCommand%3Dtouch%24%7BIFS%7Downed/path
1916 1913 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path' (in subrepository "s")
1917 1914 [255]
1918 1915
1919 1916 also check that a percent encoded '-' (%2D) doesn't work
1920 1917
1921 1918 $ cd malicious-proxycommand
1922 1919 $ echo 's = [hg]ssh://%2DoProxyCommand=touch${IFS}owned/path' > .hgsub
1923 1920 $ hg ci -m 'change url to percent encoded'
1924 1921 $ cd ..
1925 1922 $ rm -r malicious-proxycommand-clone
1926 1923 $ hg clone malicious-proxycommand malicious-proxycommand-clone
1927 1924 updating to branch default
1928 1925 cloning subrepo s from ssh://-oProxyCommand%3Dtouch%24%7BIFS%7Downed/path
1929 1926 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path' (in subrepository "s")
1930 1927 [255]
1931 1928
1932 1929 also check for a pipe
1933 1930
1934 1931 $ cd malicious-proxycommand
1935 1932 $ echo 's = [hg]ssh://fakehost|touch${IFS}owned/path' > .hgsub
1936 1933 $ hg ci -m 'change url to pipe'
1937 1934 $ cd ..
1938 1935 $ rm -r malicious-proxycommand-clone
1939 1936 $ hg clone malicious-proxycommand malicious-proxycommand-clone
1940 1937 updating to branch default
1941 1938 cloning subrepo s from ssh://fakehost%7Ctouch%24%7BIFS%7Downed/path
1942 1939 abort: no suitable response from remote hg!
1943 1940 [255]
1944 1941 $ [ ! -f owned ] || echo 'you got owned'
1945 1942
1946 1943 also check that a percent encoded '|' (%7C) doesn't work
1947 1944
1948 1945 $ cd malicious-proxycommand
1949 1946 $ echo 's = [hg]ssh://fakehost%7Ctouch%20owned/path' > .hgsub
1950 1947 $ hg ci -m 'change url to percent encoded pipe'
1951 1948 $ cd ..
1952 1949 $ rm -r malicious-proxycommand-clone
1953 1950 $ hg clone malicious-proxycommand malicious-proxycommand-clone
1954 1951 updating to branch default
1955 1952 cloning subrepo s from ssh://fakehost%7Ctouch%20owned/path
1956 1953 abort: no suitable response from remote hg!
1957 1954 [255]
1958 1955 $ [ ! -f owned ] || echo 'you got owned'
1959 1956
1960 1957 and bad usernames:
1961 1958 $ cd malicious-proxycommand
1962 1959 $ echo 's = [hg]ssh://-oProxyCommand=touch owned@example.com/path' > .hgsub
1963 1960 $ hg ci -m 'owned username'
1964 1961 $ cd ..
1965 1962 $ rm -r malicious-proxycommand-clone
1966 1963 $ hg clone malicious-proxycommand malicious-proxycommand-clone
1967 1964 updating to branch default
1968 1965 cloning subrepo s from ssh://-oProxyCommand%3Dtouch%20owned@example.com/path
1969 1966 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch owned@example.com/path' (in subrepository "s")
1970 1967 [255]
1971 1968
1972 1969 Test convert subrepositories including merge (issue5526):
1973 1970
1974 1971 $ hg init tconv
1975 1972 $ hg convert --config extensions.convert= -q t/s tconv/s
1976 1973 $ hg convert --config extensions.convert= -q t/s/ss tconv/s/ss
1977 1974 $ hg convert --config extensions.convert= -q t/t tconv/t
1978 1975
1979 1976 convert shouldn't fail because of pseudo filenode:
1980 1977
1981 1978 $ hg convert --config extensions.convert= t tconv
1982 1979 scanning source...
1983 1980 sorting...
1984 1981 converting...
1985 1982 17 0
1986 1983 16 1
1987 1984 15 2
1988 1985 14 3
1989 1986 13 4
1990 1987 12 5
1991 1988 11 6
1992 1989 10 7
1993 1990 9 8
1994 1991 8 9
1995 1992 7 10
1996 1993 6 11
1997 1994 5 12
1998 1995 4 13
1999 1996 3 rm2
2000 1997 2 phasecheck4
2001 1998 1 16
2002 1999 0 branch before subrepo add
2003 2000
2004 2001 converted .hgsubstate should point to valid nodes:
2005 2002
2006 2003 $ hg up -R tconv 9
2007 2004 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
2008 2005 $ cat tconv/.hgsubstate
2009 2006 fc627a69481fcbe5f1135069e8a3881c023e4cf5 s
2010 2007 60ca1237c19474e7a3978b0dc1ca4e6f36d51382 t
@@ -1,254 +1,251 b''
1 1 $ HGMERGE=true; export HGMERGE
2 2
3 3 $ hg init r1
4 4 $ cd r1
5 5 $ echo a > a
6 6 $ hg addremove
7 7 adding a
8 8 $ hg commit -m "1"
9 9
10 10 $ hg clone . ../r2
11 11 updating to branch default
12 12 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
13 13 $ cd ../r2
14 14 $ hg up
15 15 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
16 16 $ echo abc > a
17 17 $ hg diff --nodates
18 18 diff -r c19d34741b0a a
19 19 --- a/a
20 20 +++ b/a
21 21 @@ -1,1 +1,1 @@
22 22 -a
23 23 +abc
24 24
25 25 $ cd ../r1
26 26 $ echo b > b
27 27 $ echo a2 > a
28 28 $ hg addremove
29 29 adding b
30 30 $ hg commit -m "2"
31 31
32 32 $ cd ../r2
33 33 $ hg -q pull ../r1
34 34 $ hg status
35 35 M a
36 36 $ hg parents
37 37 changeset: 0:c19d34741b0a
38 38 user: test
39 39 date: Thu Jan 01 00:00:00 1970 +0000
40 40 summary: 1
41 41
42 42 $ hg --debug up
43 searching for copies back to rev 1
44 43 unmatched files in other:
45 44 b
46 45 resolving manifests
47 46 branchmerge: False, force: False, partial: False
48 47 ancestor: c19d34741b0a, local: c19d34741b0a+, remote: 1e71731e6fbb
49 48 preserving a for resolve of a
50 49 b: remote created -> g
51 50 getting b
52 51 a: versions differ -> m (premerge)
53 52 picked tool 'true' for a (binary False symlink False changedelete False)
54 53 merging a
55 54 my a@c19d34741b0a+ other a@1e71731e6fbb ancestor a@c19d34741b0a
56 55 a: versions differ -> m (merge)
57 56 picked tool 'true' for a (binary False symlink False changedelete False)
58 57 my a@c19d34741b0a+ other a@1e71731e6fbb ancestor a@c19d34741b0a
59 58 launching merge tool: true *$TESTTMP/r2/a* * * (glob)
60 59 merge tool returned: 0
61 60 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
62 61 $ hg parents
63 62 changeset: 1:1e71731e6fbb
64 63 tag: tip
65 64 user: test
66 65 date: Thu Jan 01 00:00:00 1970 +0000
67 66 summary: 2
68 67
69 68 $ hg --debug up 0
70 69 starting 4 threads for background file closing (?)
71 searching for copies back to rev 0
72 70 unmatched files in local (from topological common ancestor):
73 71 b
74 72 resolving manifests
75 73 branchmerge: False, force: False, partial: False
76 74 ancestor: 1e71731e6fbb, local: 1e71731e6fbb+, remote: c19d34741b0a
77 75 preserving a for resolve of a
78 76 b: other deleted -> r
79 77 removing b
80 78 starting 4 threads for background file closing (?)
81 79 a: versions differ -> m (premerge)
82 80 picked tool 'true' for a (binary False symlink False changedelete False)
83 81 merging a
84 82 my a@1e71731e6fbb+ other a@c19d34741b0a ancestor a@1e71731e6fbb
85 83 a: versions differ -> m (merge)
86 84 picked tool 'true' for a (binary False symlink False changedelete False)
87 85 my a@1e71731e6fbb+ other a@c19d34741b0a ancestor a@1e71731e6fbb
88 86 launching merge tool: true *$TESTTMP/r2/a* * * (glob)
89 87 merge tool returned: 0
90 88 0 files updated, 1 files merged, 1 files removed, 0 files unresolved
91 89 $ hg parents
92 90 changeset: 0:c19d34741b0a
93 91 user: test
94 92 date: Thu Jan 01 00:00:00 1970 +0000
95 93 summary: 1
96 94
97 95 $ hg --debug up
98 searching for copies back to rev 1
99 96 unmatched files in other:
100 97 b
101 98 resolving manifests
102 99 branchmerge: False, force: False, partial: False
103 100 ancestor: c19d34741b0a, local: c19d34741b0a+, remote: 1e71731e6fbb
104 101 preserving a for resolve of a
105 102 b: remote created -> g
106 103 getting b
107 104 a: versions differ -> m (premerge)
108 105 picked tool 'true' for a (binary False symlink False changedelete False)
109 106 merging a
110 107 my a@c19d34741b0a+ other a@1e71731e6fbb ancestor a@c19d34741b0a
111 108 a: versions differ -> m (merge)
112 109 picked tool 'true' for a (binary False symlink False changedelete False)
113 110 my a@c19d34741b0a+ other a@1e71731e6fbb ancestor a@c19d34741b0a
114 111 launching merge tool: true *$TESTTMP/r2/a* * * (glob)
115 112 merge tool returned: 0
116 113 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
117 114 $ hg parents
118 115 changeset: 1:1e71731e6fbb
119 116 tag: tip
120 117 user: test
121 118 date: Thu Jan 01 00:00:00 1970 +0000
122 119 summary: 2
123 120
124 121 $ hg -v history
125 122 changeset: 1:1e71731e6fbb
126 123 tag: tip
127 124 user: test
128 125 date: Thu Jan 01 00:00:00 1970 +0000
129 126 files: a b
130 127 description:
131 128 2
132 129
133 130
134 131 changeset: 0:c19d34741b0a
135 132 user: test
136 133 date: Thu Jan 01 00:00:00 1970 +0000
137 134 files: a
138 135 description:
139 136 1
140 137
141 138
142 139 $ hg diff --nodates
143 140 diff -r 1e71731e6fbb a
144 141 --- a/a
145 142 +++ b/a
146 143 @@ -1,1 +1,1 @@
147 144 -a2
148 145 +abc
149 146
150 147
151 148 create a second head
152 149
153 150 $ cd ../r1
154 151 $ hg up 0
155 152 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
156 153 $ echo b2 > b
157 154 $ echo a3 > a
158 155 $ hg addremove
159 156 adding b
160 157 $ hg commit -m "3"
161 158 created new head
162 159
163 160 $ cd ../r2
164 161 $ hg -q pull ../r1
165 162 $ hg status
166 163 M a
167 164 $ hg parents
168 165 changeset: 1:1e71731e6fbb
169 166 user: test
170 167 date: Thu Jan 01 00:00:00 1970 +0000
171 168 summary: 2
172 169
173 170 $ hg --debug up
174 171 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
175 172 updated to "1e71731e6fbb: 2"
176 173 1 other heads for branch "default"
177 174
178 175 test conflicting untracked files
179 176
180 177 $ hg up -qC 0
181 178 $ echo untracked > b
182 179 $ hg st
183 180 ? b
184 181 $ hg up 1
185 182 b: untracked file differs
186 183 abort: untracked files in working directory differ from files in requested revision
187 184 [255]
188 185 $ rm b
189 186
190 187 test conflicting untracked ignored file
191 188
192 189 $ hg up -qC 0
193 190 $ echo ignored > .hgignore
194 191 $ hg add .hgignore
195 192 $ hg ci -m 'add .hgignore'
196 193 created new head
197 194 $ echo ignored > ignored
198 195 $ hg add ignored
199 196 $ hg ci -m 'add ignored file'
200 197
201 198 $ hg up -q 'desc("add .hgignore")'
202 199 $ echo untracked > ignored
203 200 $ hg st
204 201 $ hg up 'desc("add ignored file")'
205 202 ignored: untracked file differs
206 203 abort: untracked files in working directory differ from files in requested revision
207 204 [255]
208 205
209 206 test a local add
210 207
211 208 $ cd ..
212 209 $ hg init a
213 210 $ hg init b
214 211 $ echo a > a/a
215 212 $ echo a > b/a
216 213 $ hg --cwd a commit -A -m a
217 214 adding a
218 215 $ cd b
219 216 $ hg add a
220 217 $ hg pull -u ../a
221 218 pulling from ../a
222 219 requesting all changes
223 220 adding changesets
224 221 adding manifests
225 222 adding file changes
226 223 added 1 changesets with 1 changes to 1 files
227 224 new changesets cb9a9f314b8b
228 225 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
229 226 $ hg st
230 227
231 228 test updating backwards through a rename
232 229
233 230 $ hg mv a b
234 231 $ hg ci -m b
235 232 $ echo b > b
236 233 $ hg up -q 0
237 234 $ hg st
238 235 M a
239 236 $ hg diff --nodates
240 237 diff -r cb9a9f314b8b a
241 238 --- a/a
242 239 +++ b/a
243 240 @@ -1,1 +1,1 @@
244 241 -a
245 242 +b
246 243
247 244 test for superfluous filemerge of clean files renamed in the past
248 245
249 246 $ hg up -qC tip
250 247 $ echo c > c
251 248 $ hg add c
252 249 $ hg up -qt:fail 0
253 250
254 251 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now