##// END OF EJS Templates
merge: make debug output easier to read...
Martin Geisler -
r15625:efdcce3f default
parent child Browse files
Show More
@@ -1,575 +1,576 b''
1 1 # merge.py - directory-level update/merge handling for Mercurial
2 2 #
3 3 # Copyright 2006, 2007 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 node import nullid, nullrev, hex, bin
9 9 from i18n import _
10 10 import scmutil, util, filemerge, copies, subrepo, encoding
11 11 import errno, os, shutil
12 12
13 13 class mergestate(object):
14 14 '''track 3-way merge state of individual files'''
15 15 def __init__(self, repo):
16 16 self._repo = repo
17 17 self._dirty = False
18 18 self._read()
19 19 def reset(self, node=None):
20 20 self._state = {}
21 21 if node:
22 22 self._local = node
23 23 shutil.rmtree(self._repo.join("merge"), True)
24 24 self._dirty = False
25 25 def _read(self):
26 26 self._state = {}
27 27 try:
28 28 f = self._repo.opener("merge/state")
29 29 for i, l in enumerate(f):
30 30 if i == 0:
31 31 self._local = bin(l[:-1])
32 32 else:
33 33 bits = l[:-1].split("\0")
34 34 self._state[bits[0]] = bits[1:]
35 35 f.close()
36 36 except IOError, err:
37 37 if err.errno != errno.ENOENT:
38 38 raise
39 39 self._dirty = False
40 40 def commit(self):
41 41 if self._dirty:
42 42 f = self._repo.opener("merge/state", "w")
43 43 f.write(hex(self._local) + "\n")
44 44 for d, v in self._state.iteritems():
45 45 f.write("\0".join([d] + v) + "\n")
46 46 f.close()
47 47 self._dirty = False
48 48 def add(self, fcl, fco, fca, fd, flags):
49 49 hash = util.sha1(fcl.path()).hexdigest()
50 50 self._repo.opener.write("merge/" + hash, fcl.data())
51 51 self._state[fd] = ['u', hash, fcl.path(), fca.path(),
52 52 hex(fca.filenode()), fco.path(), flags]
53 53 self._dirty = True
54 54 def __contains__(self, dfile):
55 55 return dfile in self._state
56 56 def __getitem__(self, dfile):
57 57 return self._state[dfile][0]
58 58 def __iter__(self):
59 59 l = self._state.keys()
60 60 l.sort()
61 61 for f in l:
62 62 yield f
63 63 def mark(self, dfile, state):
64 64 self._state[dfile][0] = state
65 65 self._dirty = True
66 66 def resolve(self, dfile, wctx, octx):
67 67 if self[dfile] == 'r':
68 68 return 0
69 69 state, hash, lfile, afile, anode, ofile, flags = self._state[dfile]
70 70 f = self._repo.opener("merge/" + hash)
71 71 self._repo.wwrite(dfile, f.read(), flags)
72 72 f.close()
73 73 fcd = wctx[dfile]
74 74 fco = octx[ofile]
75 75 fca = self._repo.filectx(afile, fileid=anode)
76 76 r = filemerge.filemerge(self._repo, self._local, lfile, fcd, fco, fca)
77 77 if r is None:
78 78 # no real conflict
79 79 del self._state[dfile]
80 80 elif not r:
81 81 self.mark(dfile, 'r')
82 82 return r
83 83
84 84 def _checkunknown(wctx, mctx, folding):
85 85 "check for collisions between unknown files and files in mctx"
86 86 if folding:
87 87 foldf = util.normcase
88 88 else:
89 89 foldf = lambda fn: fn
90 90 folded = {}
91 91 for fn in mctx:
92 92 folded[foldf(fn)] = fn
93 93 for fn in wctx.unknown():
94 94 f = foldf(fn)
95 95 if f in folded and mctx[folded[f]].cmp(wctx[f]):
96 96 raise util.Abort(_("untracked file in working directory differs"
97 97 " from file in requested revision: '%s'") % fn)
98 98
99 99 def _checkcollision(mctx):
100 100 "check for case folding collisions in the destination context"
101 101 folded = {}
102 102 for fn in mctx:
103 103 fold = encoding.lower(fn)
104 104 if fold in folded:
105 105 raise util.Abort(_("case-folding collision between %s and %s")
106 106 % (fn, folded[fold]))
107 107 folded[fold] = fn
108 108
109 109 def _forgetremoved(wctx, mctx, branchmerge):
110 110 """
111 111 Forget removed files
112 112
113 113 If we're jumping between revisions (as opposed to merging), and if
114 114 neither the working directory nor the target rev has the file,
115 115 then we need to remove it from the dirstate, to prevent the
116 116 dirstate from listing the file when it is no longer in the
117 117 manifest.
118 118
119 119 If we're merging, and the other revision has removed a file
120 120 that is not present in the working directory, we need to mark it
121 121 as removed.
122 122 """
123 123
124 124 action = []
125 125 state = branchmerge and 'r' or 'f'
126 126 for f in wctx.deleted():
127 127 if f not in mctx:
128 128 action.append((f, state))
129 129
130 130 if not branchmerge:
131 131 for f in wctx.removed():
132 132 if f not in mctx:
133 133 action.append((f, "f"))
134 134
135 135 return action
136 136
137 137 def manifestmerge(repo, p1, p2, pa, overwrite, partial):
138 138 """
139 139 Merge p1 and p2 with ancestor pa and generate merge action list
140 140
141 141 overwrite = whether we clobber working files
142 142 partial = function to filter file lists
143 143 """
144 144
145 145 def fmerge(f, f2, fa):
146 146 """merge flags"""
147 147 a, m, n = ma.flags(fa), m1.flags(f), m2.flags(f2)
148 148 if m == n: # flags agree
149 149 return m # unchanged
150 150 if m and n and not a: # flags set, don't agree, differ from parent
151 151 r = repo.ui.promptchoice(
152 152 _(" conflicting flags for %s\n"
153 153 "(n)one, e(x)ec or sym(l)ink?") % f,
154 154 (_("&None"), _("E&xec"), _("Sym&link")), 0)
155 155 if r == 1:
156 156 return "x" # Exec
157 157 if r == 2:
158 158 return "l" # Symlink
159 159 return ""
160 160 if m and m != a: # changed from a to m
161 161 return m
162 162 if n and n != a: # changed from a to n
163 163 return n
164 164 return '' # flag was cleared
165 165
166 166 def act(msg, m, f, *args):
167 167 repo.ui.debug(" %s: %s -> %s\n" % (f, msg, m))
168 168 action.append((f, m) + args)
169 169
170 170 action, copy = [], {}
171 171
172 172 if overwrite:
173 173 pa = p1
174 174 elif pa == p2: # backwards
175 175 pa = p1.p1()
176 176 elif pa and repo.ui.configbool("merge", "followcopies", True):
177 177 dirs = repo.ui.configbool("merge", "followdirs", True)
178 178 copy, diverge = copies.copies(repo, p1, p2, pa, dirs)
179 179 for of, fl in diverge.iteritems():
180 180 act("divergent renames", "dr", of, fl)
181 181
182 182 repo.ui.note(_("resolving manifests\n"))
183 repo.ui.debug(" overwrite %s partial %s\n" % (overwrite, bool(partial)))
184 repo.ui.debug(" ancestor %s local %s remote %s\n" % (pa, p1, p2))
183 repo.ui.debug(" overwrite: %s, partial: %s\n"
184 % (bool(overwrite), bool(partial)))
185 repo.ui.debug(" ancestor: %s, local: %s, remote: %s\n" % (pa, p1, p2))
185 186
186 187 m1, m2, ma = p1.manifest(), p2.manifest(), pa.manifest()
187 188 copied = set(copy.values())
188 189
189 190 if '.hgsubstate' in m1:
190 191 # check whether sub state is modified
191 192 for s in p1.substate:
192 193 if p1.sub(s).dirty():
193 194 m1['.hgsubstate'] += "+"
194 195 break
195 196
196 197 # Compare manifests
197 198 for f, n in m1.iteritems():
198 199 if partial and not partial(f):
199 200 continue
200 201 if f in m2:
201 202 rflags = fmerge(f, f, f)
202 203 a = ma.get(f, nullid)
203 204 if n == m2[f] or m2[f] == a: # same or local newer
204 205 # is file locally modified or flags need changing?
205 206 # dirstate flags may need to be made current
206 207 if m1.flags(f) != rflags or n[20:]:
207 208 act("update permissions", "e", f, rflags)
208 209 elif n == a: # remote newer
209 210 act("remote is newer", "g", f, rflags)
210 211 else: # both changed
211 212 act("versions differ", "m", f, f, f, rflags, False)
212 213 elif f in copied: # files we'll deal with on m2 side
213 214 pass
214 215 elif f in copy:
215 216 f2 = copy[f]
216 217 if f2 not in m2: # directory rename
217 218 act("remote renamed directory to " + f2, "d",
218 219 f, None, f2, m1.flags(f))
219 220 else: # case 2 A,B/B/B or case 4,21 A/B/B
220 221 act("local copied/moved to " + f2, "m",
221 222 f, f2, f, fmerge(f, f2, f2), False)
222 223 elif f in ma: # clean, a different, no remote
223 224 if n != ma[f]:
224 225 if repo.ui.promptchoice(
225 226 _(" local changed %s which remote deleted\n"
226 227 "use (c)hanged version or (d)elete?") % f,
227 228 (_("&Changed"), _("&Delete")), 0):
228 229 act("prompt delete", "r", f)
229 230 else:
230 231 act("prompt keep", "a", f)
231 232 elif n[20:] == "a": # added, no remote
232 233 act("remote deleted", "f", f)
233 234 elif n[20:] != "u":
234 235 act("other deleted", "r", f)
235 236
236 237 for f, n in m2.iteritems():
237 238 if partial and not partial(f):
238 239 continue
239 240 if f in m1 or f in copied: # files already visited
240 241 continue
241 242 if f in copy:
242 243 f2 = copy[f]
243 244 if f2 not in m1: # directory rename
244 245 act("local renamed directory to " + f2, "d",
245 246 None, f, f2, m2.flags(f))
246 247 elif f2 in m2: # rename case 1, A/A,B/A
247 248 act("remote copied to " + f, "m",
248 249 f2, f, f, fmerge(f2, f, f2), False)
249 250 else: # case 3,20 A/B/A
250 251 act("remote moved to " + f, "m",
251 252 f2, f, f, fmerge(f2, f, f2), True)
252 253 elif f not in ma:
253 254 act("remote created", "g", f, m2.flags(f))
254 255 elif n != ma[f]:
255 256 if repo.ui.promptchoice(
256 257 _("remote changed %s which local deleted\n"
257 258 "use (c)hanged version or leave (d)eleted?") % f,
258 259 (_("&Changed"), _("&Deleted")), 0) == 0:
259 260 act("prompt recreating", "g", f, m2.flags(f))
260 261
261 262 return action
262 263
263 264 def actionkey(a):
264 265 return a[1] == 'r' and -1 or 0, a
265 266
266 267 def applyupdates(repo, action, wctx, mctx, actx, overwrite):
267 268 """apply the merge action list to the working directory
268 269
269 270 wctx is the working copy context
270 271 mctx is the context to be merged into the working copy
271 272 actx is the context of the common ancestor
272 273
273 274 Return a tuple of counts (updated, merged, removed, unresolved) that
274 275 describes how many files were affected by the update.
275 276 """
276 277
277 278 updated, merged, removed, unresolved = 0, 0, 0, 0
278 279 ms = mergestate(repo)
279 280 ms.reset(wctx.p1().node())
280 281 moves = []
281 282 action.sort(key=actionkey)
282 283
283 284 # prescan for merges
284 285 for a in action:
285 286 f, m = a[:2]
286 287 if m == 'm': # merge
287 288 f2, fd, flags, move = a[2:]
288 289 if f == '.hgsubstate': # merged internally
289 290 continue
290 291 repo.ui.debug("preserving %s for resolve of %s\n" % (f, fd))
291 292 fcl = wctx[f]
292 293 fco = mctx[f2]
293 294 if mctx == actx: # backwards, use working dir parent as ancestor
294 295 if fcl.parents():
295 296 fca = fcl.p1()
296 297 else:
297 298 fca = repo.filectx(f, fileid=nullrev)
298 299 else:
299 300 fca = fcl.ancestor(fco, actx)
300 301 if not fca:
301 302 fca = repo.filectx(f, fileid=nullrev)
302 303 ms.add(fcl, fco, fca, fd, flags)
303 304 if f != fd and move:
304 305 moves.append(f)
305 306
306 307 audit = scmutil.pathauditor(repo.root)
307 308
308 309 # remove renamed files after safely stored
309 310 for f in moves:
310 311 if os.path.lexists(repo.wjoin(f)):
311 312 repo.ui.debug("removing %s\n" % f)
312 313 audit(f)
313 314 os.unlink(repo.wjoin(f))
314 315
315 316 numupdates = len(action)
316 317 for i, a in enumerate(action):
317 318 f, m = a[:2]
318 319 repo.ui.progress(_('updating'), i + 1, item=f, total=numupdates,
319 320 unit=_('files'))
320 321 if f and f[0] == "/":
321 322 continue
322 323 if m == "r": # remove
323 324 repo.ui.note(_("removing %s\n") % f)
324 325 audit(f)
325 326 if f == '.hgsubstate': # subrepo states need updating
326 327 subrepo.submerge(repo, wctx, mctx, wctx, overwrite)
327 328 try:
328 329 util.unlinkpath(repo.wjoin(f))
329 330 except OSError, inst:
330 331 if inst.errno != errno.ENOENT:
331 332 repo.ui.warn(_("update failed to remove %s: %s!\n") %
332 333 (f, inst.strerror))
333 334 removed += 1
334 335 elif m == "m": # merge
335 336 if f == '.hgsubstate': # subrepo states need updating
336 337 subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx), overwrite)
337 338 continue
338 339 f2, fd, flags, move = a[2:]
339 340 repo.wopener.audit(fd)
340 341 r = ms.resolve(fd, wctx, mctx)
341 342 if r is not None and r > 0:
342 343 unresolved += 1
343 344 else:
344 345 if r is None:
345 346 updated += 1
346 347 else:
347 348 merged += 1
348 349 util.setflags(repo.wjoin(fd), 'l' in flags, 'x' in flags)
349 350 if (move and repo.dirstate.normalize(fd) != f
350 351 and os.path.lexists(repo.wjoin(f))):
351 352 repo.ui.debug("removing %s\n" % f)
352 353 audit(f)
353 354 os.unlink(repo.wjoin(f))
354 355 elif m == "g": # get
355 356 flags = a[2]
356 357 repo.ui.note(_("getting %s\n") % f)
357 358 t = mctx.filectx(f).data()
358 359 repo.wwrite(f, t, flags)
359 360 t = None
360 361 updated += 1
361 362 if f == '.hgsubstate': # subrepo states need updating
362 363 subrepo.submerge(repo, wctx, mctx, wctx, overwrite)
363 364 elif m == "d": # directory rename
364 365 f2, fd, flags = a[2:]
365 366 if f:
366 367 repo.ui.note(_("moving %s to %s\n") % (f, fd))
367 368 audit(f)
368 369 t = wctx.filectx(f).data()
369 370 repo.wwrite(fd, t, flags)
370 371 util.unlinkpath(repo.wjoin(f))
371 372 if f2:
372 373 repo.ui.note(_("getting %s to %s\n") % (f2, fd))
373 374 t = mctx.filectx(f2).data()
374 375 repo.wwrite(fd, t, flags)
375 376 updated += 1
376 377 elif m == "dr": # divergent renames
377 378 fl = a[2]
378 379 repo.ui.warn(_("note: possible conflict - %s was renamed "
379 380 "multiple times to:\n") % f)
380 381 for nf in fl:
381 382 repo.ui.warn(" %s\n" % nf)
382 383 elif m == "e": # exec
383 384 flags = a[2]
384 385 repo.wopener.audit(f)
385 386 util.setflags(repo.wjoin(f), 'l' in flags, 'x' in flags)
386 387 ms.commit()
387 388 repo.ui.progress(_('updating'), None, total=numupdates, unit=_('files'))
388 389
389 390 return updated, merged, removed, unresolved
390 391
391 392 def recordupdates(repo, action, branchmerge):
392 393 "record merge actions to the dirstate"
393 394
394 395 for a in action:
395 396 f, m = a[:2]
396 397 if m == "r": # remove
397 398 if branchmerge:
398 399 repo.dirstate.remove(f)
399 400 else:
400 401 repo.dirstate.drop(f)
401 402 elif m == "a": # re-add
402 403 if not branchmerge:
403 404 repo.dirstate.add(f)
404 405 elif m == "f": # forget
405 406 repo.dirstate.drop(f)
406 407 elif m == "e": # exec change
407 408 repo.dirstate.normallookup(f)
408 409 elif m == "g": # get
409 410 if branchmerge:
410 411 repo.dirstate.otherparent(f)
411 412 else:
412 413 repo.dirstate.normal(f)
413 414 elif m == "m": # merge
414 415 f2, fd, flag, move = a[2:]
415 416 if branchmerge:
416 417 # We've done a branch merge, mark this file as merged
417 418 # so that we properly record the merger later
418 419 repo.dirstate.merge(fd)
419 420 if f != f2: # copy/rename
420 421 if move:
421 422 repo.dirstate.remove(f)
422 423 if f != fd:
423 424 repo.dirstate.copy(f, fd)
424 425 else:
425 426 repo.dirstate.copy(f2, fd)
426 427 else:
427 428 # We've update-merged a locally modified file, so
428 429 # we set the dirstate to emulate a normal checkout
429 430 # of that file some time in the past. Thus our
430 431 # merge will appear as a normal local file
431 432 # modification.
432 433 if f2 == fd: # file not locally copied/moved
433 434 repo.dirstate.normallookup(fd)
434 435 if move:
435 436 repo.dirstate.drop(f)
436 437 elif m == "d": # directory rename
437 438 f2, fd, flag = a[2:]
438 439 if not f2 and f not in repo.dirstate:
439 440 # untracked file moved
440 441 continue
441 442 if branchmerge:
442 443 repo.dirstate.add(fd)
443 444 if f:
444 445 repo.dirstate.remove(f)
445 446 repo.dirstate.copy(f, fd)
446 447 if f2:
447 448 repo.dirstate.copy(f2, fd)
448 449 else:
449 450 repo.dirstate.normal(fd)
450 451 if f:
451 452 repo.dirstate.drop(f)
452 453
453 454 def update(repo, node, branchmerge, force, partial, ancestor=None):
454 455 """
455 456 Perform a merge between the working directory and the given node
456 457
457 458 node = the node to update to, or None if unspecified
458 459 branchmerge = whether to merge between branches
459 460 force = whether to force branch merging or file overwriting
460 461 partial = a function to filter file lists (dirstate not updated)
461 462
462 463 The table below shows all the behaviors of the update command
463 464 given the -c and -C or no options, whether the working directory
464 465 is dirty, whether a revision is specified, and the relationship of
465 466 the parent rev to the target rev (linear, on the same named
466 467 branch, or on another named branch).
467 468
468 469 This logic is tested by test-update-branches.t.
469 470
470 471 -c -C dirty rev | linear same cross
471 472 n n n n | ok (1) x
472 473 n n n y | ok ok ok
473 474 n n y * | merge (2) (2)
474 475 n y * * | --- discard ---
475 476 y n y * | --- (3) ---
476 477 y n n * | --- ok ---
477 478 y y * * | --- (4) ---
478 479
479 480 x = can't happen
480 481 * = don't-care
481 482 1 = abort: crosses branches (use 'hg merge' or 'hg update -c')
482 483 2 = abort: crosses branches (use 'hg merge' to merge or
483 484 use 'hg update -C' to discard changes)
484 485 3 = abort: uncommitted local changes
485 486 4 = incompatible options (checked in commands.py)
486 487
487 488 Return the same tuple as applyupdates().
488 489 """
489 490
490 491 onode = node
491 492 wlock = repo.wlock()
492 493 try:
493 494 wc = repo[None]
494 495 if node is None:
495 496 # tip of current branch
496 497 try:
497 498 node = repo.branchtags()[wc.branch()]
498 499 except KeyError:
499 500 if wc.branch() == "default": # no default branch!
500 501 node = repo.lookup("tip") # update to tip
501 502 else:
502 503 raise util.Abort(_("branch %s not found") % wc.branch())
503 504 overwrite = force and not branchmerge
504 505 pl = wc.parents()
505 506 p1, p2 = pl[0], repo[node]
506 507 if ancestor:
507 508 pa = repo[ancestor]
508 509 else:
509 510 pa = p1.ancestor(p2)
510 511
511 512 fp1, fp2, xp1, xp2 = p1.node(), p2.node(), str(p1), str(p2)
512 513
513 514 ### check phase
514 515 if not overwrite and len(pl) > 1:
515 516 raise util.Abort(_("outstanding uncommitted merges"))
516 517 if branchmerge:
517 518 if pa == p2:
518 519 raise util.Abort(_("merging with a working directory ancestor"
519 520 " has no effect"))
520 521 elif pa == p1:
521 522 if p1.branch() == p2.branch():
522 523 raise util.Abort(_("nothing to merge"),
523 524 hint=_("use 'hg update' "
524 525 "or check 'hg heads'"))
525 526 if not force and (wc.files() or wc.deleted()):
526 527 raise util.Abort(_("outstanding uncommitted changes"),
527 528 hint=_("use 'hg status' to list changes"))
528 529 for s in wc.substate:
529 530 if wc.sub(s).dirty():
530 531 raise util.Abort(_("outstanding uncommitted changes in "
531 532 "subrepository '%s'") % s)
532 533
533 534 elif not overwrite:
534 535 if pa == p1 or pa == p2: # linear
535 536 pass # all good
536 537 elif wc.dirty(missing=True):
537 538 raise util.Abort(_("crosses branches (merge branches or use"
538 539 " --clean to discard changes)"))
539 540 elif onode is None:
540 541 raise util.Abort(_("crosses branches (merge branches or update"
541 542 " --check to force update)"))
542 543 else:
543 544 # Allow jumping branches if clean and specific rev given
544 545 overwrite = True
545 546
546 547 ### calculate phase
547 548 action = []
548 549 wc.status(unknown=True) # prime cache
549 550 folding = not util.checkcase(repo.path)
550 551 if not force:
551 552 _checkunknown(wc, p2, folding)
552 553 if folding:
553 554 _checkcollision(p2)
554 555 action += _forgetremoved(wc, p2, branchmerge)
555 556 action += manifestmerge(repo, wc, p2, pa, overwrite, partial)
556 557
557 558 ### apply phase
558 559 if not branchmerge: # just jump to the new rev
559 560 fp1, fp2, xp1, xp2 = fp2, nullid, xp2, ''
560 561 if not partial:
561 562 repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2)
562 563
563 564 stats = applyupdates(repo, action, wc, p2, pa, overwrite)
564 565
565 566 if not partial:
566 567 repo.dirstate.setparents(fp1, fp2)
567 568 recordupdates(repo, action, branchmerge)
568 569 if not branchmerge:
569 570 repo.dirstate.setbranch(p2.branch())
570 571 finally:
571 572 wlock.release()
572 573
573 574 if not partial:
574 575 repo.hook('update', parent1=xp1, parent2=xp2, error=stats[3])
575 576 return stats
@@ -1,62 +1,62 b''
1 1 $ hg init t
2 2 $ cd t
3 3
4 4 $ echo 1 > a
5 5 $ hg ci -qAm "first"
6 6
7 7 $ hg cp a b
8 8 $ hg mv a c
9 9 $ echo 2 >> b
10 10 $ echo 2 >> c
11 11
12 12 $ hg ci -qAm "second"
13 13
14 14 $ hg co -C 0
15 15 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
16 16
17 17 $ echo 0 > a
18 18 $ echo 1 >> a
19 19
20 20 $ hg ci -qAm "other"
21 21
22 22 $ hg merge --debug
23 23 searching for copies back to rev 1
24 24 unmatched files in other:
25 25 b
26 26 c
27 27 all copies found (* = to merge, ! = divergent):
28 28 c -> a *
29 29 b -> a *
30 30 checking for directory renames
31 31 resolving manifests
32 overwrite None partial False
33 ancestor b8bf91eeebbc local add3f11052fa+ remote 17c05bb7fcb6
32 overwrite: False, partial: False
33 ancestor: b8bf91eeebbc, local: add3f11052fa+, remote: 17c05bb7fcb6
34 34 a: remote moved to c -> m
35 35 a: remote moved to b -> m
36 36 preserving a for resolve of b
37 37 preserving a for resolve of c
38 38 removing a
39 39 updating: a 1/2 files (50.00%)
40 40 picked tool 'internal:merge' for b (binary False symlink False)
41 41 merging a and b to b
42 42 my b@add3f11052fa+ other b@17c05bb7fcb6 ancestor a@b8bf91eeebbc
43 43 premerge successful
44 44 updating: a 2/2 files (100.00%)
45 45 picked tool 'internal:merge' for c (binary False symlink False)
46 46 merging a and c to c
47 47 my c@add3f11052fa+ other c@17c05bb7fcb6 ancestor a@b8bf91eeebbc
48 48 premerge successful
49 49 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
50 50 (branch merge, don't forget to commit)
51 51
52 52 file b
53 53 $ cat b
54 54 0
55 55 1
56 56 2
57 57
58 58 file c
59 59 $ cat c
60 60 0
61 61 1
62 62 2
@@ -1,65 +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 29 searching for copies back to rev 1
30 30 unmatched files in other:
31 31 bar
32 32 all copies found (* = to merge, ! = divergent):
33 33 bar -> foo *
34 34 checking for directory renames
35 35 resolving manifests
36 overwrite None partial False
37 ancestor e6dc8efe11cc local 6a0df1dad128+ remote 484bf6903104
36 overwrite: False, partial: False
37 ancestor: e6dc8efe11cc, local: 6a0df1dad128+, remote: 484bf6903104
38 38 foo: versions differ -> m
39 39 foo: remote copied to bar -> m
40 40 preserving foo for resolve of bar
41 41 preserving foo for resolve of foo
42 42 updating: foo 1/2 files (50.00%)
43 43 picked tool 'internal:merge' for bar (binary False symlink False)
44 44 merging foo and bar to bar
45 45 my bar@6a0df1dad128+ other bar@484bf6903104 ancestor foo@e6dc8efe11cc
46 46 premerge successful
47 47 updating: foo 2/2 files (100.00%)
48 48 picked tool 'internal:merge' for foo (binary False symlink False)
49 49 merging foo
50 50 my foo@6a0df1dad128+ other foo@484bf6903104 ancestor foo@e6dc8efe11cc
51 51 premerge successful
52 52 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
53 53 (branch merge, don't forget to commit)
54 54
55 55 contents of foo
56 56 $ cat foo
57 57 line 0
58 58 line 1
59 59 line 2-1
60 60
61 61 contents of bar
62 62 $ cat bar
63 63 line 0
64 64 line 1
65 65 line 2-2
@@ -1,279 +1,279 b''
1 1 Create a repo with some stuff in it:
2 2
3 3 $ hg init a
4 4 $ cd a
5 5 $ echo a > a
6 6 $ echo a > d
7 7 $ echo a > e
8 8 $ hg ci -qAm0
9 9 $ echo b > a
10 10 $ hg ci -m1 -u bar
11 11 $ hg mv a b
12 12 $ hg ci -m2
13 13 $ hg cp b c
14 14 $ hg ci -m3 -u baz
15 15 $ echo b > d
16 16 $ echo f > e
17 17 $ hg ci -m4
18 18 $ hg up -q 3
19 19 $ echo b > e
20 20 $ hg branch -q stable
21 21 $ hg ci -m5
22 22 $ hg merge -q default --tool internal:local
23 23 $ hg branch -q default
24 24 $ hg ci -m6
25 25
26 26 Need to specify a rev:
27 27
28 28 $ hg graft
29 29 abort: no revisions specified
30 30 [255]
31 31
32 32 Can't graft ancestor:
33 33
34 34 $ hg graft 1 2
35 35 skipping ancestor revision 1
36 36 skipping ancestor revision 2
37 37 [255]
38 38
39 39 Can't graft with dirty wd:
40 40
41 41 $ hg up -q 0
42 42 $ echo foo > a
43 43 $ hg graft 1
44 44 abort: outstanding uncommitted changes
45 45 [255]
46 46 $ hg revert a
47 47
48 48 Graft a rename:
49 49
50 50 $ hg graft 2 -u foo
51 51 grafting revision 2
52 52 merging a and b to b
53 53 $ hg export tip --git
54 54 # HG changeset patch
55 55 # User foo
56 56 # Date 0 0
57 57 # Node ID d2e44c99fd3f31c176ea4efb9eca9f6306c81756
58 58 # Parent 68795b066622ca79a25816a662041d8f78f3cd9e
59 59 2
60 60
61 61 diff --git a/a b/b
62 62 rename from a
63 63 rename to b
64 64 --- a/a
65 65 +++ b/b
66 66 @@ -1,1 +1,1 @@
67 67 -a
68 68 +b
69 69
70 70 Look for extra:source
71 71
72 72 $ hg log --debug -r tip
73 73 changeset: 7:d2e44c99fd3f31c176ea4efb9eca9f6306c81756
74 74 tag: tip
75 75 parent: 0:68795b066622ca79a25816a662041d8f78f3cd9e
76 76 parent: -1:0000000000000000000000000000000000000000
77 77 manifest: 7:5d59766436fd8fbcd38e7bebef0f6eaf3eebe637
78 78 user: foo
79 79 date: Thu Jan 01 00:00:00 1970 +0000
80 80 files+: b
81 81 files-: a
82 82 extra: branch=default
83 83 extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4
84 84 description:
85 85 2
86 86
87 87
88 88
89 89 Graft out of order, skipping a merge and a duplicate
90 90
91 91 $ hg graft 1 5 4 3 'merge()' 2 --debug
92 92 skipping ungraftable merge revision 6
93 93 scanning for duplicate grafts
94 94 skipping already grafted revision 2
95 95 grafting revision 1
96 96 searching for copies back to rev 1
97 97 unmatched files in local:
98 98 a.orig
99 99 b
100 100 all copies found (* = to merge, ! = divergent):
101 101 b -> a *
102 102 checking for directory renames
103 103 resolving manifests
104 overwrite False partial False
105 ancestor 68795b066622 local d2e44c99fd3f+ remote 5d205f8b35b6
104 overwrite: False, partial: False
105 ancestor: 68795b066622, local: d2e44c99fd3f+, remote: 5d205f8b35b6
106 106 b: local copied/moved to a -> m
107 107 preserving b for resolve of b
108 108 updating: b 1/1 files (100.00%)
109 109 searching for copies back to rev 1
110 110 unmatched files in local:
111 111 a
112 112 unmatched files in other:
113 113 b
114 114 all copies found (* = to merge, ! = divergent):
115 115 b -> a *
116 116 checking for directory renames
117 117 b
118 118 b: searching for copy revision for a
119 119 b: copy a:b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
120 120 grafting revision 5
121 121 searching for copies back to rev 1
122 122 unmatched files in local:
123 123 a.orig
124 124 resolving manifests
125 overwrite False partial False
126 ancestor 4c60f11aa304 local 6f5ea6ac8b70+ remote 97f8bfe72746
125 overwrite: False, partial: False
126 ancestor: 4c60f11aa304, local: 6f5ea6ac8b70+, remote: 97f8bfe72746
127 127 e: remote is newer -> g
128 128 updating: e 1/1 files (100.00%)
129 129 getting e
130 130 searching for copies back to rev 1
131 131 unmatched files in local:
132 132 c
133 133 all copies found (* = to merge, ! = divergent):
134 134 c -> b *
135 135 checking for directory renames
136 136 e
137 137 grafting revision 4
138 138 searching for copies back to rev 1
139 139 unmatched files in local:
140 140 a.orig
141 141 resolving manifests
142 overwrite False partial False
143 ancestor 4c60f11aa304 local 77eb504366ab+ remote 9c233e8e184d
142 overwrite: False, partial: False
143 ancestor: 4c60f11aa304, local: 77eb504366ab+, remote: 9c233e8e184d
144 144 e: versions differ -> m
145 145 d: remote is newer -> g
146 146 preserving e for resolve of e
147 147 updating: d 1/2 files (50.00%)
148 148 getting d
149 149 updating: e 2/2 files (100.00%)
150 150 picked tool 'internal:merge' for e (binary False symlink False)
151 151 merging e
152 152 my e@77eb504366ab+ other e@9c233e8e184d ancestor e@68795b066622
153 153 warning: conflicts during merge.
154 154 merging e incomplete! (edit conflicts, then use 'hg resolve --mark')
155 155 searching for copies back to rev 1
156 156 unmatched files in local:
157 157 c
158 158 all copies found (* = to merge, ! = divergent):
159 159 c -> b *
160 160 checking for directory renames
161 161 abort: unresolved conflicts, can't continue
162 162 (use hg resolve and hg graft --continue)
163 163 [255]
164 164
165 165 Continue without resolve should fail:
166 166
167 167 $ hg graft -c
168 168 grafting revision 4
169 169 abort: unresolved merge conflicts (see hg help resolve)
170 170 [255]
171 171
172 172 Fix up:
173 173
174 174 $ echo b > e
175 175 $ hg resolve -m e
176 176
177 177 Continue with a revision should fail:
178 178
179 179 $ hg graft -c 6
180 180 abort: can't specify --continue and revisions
181 181 [255]
182 182
183 183 Continue for real, clobber usernames
184 184
185 185 $ hg graft -c -U
186 186 grafting revision 4
187 187 grafting revision 3
188 188
189 189 Compare with original:
190 190
191 191 $ hg diff -r 6
192 192 $ hg status --rev 0:. -C
193 193 M d
194 194 M e
195 195 A b
196 196 a
197 197 A c
198 198 a
199 199 R a
200 200
201 201 View graph:
202 202
203 203 $ hg --config extensions.graphlog= log -G --template '{author}@{rev}: {desc}\n'
204 204 @ test@11: 3
205 205 |
206 206 o test@10: 4
207 207 |
208 208 o test@9: 5
209 209 |
210 210 o bar@8: 1
211 211 |
212 212 o foo@7: 2
213 213 |
214 214 | o test@6: 6
215 215 | |\
216 216 | | o test@5: 5
217 217 | | |
218 218 | o | test@4: 4
219 219 | |/
220 220 | o baz@3: 3
221 221 | |
222 222 | o test@2: 2
223 223 | |
224 224 | o bar@1: 1
225 225 |/
226 226 o test@0: 0
227 227
228 228 Graft again onto another branch should preserve the original source
229 229 $ hg up -q 0
230 230 $ echo 'g'>g
231 231 $ hg add g
232 232 $ hg ci -m 7
233 233 created new head
234 234 $ hg graft 7
235 235 grafting revision 7
236 236
237 237 $ hg log -r 7 --template '{rev}:{node}\n'
238 238 7:d2e44c99fd3f31c176ea4efb9eca9f6306c81756
239 239 $ hg log -r 2 --template '{rev}:{node}\n'
240 240 2:5c095ad7e90f871700f02dd1fa5012cb4498a2d4
241 241
242 242 $ hg log --debug -r tip
243 243 changeset: 13:39bb1d13572759bd1e6fc874fed1b12ece047a18
244 244 tag: tip
245 245 parent: 12:b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
246 246 parent: -1:0000000000000000000000000000000000000000
247 247 manifest: 13:0780e055d8f4cd12eadd5a2719481648f336f7a9
248 248 user: foo
249 249 date: Thu Jan 01 00:00:00 1970 +0000
250 250 files+: b
251 251 files-: a
252 252 extra: branch=default
253 253 extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4
254 254 description:
255 255 2
256 256
257 257
258 258 Disallow grafting an already grafted cset onto its original branch
259 259 $ hg up -q 6
260 260 $ hg graft 7
261 261 skipping already grafted revision 7 (was grafted from 2)
262 262 [255]
263 263
264 264 Disallow grafting already grafted csets with the same origin onto each other
265 265 $ hg up -q 13
266 266 $ hg graft 2
267 267 skipping already grafted revision 2
268 268 [255]
269 269 $ hg graft 7
270 270 skipping already grafted revision 7 (same origin 2)
271 271 [255]
272 272
273 273 $ hg up -q 7
274 274 $ hg graft 2
275 275 skipping already grafted revision 2
276 276 [255]
277 277 $ hg graft tip
278 278 skipping already grafted revision 13 (same origin 2)
279 279 [255]
@@ -1,71 +1,71 b''
1 1 $ "$TESTDIR/hghave" execbit || exit 80
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 (run 'hg heads' to see heads, 'hg merge' to merge)
47 47
48 48 $ hg manifest -v -r tip
49 49 755 * a
50 50
51 51 Simulate a Windows merge:
52 52
53 53 $ hg --config extensions.n=$TESTTMP/noexec.py merge --debug
54 54 searching for copies back to rev 1
55 55 unmatched files in local:
56 56 b
57 57 resolving manifests
58 overwrite None partial False
59 ancestor a03b0deabf2b local d6fa54f68ae1+ remote 2d8bcf2dda39
58 overwrite: False, partial: False
59 ancestor: a03b0deabf2b, local: d6fa54f68ae1+, remote: 2d8bcf2dda39
60 60 a: update permissions -> e
61 61 updating: a 1/1 files (100.00%)
62 62 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
63 63 (branch merge, don't forget to commit)
64 64
65 65 Simulate a Windows commit:
66 66
67 67 $ hg --config extensions.n=$TESTTMP/noexec.py commit -m 'win: merge'
68 68
69 69 $ hg manifest -v
70 70 755 * a
71 71 644 b
@@ -1,56 +1,56 b''
1 1 http://mercurial.selenic.com/bts/issue522
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 28 searching for copies back to rev 1
29 29 unmatched files in local:
30 30 bar
31 31 resolving manifests
32 overwrite None partial False
33 ancestor bbd179dfa0a7 local 71766447bdbb+ remote 4d9e78aaceee
32 overwrite: False, partial: False
33 ancestor: bbd179dfa0a7, local: 71766447bdbb+, remote: 4d9e78aaceee
34 34 foo: remote is newer -> g
35 35 updating: foo 1/1 files (100.00%)
36 36 getting foo
37 37 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
38 38 (branch merge, don't forget to commit)
39 39
40 40 $ hg debugstate | grep foo
41 41 n 0 -2 unset foo
42 42
43 43 $ hg st -A foo
44 44 M foo
45 45
46 46 $ hg ci -m 'merge'
47 47
48 48 $ hg manifest --debug | grep foo
49 49 c6fc755d7e68f49f880599da29f15add41f42f5a 644 foo
50 50
51 51 $ hg debugindex foo
52 52 rev offset length base linkrev nodeid p1 p2
53 53 0 0 5 0 0 2ed2a3912a0b 000000000000 000000000000
54 54 1 5 9 1 1 6f4310b00b9a 2ed2a3912a0b 000000000000
55 55 2 14 5 2 2 c6fc755d7e68 6f4310b00b9a 000000000000
56 56
@@ -1,101 +1,101 b''
1 1 http://mercurial.selenic.com/bts/issue672
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 28 searching for copies back to rev 1
29 29 unmatched files in other:
30 30 1a
31 31 all copies found (* = to merge, ! = divergent):
32 32 1a -> 1
33 33 checking for directory renames
34 34 resolving manifests
35 overwrite None partial False
36 ancestor 81f4b099af3d local c64f439569a9+ remote c12dcd37c90a
35 overwrite: False, partial: False
36 ancestor: 81f4b099af3d, local: c64f439569a9+, remote: c12dcd37c90a
37 37 1: other deleted -> r
38 38 1a: remote created -> g
39 39 updating: 1 1/2 files (50.00%)
40 40 removing 1
41 41 updating: 1a 2/2 files (100.00%)
42 42 getting 1a
43 43 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
44 44 (branch merge, don't forget to commit)
45 45
46 46 $ hg ci -m merge1 # 3
47 47
48 48 $ hg co -C 2
49 49 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
50 50
51 51 $ echo hello >> 1
52 52 $ hg ci -m unrelated2 # 4
53 53 created new head
54 54
55 55 $ hg co -C 3
56 56 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
57 57
58 58 $ hg merge -y --debug 4
59 59 searching for copies back to rev 1
60 60 unmatched files in local:
61 61 1a
62 62 all copies found (* = to merge, ! = divergent):
63 63 1a -> 1 *
64 64 checking for directory renames
65 65 resolving manifests
66 overwrite None partial False
67 ancestor c64f439569a9 local e327dca35ac8+ remote 746e9549ea96
66 overwrite: False, partial: False
67 ancestor: c64f439569a9, local: e327dca35ac8+, remote: 746e9549ea96
68 68 1a: local copied/moved to 1 -> m
69 69 preserving 1a for resolve of 1a
70 70 updating: 1a 1/1 files (100.00%)
71 71 picked tool 'internal:merge' for 1a (binary False symlink False)
72 72 merging 1a and 1 to 1a
73 73 my 1a@e327dca35ac8+ other 1@746e9549ea96 ancestor 1@81f4b099af3d
74 74 premerge successful
75 75 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
76 76 (branch merge, don't forget to commit)
77 77
78 78 $ hg co -C 4
79 79 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
80 80
81 81 $ hg merge -y --debug 3
82 82 searching for copies back to rev 1
83 83 unmatched files in other:
84 84 1a
85 85 all copies found (* = to merge, ! = divergent):
86 86 1a -> 1 *
87 87 checking for directory renames
88 88 resolving manifests
89 overwrite None partial False
90 ancestor c64f439569a9 local 746e9549ea96+ remote e327dca35ac8
89 overwrite: False, partial: False
90 ancestor: c64f439569a9, local: 746e9549ea96+, remote: e327dca35ac8
91 91 1: remote moved to 1a -> m
92 92 preserving 1 for resolve of 1a
93 93 removing 1
94 94 updating: 1 1/1 files (100.00%)
95 95 picked tool 'internal:merge' for 1a (binary False symlink False)
96 96 merging 1 and 1a to 1a
97 97 my 1a@746e9549ea96+ other 1a@e327dca35ac8 ancestor 1@81f4b099af3d
98 98 premerge successful
99 99 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
100 100 (branch merge, don't forget to commit)
101 101
@@ -1,183 +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 offset length base linkrev nodeid p1 p2
39 39 0 0 77 0 2 d35118874825 000000000000 000000000000
40 40 1 77 76 0 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 offset length base linkrev nodeid p1 p2
47 47 0 0 7 0 0 690b295714ae 000000000000 000000000000
48 48 1 7 13 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 70 searching for copies back to rev 1
71 71 resolving manifests
72 overwrite None partial False
73 ancestor 0f2ff26688b9 local 2263c1be0967+ remote 0555950ead28
72 overwrite: False, partial: False
73 ancestor: 0f2ff26688b9, local: 2263c1be0967+, remote: 0555950ead28
74 74 bar: versions differ -> m
75 75 preserving bar for resolve of bar
76 76 updating: bar 1/1 files (100.00%)
77 77 picked tool 'internal:merge' for bar (binary False symlink False)
78 78 merging bar
79 79 my bar@2263c1be0967+ other bar@0555950ead28 ancestor bar@0f2ff26688b9
80 80 premerge successful
81 81 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
82 82 (branch merge, don't forget to commit)
83 83
84 84 $ cat bar
85 85 line1
86 86 line2
87 87
88 88 $ hg ci -m '5: merge'
89 89
90 90 $ hg debugindex bar
91 91 rev offset length base linkrev nodeid p1 p2
92 92 0 0 77 0 2 d35118874825 000000000000 000000000000
93 93 1 77 76 0 3 5345f5ab8abd 000000000000 d35118874825
94 94 2 153 7 2 4 ff4b45017382 d35118874825 000000000000
95 95 3 160 13 3 5 3701b4893544 ff4b45017382 5345f5ab8abd
96 96
97 97
98 98 Same thing, but with the merge on 3 having the rename
99 99 on the remote parent:
100 100
101 101 $ cd ..
102 102 $ hg clone -U -r 1 -r 2 a b
103 103 adding changesets
104 104 adding manifests
105 105 adding file changes
106 106 added 3 changesets with 3 changes to 2 files (+1 heads)
107 107 $ cd b
108 108
109 109 $ hg up -C 1
110 110 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
111 111
112 112 $ hg merge 2
113 113 merging foo and bar to bar
114 114 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
115 115 (branch merge, don't forget to commit)
116 116
117 117 $ cat bar
118 118 line0
119 119 line1
120 120 line2
121 121
122 122 $ hg ci -m '3: merge with remote rename'
123 123
124 124 $ hg debugindex bar
125 125 rev offset length base linkrev nodeid p1 p2
126 126 0 0 77 0 2 d35118874825 000000000000 000000000000
127 127 1 77 76 0 3 5345f5ab8abd 000000000000 d35118874825
128 128
129 129 $ hg debugrename bar
130 130 bar renamed from foo:9e25c27b87571a1edee5ae4dddee5687746cc8e2
131 131
132 132 $ hg debugindex foo
133 133 rev offset length base linkrev nodeid p1 p2
134 134 0 0 7 0 0 690b295714ae 000000000000 000000000000
135 135 1 7 13 1 1 9e25c27b8757 690b295714ae 000000000000
136 136
137 137
138 138 Revert the content change from rev 2:
139 139
140 140 $ hg up -C 2
141 141 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
142 142 $ rm bar
143 143 $ echo line1 > bar
144 144 $ hg ci -m '4: revert content change from rev 2'
145 145 created new head
146 146
147 147 $ hg log --template '{rev}:{node|short} {parents}\n'
148 148 4:2263c1be0967 2:0f2ff26688b9
149 149 3:3ffa6b9e35f0 1:5cd961e4045d 2:0f2ff26688b9
150 150 2:0f2ff26688b9 0:2665aaee66e9
151 151 1:5cd961e4045d
152 152 0:2665aaee66e9
153 153
154 154 This should use bar@rev2 as the ancestor:
155 155
156 156 $ hg --debug merge 3
157 157 searching for copies back to rev 1
158 158 resolving manifests
159 overwrite None partial False
160 ancestor 0f2ff26688b9 local 2263c1be0967+ remote 3ffa6b9e35f0
159 overwrite: False, partial: False
160 ancestor: 0f2ff26688b9, local: 2263c1be0967+, remote: 3ffa6b9e35f0
161 161 bar: versions differ -> m
162 162 preserving bar for resolve of bar
163 163 updating: bar 1/1 files (100.00%)
164 164 picked tool 'internal:merge' for bar (binary False symlink False)
165 165 merging bar
166 166 my bar@2263c1be0967+ other bar@3ffa6b9e35f0 ancestor bar@0f2ff26688b9
167 167 premerge successful
168 168 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
169 169 (branch merge, don't forget to commit)
170 170
171 171 $ cat bar
172 172 line1
173 173 line2
174 174
175 175 $ hg ci -m '5: merge'
176 176
177 177 $ hg debugindex bar
178 178 rev offset length base linkrev nodeid p1 p2
179 179 0 0 77 0 2 d35118874825 000000000000 000000000000
180 180 1 77 76 0 3 5345f5ab8abd 000000000000 d35118874825
181 181 2 153 7 2 4 ff4b45017382 d35118874825 000000000000
182 182 3 160 13 3 5 3701b4893544 ff4b45017382 5345f5ab8abd
183 183
@@ -1,72 +1,72 b''
1 1 $ "$TESTDIR/hghave" symlink execbit || exit 80
2 2
3 3 $ hg init
4 4
5 5 $ echo a > a
6 6 $ hg ci -Amadd
7 7 adding a
8 8
9 9 $ chmod +x a
10 10 $ hg ci -mexecutable
11 11
12 12 $ hg up 0
13 13 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
14 14 $ rm a
15 15 $ ln -s symlink a
16 16 $ hg ci -msymlink
17 17 created new head
18 18
19 19 $ hg merge --debug
20 20 searching for copies back to rev 1
21 21 resolving manifests
22 overwrite None partial False
23 ancestor c334dc3be0da local 521a1e40188f+ remote 3574f3e69b1c
22 overwrite: False, partial: False
23 ancestor: c334dc3be0da, local: 521a1e40188f+, remote: 3574f3e69b1c
24 24 conflicting flags for a
25 25 (n)one, e(x)ec or sym(l)ink? n
26 26 a: update permissions -> e
27 27 updating: a 1/1 files (100.00%)
28 28 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
29 29 (branch merge, don't forget to commit)
30 30
31 31
32 32 Symlink is local parent, executable is other:
33 33
34 34 $ if [ -h a ]; then
35 35 > echo a is a symlink
36 36 > $TESTDIR/readlink.py a
37 37 > elif [ -x a ]; then
38 38 > echo a is executable
39 39 > else
40 40 > echo "a has no flags (default for conflicts)"
41 41 > fi
42 42 a has no flags (default for conflicts)
43 43
44 44 $ hg update -C 1
45 45 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
46 46
47 47 $ hg merge --debug
48 48 searching for copies back to rev 1
49 49 resolving manifests
50 overwrite None partial False
51 ancestor c334dc3be0da local 3574f3e69b1c+ remote 521a1e40188f
50 overwrite: False, partial: False
51 ancestor: c334dc3be0da, local: 3574f3e69b1c+, remote: 521a1e40188f
52 52 conflicting flags for a
53 53 (n)one, e(x)ec or sym(l)ink? n
54 54 a: remote is newer -> g
55 55 updating: a 1/1 files (100.00%)
56 56 getting a
57 57 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
58 58 (branch merge, don't forget to commit)
59 59
60 60
61 61 Symlink is other parent, executable is local:
62 62
63 63 $ if [ -h a ]; then
64 64 > echo a is a symlink
65 65 > $TESTDIR/readlink.py a
66 66 > elif [ -x a ]; then
67 67 > echo a is executable
68 68 > else
69 69 > echo "a has no flags (default for conflicts)"
70 70 > fi
71 71 a has no flags (default for conflicts)
72 72
@@ -1,145 +1,145 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 (run 'hg heads' to see heads, 'hg merge' to merge)
45 45 $ hg merge
46 46 merging test.txt
47 47 warning: conflicts during merge.
48 48 merging test.txt incomplete! (edit conflicts, 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 update -C .' 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 $ hg commit -m "Merge 1"
61 61
62 62 change test-a again
63 63 $ cd ../test-a
64 64 $ cat >test.txt <<"EOF"
65 65 > one
66 66 > two-point-one
67 67 > three
68 68 > EOF
69 69 $ hg commit -m "two -> two-point-one"
70 70
71 71 pull and merge from test-a again
72 72 $ cd ../test-b
73 73 $ hg pull ../test-a
74 74 pulling from ../test-a
75 75 searching for changes
76 76 adding changesets
77 77 adding manifests
78 78 adding file changes
79 79 added 1 changesets with 1 changes to 1 files (+1 heads)
80 80 (run 'hg heads' to see heads, 'hg merge' to merge)
81 81 $ hg merge --debug
82 82 searching for copies back to rev 1
83 83 resolving manifests
84 overwrite None partial False
85 ancestor 96b70246a118 local 50c3a7e29886+ remote 40d11a4173a8
84 overwrite: False, partial: False
85 ancestor: 96b70246a118, local: 50c3a7e29886+, remote: 40d11a4173a8
86 86 test.txt: versions differ -> m
87 87 preserving test.txt for resolve of test.txt
88 88 updating: test.txt 1/1 files (100.00%)
89 89 picked tool 'internal:merge' for test.txt (binary False symlink False)
90 90 merging test.txt
91 91 my test.txt@50c3a7e29886+ other test.txt@40d11a4173a8 ancestor test.txt@96b70246a118
92 92 warning: conflicts during merge.
93 93 merging test.txt incomplete! (edit conflicts, then use 'hg resolve --mark')
94 94 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
95 95 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
96 96 [1]
97 97
98 98 $ cat test.txt
99 99 one
100 100 <<<<<<< local
101 101 two-point-five
102 102 =======
103 103 two-point-one
104 104 >>>>>>> other
105 105 three
106 106
107 107 $ hg debugindex test.txt
108 108 rev offset length base linkrev nodeid p1 p2
109 109 0 0 7 0 0 01365c4cca56 000000000000 000000000000
110 110 1 7 9 1 1 7b013192566a 01365c4cca56 000000000000
111 111 2 16 15 2 2 8fe46a3eb557 01365c4cca56 000000000000
112 112 3 31 27 2 3 fc3148072371 7b013192566a 8fe46a3eb557
113 113 4 58 25 4 4 d40249267ae3 8fe46a3eb557 000000000000
114 114
115 115 $ hg log
116 116 changeset: 4:40d11a4173a8
117 117 tag: tip
118 118 parent: 2:96b70246a118
119 119 user: test
120 120 date: Thu Jan 01 00:00:00 1970 +0000
121 121 summary: two -> two-point-one
122 122
123 123 changeset: 3:50c3a7e29886
124 124 parent: 1:d1e159716d41
125 125 parent: 2:96b70246a118
126 126 user: test
127 127 date: Thu Jan 01 00:00:00 1970 +0000
128 128 summary: Merge 1
129 129
130 130 changeset: 2:96b70246a118
131 131 parent: 0:b1832b9d912a
132 132 user: test
133 133 date: Thu Jan 01 00:00:00 1970 +0000
134 134 summary: Numbers as words
135 135
136 136 changeset: 1:d1e159716d41
137 137 user: test
138 138 date: Thu Jan 01 00:00:00 1970 +0000
139 139 summary: 2 -> 2.5
140 140
141 141 changeset: 0:b1832b9d912a
142 142 user: test
143 143 date: Thu Jan 01 00:00:00 1970 +0000
144 144 summary: Initial
145 145
@@ -1,163 +1,163 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 (glob)
15 15 moving a/b to b/b (glob)
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 27 searching for copies back to rev 1
28 28 unmatched files in local:
29 29 a/c
30 30 a/d
31 31 unmatched files in other:
32 32 b/a
33 33 b/b
34 34 all copies found (* = to merge, ! = divergent):
35 35 b/a -> a/a
36 36 b/b -> a/b
37 37 checking for directory renames
38 38 dir a/ -> b/
39 39 file a/c -> b/c
40 40 file a/d -> b/d
41 41 resolving manifests
42 overwrite None partial False
43 ancestor f9b20c0d4c51 local ce36d17b18fb+ remote 397f8b00a740
42 overwrite: False, partial: False
43 ancestor: f9b20c0d4c51, local: ce36d17b18fb+, remote: 397f8b00a740
44 44 a/d: remote renamed directory to b/d -> d
45 45 a/c: remote renamed directory to b/c -> d
46 46 a/b: other deleted -> r
47 47 a/a: other deleted -> r
48 48 b/a: remote created -> g
49 49 b/b: remote created -> g
50 50 updating: a/a 1/6 files (16.67%)
51 51 removing a/a
52 52 updating: a/b 2/6 files (33.33%)
53 53 removing a/b
54 54 updating: a/c 3/6 files (50.00%)
55 55 moving a/c to b/c
56 56 updating: a/d 4/6 files (66.67%)
57 57 moving a/d to b/d
58 58 updating: b/a 5/6 files (83.33%)
59 59 getting b/a
60 60 updating: b/b 6/6 files (100.00%)
61 61 getting b/b
62 62 4 files updated, 0 files merged, 2 files removed, 0 files unresolved
63 63 (branch merge, don't forget to commit)
64 64
65 65 $ echo a/* b/*
66 66 a/* b/a b/b b/c b/d
67 67 $ hg st -C
68 68 M b/a
69 69 M b/b
70 70 A b/c
71 71 a/c
72 72 R a/a
73 73 R a/b
74 74 R a/c
75 75 ? b/d
76 76 $ hg ci -m "3 merge 2+1"
77 77 $ hg debugrename b/c
78 78 b/c renamed from a/c:354ae8da6e890359ef49ade27b68bbc361f3ca88 (glob)
79 79
80 80 $ hg co -C 1
81 81 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
82 82 $ hg merge --debug 2
83 83 searching for copies back to rev 1
84 84 unmatched files in local:
85 85 b/a
86 86 b/b
87 87 b/d
88 88 unmatched files in other:
89 89 a/c
90 90 all copies found (* = to merge, ! = divergent):
91 91 b/a -> a/a
92 92 b/b -> a/b
93 93 checking for directory renames
94 94 dir a/ -> b/
95 95 file a/c -> b/c
96 96 resolving manifests
97 overwrite None partial False
98 ancestor f9b20c0d4c51 local 397f8b00a740+ remote ce36d17b18fb
97 overwrite: False, partial: False
98 ancestor: f9b20c0d4c51, local: 397f8b00a740+, remote: ce36d17b18fb
99 99 None: local renamed directory to b/c -> d
100 100 updating:None 1/1 files (100.00%)
101 101 getting a/c to b/c
102 102 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
103 103 (branch merge, don't forget to commit)
104 104
105 105 $ echo a/* b/*
106 106 a/* b/a b/b b/c b/d
107 107 $ hg st -C
108 108 A b/c
109 109 a/c
110 110 ? b/d
111 111 $ hg ci -m "4 merge 1+2"
112 112 created new head
113 113 $ hg debugrename b/c
114 114 b/c renamed from a/c:354ae8da6e890359ef49ade27b68bbc361f3ca88 (glob)
115 115
116 116
117 117 Second scenario with two repos:
118 118
119 119 $ cd ..
120 120 $ hg init r1
121 121 $ cd r1
122 122 $ mkdir a
123 123 $ echo foo > a/f
124 124 $ hg add a
125 125 adding a/f (glob)
126 126 $ hg ci -m "a/f == foo"
127 127 $ cd ..
128 128
129 129 $ hg clone r1 r2
130 130 updating to branch default
131 131 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
132 132 $ cd r2
133 133 $ hg mv a b
134 134 moving a/f to b/f (glob)
135 135 $ echo foo1 > b/f
136 136 $ hg ci -m" a -> b, b/f == foo1"
137 137 $ cd ..
138 138
139 139 $ cd r1
140 140 $ mkdir a/aa
141 141 $ echo bar > a/aa/g
142 142 $ hg add a/aa
143 143 adding a/aa/g (glob)
144 144 $ hg ci -m "a/aa/g"
145 145 $ hg pull ../r2
146 146 pulling from ../r2
147 147 searching for changes
148 148 adding changesets
149 149 adding manifests
150 150 adding file changes
151 151 added 1 changesets with 1 changes to 1 files (+1 heads)
152 152 (run 'hg heads' to see heads, 'hg merge' to merge)
153 153
154 154 $ hg merge
155 155 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
156 156 (branch merge, don't forget to commit)
157 157
158 158 $ hg st -C
159 159 M b/f
160 160 A b/aa/g
161 161 a/aa/g
162 162 R a/aa/g
163 163 R a/f
@@ -1,157 +1,157 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 25 searching for copies back to rev 1
26 26 unmatched files in local:
27 27 c2
28 28 unmatched files in other:
29 29 b
30 30 b2
31 31 all copies found (* = to merge, ! = divergent):
32 32 c2 -> a2 !
33 33 b -> a *
34 34 b2 -> a2 !
35 35 checking for directory renames
36 36 a2: divergent renames -> dr
37 37 resolving manifests
38 overwrite None partial False
39 ancestor af1939970a1c local 044f8520aeeb+ remote 85c198ef2f6c
38 overwrite: False, partial: False
39 ancestor: af1939970a1c, local: 044f8520aeeb+, remote: 85c198ef2f6c
40 40 a: remote moved to b -> m
41 41 b2: remote created -> g
42 42 preserving a for resolve of b
43 43 removing a
44 44 updating: a 1/3 files (33.33%)
45 45 picked tool 'internal:merge' for b (binary False symlink False)
46 46 merging a and b to b
47 47 my b@044f8520aeeb+ other b@85c198ef2f6c ancestor a@af1939970a1c
48 48 premerge successful
49 49 updating: a2 2/3 files (66.67%)
50 50 note: possible conflict - a2 was renamed multiple times to:
51 51 c2
52 52 b2
53 53 updating: b2 3/3 files (100.00%)
54 54 getting b2
55 55 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
56 56 (branch merge, don't forget to commit)
57 57
58 58 $ hg status -AC
59 59 M b
60 60 a
61 61 M b2
62 62 R a
63 63 C c2
64 64
65 65 $ cat b
66 66 blahblah
67 67
68 68 $ hg ci -m "merge"
69 69
70 70 $ hg debugindex b
71 71 rev offset length base linkrev nodeid p1 p2
72 72 0 0 67 0 1 57eacc201a7f 000000000000 000000000000
73 73 1 67 72 1 3 4727ba907962 000000000000 57eacc201a7f
74 74
75 75 $ hg debugrename b
76 76 b renamed from a:dd03b83622e78778b403775d0d074b9ac7387a66
77 77
78 78 This used to trigger a "divergent renames" warning, despite no renames
79 79
80 80 $ hg cp b b3
81 81 $ hg cp b b4
82 82 $ hg ci -A -m 'copy b twice'
83 83 $ hg up eb92d88a9712
84 84 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
85 85 $ hg up
86 86 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
87 87 $ hg rm b3 b4
88 88 $ hg ci -m 'clean up a bit of our mess'
89 89
90 90 We'd rather not warn on divergent renames done in the same changeset (issue2113)
91 91
92 92 $ hg cp b b3
93 93 $ hg mv b b4
94 94 $ hg ci -A -m 'divergent renames in same changeset'
95 95 $ hg up c761c6948de0
96 96 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
97 97 $ hg up
98 98 note: possible conflict - b was renamed multiple times to:
99 99 b3
100 100 b4
101 101 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
102 102
103 103 Check for issue2642
104 104
105 105 $ hg init t
106 106 $ cd t
107 107
108 108 $ echo c0 > f1
109 109 $ hg ci -Aqm0
110 110
111 111 $ hg up null -q
112 112 $ echo c1 > f1 # backport
113 113 $ hg ci -Aqm1
114 114 $ hg mv f1 f2
115 115 $ hg ci -qm2
116 116
117 117 $ hg up 0 -q
118 118 $ hg merge 1 -q --tool internal:local
119 119 $ hg ci -qm3
120 120
121 121 $ hg merge 2
122 122 merging f1 and f2 to f2
123 123 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
124 124 (branch merge, don't forget to commit)
125 125
126 126 $ cat f2
127 127 c0
128 128
129 129 Check for issue2089
130 130
131 131 $ hg init repo2089
132 132 $ cd repo2089
133 133
134 134 $ echo c0 > f1
135 135 $ hg ci -Aqm0
136 136
137 137 $ hg up null -q
138 138 $ echo c1 > f1
139 139 $ hg ci -Aqm1
140 140
141 141 $ hg up 0 -q
142 142 $ hg merge 1 -q --tool internal:local
143 143 $ echo c2 > f1
144 144 $ hg ci -qm2
145 145
146 146 $ hg up 1 -q
147 147 $ hg mv f1 f2
148 148 $ hg ci -Aqm3
149 149
150 150 $ hg up 2 -q
151 151 $ hg merge 3
152 152 merging f1 and f2 to f2
153 153 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
154 154 (branch merge, don't forget to commit)
155 155
156 156 $ cat f2
157 157 c2
@@ -1,752 +1,752 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], "wb")
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 $ uc() { up $1; hg cp $1 $2; } # update + copy
72 72 $ um() { up $1; hg mv $1 $2; }
73 73 $ nc() { hg cp $1 $2; } # just copy
74 74 $ nm() { hg mv $1 $2; } # just move
75 75 $ tm "up a " "nc a b" " " "1 get local a to b"
76 76 created new head
77 77 --------------
78 78 test L:up a R:nc a b W: - 1 get local a to b
79 79 --------------
80 80 searching for copies back to rev 1
81 81 unmatched files in other:
82 82 b
83 83 all copies found (* = to merge, ! = divergent):
84 84 b -> a *
85 85 checking for directory renames
86 86 resolving manifests
87 overwrite None partial False
88 ancestor 924404dff337 local e300d1c794ec+ remote 4ce40f5aca24
87 overwrite: False, partial: False
88 ancestor: 924404dff337, local: e300d1c794ec+, remote: 4ce40f5aca24
89 89 rev: versions differ -> m
90 90 a: remote copied to b -> m
91 91 preserving a for resolve of b
92 92 preserving rev for resolve of rev
93 93 updating: a 1/2 files (50.00%)
94 94 picked tool 'python ../merge' for b (binary False symlink False)
95 95 merging a and b to b
96 96 my b@e300d1c794ec+ other b@4ce40f5aca24 ancestor a@924404dff337
97 97 premerge successful
98 98 updating: rev 2/2 files (100.00%)
99 99 picked tool 'python ../merge' for rev (binary False symlink False)
100 100 merging rev
101 101 my rev@e300d1c794ec+ other rev@4ce40f5aca24 ancestor rev@924404dff337
102 102 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
103 103 (branch merge, don't forget to commit)
104 104 --------------
105 105 M b
106 106 a
107 107 C a
108 108 --------------
109 109
110 110 $ tm "nc a b" "up a " " " "2 get rem change to a and b"
111 111 created new head
112 112 --------------
113 113 test L:nc a b R:up a W: - 2 get rem change to a and b
114 114 --------------
115 115 searching for copies back to rev 1
116 116 unmatched files in local:
117 117 b
118 118 all copies found (* = to merge, ! = divergent):
119 119 b -> a *
120 120 checking for directory renames
121 121 resolving manifests
122 overwrite None partial False
123 ancestor 924404dff337 local 86a2aa42fc76+ remote f4db7e329e71
122 overwrite: False, partial: False
123 ancestor: 924404dff337, local: 86a2aa42fc76+, remote: f4db7e329e71
124 124 a: remote is newer -> g
125 125 b: local copied/moved to a -> m
126 126 rev: versions differ -> m
127 127 preserving b for resolve of b
128 128 preserving rev for resolve of rev
129 129 updating: a 1/3 files (33.33%)
130 130 getting a
131 131 updating: b 2/3 files (66.67%)
132 132 picked tool 'python ../merge' for b (binary False symlink False)
133 133 merging b and a to b
134 134 my b@86a2aa42fc76+ other a@f4db7e329e71 ancestor a@924404dff337
135 135 premerge successful
136 136 updating: rev 3/3 files (100.00%)
137 137 picked tool 'python ../merge' for rev (binary False symlink False)
138 138 merging rev
139 139 my rev@86a2aa42fc76+ other rev@f4db7e329e71 ancestor rev@924404dff337
140 140 1 files updated, 2 files merged, 0 files removed, 0 files unresolved
141 141 (branch merge, don't forget to commit)
142 142 --------------
143 143 M a
144 144 M b
145 145 a
146 146 --------------
147 147
148 148 $ tm "up a " "nm a b" " " "3 get local a change to b, remove a"
149 149 created new head
150 150 --------------
151 151 test L:up a R:nm a b W: - 3 get local a change to b, remove a
152 152 --------------
153 153 searching for copies back to rev 1
154 154 unmatched files in other:
155 155 b
156 156 all copies found (* = to merge, ! = divergent):
157 157 b -> a *
158 158 checking for directory renames
159 159 resolving manifests
160 overwrite None partial False
161 ancestor 924404dff337 local e300d1c794ec+ remote bdb19105162a
160 overwrite: False, partial: False
161 ancestor: 924404dff337, local: e300d1c794ec+, remote: bdb19105162a
162 162 rev: versions differ -> m
163 163 a: remote moved to b -> m
164 164 preserving a for resolve of b
165 165 preserving rev for resolve of rev
166 166 removing a
167 167 updating: a 1/2 files (50.00%)
168 168 picked tool 'python ../merge' for b (binary False symlink False)
169 169 merging a and b to b
170 170 my b@e300d1c794ec+ other b@bdb19105162a ancestor a@924404dff337
171 171 premerge successful
172 172 updating: rev 2/2 files (100.00%)
173 173 picked tool 'python ../merge' for rev (binary False symlink False)
174 174 merging rev
175 175 my rev@e300d1c794ec+ other rev@bdb19105162a ancestor rev@924404dff337
176 176 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
177 177 (branch merge, don't forget to commit)
178 178 --------------
179 179 M b
180 180 a
181 181 --------------
182 182
183 183 $ tm "nm a b" "up a " " " "4 get remote change to b"
184 184 created new head
185 185 --------------
186 186 test L:nm a b R:up a W: - 4 get remote change to b
187 187 --------------
188 188 searching for copies back to rev 1
189 189 unmatched files in local:
190 190 b
191 191 all copies found (* = to merge, ! = divergent):
192 192 b -> a *
193 193 checking for directory renames
194 194 resolving manifests
195 overwrite None partial False
196 ancestor 924404dff337 local 02963e448370+ remote f4db7e329e71
195 overwrite: False, partial: False
196 ancestor: 924404dff337, local: 02963e448370+, remote: f4db7e329e71
197 197 b: local copied/moved to a -> m
198 198 rev: versions differ -> m
199 199 preserving b for resolve of b
200 200 preserving rev for resolve of rev
201 201 updating: b 1/2 files (50.00%)
202 202 picked tool 'python ../merge' for b (binary False symlink False)
203 203 merging b and a to b
204 204 my b@02963e448370+ other a@f4db7e329e71 ancestor a@924404dff337
205 205 premerge successful
206 206 updating: rev 2/2 files (100.00%)
207 207 picked tool 'python ../merge' for rev (binary False symlink False)
208 208 merging rev
209 209 my rev@02963e448370+ other rev@f4db7e329e71 ancestor rev@924404dff337
210 210 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
211 211 (branch merge, don't forget to commit)
212 212 --------------
213 213 M b
214 214 a
215 215 --------------
216 216
217 217 $ tm " " "nc a b" " " "5 get b"
218 218 created new head
219 219 --------------
220 220 test L: R:nc a b W: - 5 get b
221 221 --------------
222 222 searching for copies back to rev 1
223 223 unmatched files in other:
224 224 b
225 225 all copies found (* = to merge, ! = divergent):
226 226 b -> a
227 227 checking for directory renames
228 228 resolving manifests
229 overwrite None partial False
230 ancestor 924404dff337 local 94b33a1b7f2d+ remote 4ce40f5aca24
229 overwrite: False, partial: False
230 ancestor: 924404dff337, local: 94b33a1b7f2d+, remote: 4ce40f5aca24
231 231 rev: versions differ -> m
232 232 b: remote created -> g
233 233 preserving rev for resolve of rev
234 234 updating: b 1/2 files (50.00%)
235 235 getting b
236 236 updating: rev 2/2 files (100.00%)
237 237 picked tool 'python ../merge' for rev (binary False symlink False)
238 238 merging rev
239 239 my rev@94b33a1b7f2d+ other rev@4ce40f5aca24 ancestor rev@924404dff337
240 240 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
241 241 (branch merge, don't forget to commit)
242 242 --------------
243 243 M b
244 244 C a
245 245 --------------
246 246
247 247 $ tm "nc a b" " " " " "6 nothing"
248 248 created new head
249 249 --------------
250 250 test L:nc a b R: W: - 6 nothing
251 251 --------------
252 252 searching for copies back to rev 1
253 253 unmatched files in local:
254 254 b
255 255 all copies found (* = to merge, ! = divergent):
256 256 b -> a
257 257 checking for directory renames
258 258 resolving manifests
259 overwrite None partial False
260 ancestor 924404dff337 local 86a2aa42fc76+ remote 97c705ade336
259 overwrite: False, partial: False
260 ancestor: 924404dff337, local: 86a2aa42fc76+, remote: 97c705ade336
261 261 rev: versions differ -> m
262 262 preserving rev for resolve of rev
263 263 updating: rev 1/1 files (100.00%)
264 264 picked tool 'python ../merge' for rev (binary False symlink False)
265 265 merging rev
266 266 my rev@86a2aa42fc76+ other rev@97c705ade336 ancestor rev@924404dff337
267 267 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
268 268 (branch merge, don't forget to commit)
269 269 --------------
270 270 C a
271 271 C b
272 272 --------------
273 273
274 274 $ tm " " "nm a b" " " "7 get b"
275 275 created new head
276 276 --------------
277 277 test L: R:nm a b W: - 7 get b
278 278 --------------
279 279 searching for copies back to rev 1
280 280 unmatched files in other:
281 281 b
282 282 all copies found (* = to merge, ! = divergent):
283 283 b -> a
284 284 checking for directory renames
285 285 resolving manifests
286 overwrite None partial False
287 ancestor 924404dff337 local 94b33a1b7f2d+ remote bdb19105162a
286 overwrite: False, partial: False
287 ancestor: 924404dff337, local: 94b33a1b7f2d+, remote: bdb19105162a
288 288 a: other deleted -> r
289 289 rev: versions differ -> m
290 290 b: remote created -> g
291 291 preserving rev for resolve of rev
292 292 updating: a 1/3 files (33.33%)
293 293 removing a
294 294 updating: b 2/3 files (66.67%)
295 295 getting b
296 296 updating: rev 3/3 files (100.00%)
297 297 picked tool 'python ../merge' for rev (binary False symlink False)
298 298 merging rev
299 299 my rev@94b33a1b7f2d+ other rev@bdb19105162a ancestor rev@924404dff337
300 300 1 files updated, 1 files merged, 1 files removed, 0 files unresolved
301 301 (branch merge, don't forget to commit)
302 302 --------------
303 303 M b
304 304 --------------
305 305
306 306 $ tm "nm a b" " " " " "8 nothing"
307 307 created new head
308 308 --------------
309 309 test L:nm a b R: W: - 8 nothing
310 310 --------------
311 311 searching for copies back to rev 1
312 312 unmatched files in local:
313 313 b
314 314 all copies found (* = to merge, ! = divergent):
315 315 b -> a
316 316 checking for directory renames
317 317 resolving manifests
318 overwrite None partial False
319 ancestor 924404dff337 local 02963e448370+ remote 97c705ade336
318 overwrite: False, partial: False
319 ancestor: 924404dff337, local: 02963e448370+, remote: 97c705ade336
320 320 rev: versions differ -> m
321 321 preserving rev for resolve of rev
322 322 updating: rev 1/1 files (100.00%)
323 323 picked tool 'python ../merge' for rev (binary False symlink False)
324 324 merging rev
325 325 my rev@02963e448370+ other rev@97c705ade336 ancestor rev@924404dff337
326 326 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
327 327 (branch merge, don't forget to commit)
328 328 --------------
329 329 C b
330 330 --------------
331 331
332 332 $ tm "um a b" "um a b" " " "9 do merge with ancestor in a"
333 333 created new head
334 334 --------------
335 335 test L:um a b R:um a b W: - 9 do merge with ancestor in a
336 336 --------------
337 337 searching for copies back to rev 1
338 338 resolving manifests
339 overwrite None partial False
340 ancestor 924404dff337 local 62e7bf090eba+ remote 49b6d8032493
339 overwrite: False, partial: False
340 ancestor: 924404dff337, local: 62e7bf090eba+, remote: 49b6d8032493
341 341 b: versions differ -> m
342 342 rev: versions differ -> m
343 343 preserving b for resolve of b
344 344 preserving rev for resolve of rev
345 345 updating: b 1/2 files (50.00%)
346 346 picked tool 'python ../merge' for b (binary False symlink False)
347 347 merging b
348 348 my b@62e7bf090eba+ other b@49b6d8032493 ancestor a@924404dff337
349 349 updating: rev 2/2 files (100.00%)
350 350 picked tool 'python ../merge' for rev (binary False symlink False)
351 351 merging rev
352 352 my rev@62e7bf090eba+ other rev@49b6d8032493 ancestor rev@924404dff337
353 353 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
354 354 (branch merge, don't forget to commit)
355 355 --------------
356 356 M b
357 357 --------------
358 358
359 359
360 360 m "um a c" "um x c" " " "10 do merge with no ancestor"
361 361
362 362 $ tm "nm a b" "nm a c" " " "11 get c, keep b"
363 363 created new head
364 364 --------------
365 365 test L:nm a b R:nm a c W: - 11 get c, keep b
366 366 --------------
367 367 searching for copies back to rev 1
368 368 unmatched files in local:
369 369 b
370 370 unmatched files in other:
371 371 c
372 372 all copies found (* = to merge, ! = divergent):
373 373 c -> a !
374 374 b -> a !
375 375 checking for directory renames
376 376 a: divergent renames -> dr
377 377 resolving manifests
378 overwrite None partial False
379 ancestor 924404dff337 local 02963e448370+ remote fe905ef2c33e
378 overwrite: False, partial: False
379 ancestor: 924404dff337, local: 02963e448370+, remote: fe905ef2c33e
380 380 rev: versions differ -> m
381 381 c: remote created -> g
382 382 preserving rev for resolve of rev
383 383 updating: a 1/3 files (33.33%)
384 384 note: possible conflict - a was renamed multiple times to:
385 385 b
386 386 c
387 387 updating: c 2/3 files (66.67%)
388 388 getting c
389 389 updating: rev 3/3 files (100.00%)
390 390 picked tool 'python ../merge' for rev (binary False symlink False)
391 391 merging rev
392 392 my rev@02963e448370+ other rev@fe905ef2c33e ancestor rev@924404dff337
393 393 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
394 394 (branch merge, don't forget to commit)
395 395 --------------
396 396 M c
397 397 C b
398 398 --------------
399 399
400 400 $ tm "nc a b" "up b " " " "12 merge b no ancestor"
401 401 created new head
402 402 --------------
403 403 test L:nc a b R:up b W: - 12 merge b no ancestor
404 404 --------------
405 405 searching for copies back to rev 1
406 406 resolving manifests
407 overwrite None partial False
408 ancestor 924404dff337 local 86a2aa42fc76+ remote af30c7647fc7
407 overwrite: False, partial: False
408 ancestor: 924404dff337, local: 86a2aa42fc76+, remote: af30c7647fc7
409 409 b: versions differ -> m
410 410 rev: versions differ -> m
411 411 preserving b for resolve of b
412 412 preserving rev for resolve of rev
413 413 updating: b 1/2 files (50.00%)
414 414 picked tool 'python ../merge' for b (binary False symlink False)
415 415 merging b
416 416 my b@86a2aa42fc76+ other b@af30c7647fc7 ancestor b@000000000000
417 417 updating: rev 2/2 files (100.00%)
418 418 picked tool 'python ../merge' for rev (binary False symlink False)
419 419 merging rev
420 420 my rev@86a2aa42fc76+ other rev@af30c7647fc7 ancestor rev@924404dff337
421 421 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
422 422 (branch merge, don't forget to commit)
423 423 --------------
424 424 M b
425 425 C a
426 426 --------------
427 427
428 428 $ tm "up b " "nm a b" " " "13 merge b no ancestor"
429 429 created new head
430 430 --------------
431 431 test L:up b R:nm a b W: - 13 merge b no ancestor
432 432 --------------
433 433 searching for copies back to rev 1
434 434 resolving manifests
435 overwrite None partial False
436 ancestor 924404dff337 local 59318016310c+ remote bdb19105162a
435 overwrite: False, partial: False
436 ancestor: 924404dff337, local: 59318016310c+, remote: bdb19105162a
437 437 a: other deleted -> r
438 438 b: versions differ -> m
439 439 rev: versions differ -> m
440 440 preserving b for resolve of b
441 441 preserving rev for resolve of rev
442 442 updating: a 1/3 files (33.33%)
443 443 removing a
444 444 updating: b 2/3 files (66.67%)
445 445 picked tool 'python ../merge' for b (binary False symlink False)
446 446 merging b
447 447 my b@59318016310c+ other b@bdb19105162a ancestor b@000000000000
448 448 updating: rev 3/3 files (100.00%)
449 449 picked tool 'python ../merge' for rev (binary False symlink False)
450 450 merging rev
451 451 my rev@59318016310c+ other rev@bdb19105162a ancestor rev@924404dff337
452 452 0 files updated, 2 files merged, 1 files removed, 0 files unresolved
453 453 (branch merge, don't forget to commit)
454 454 --------------
455 455 M b
456 456 --------------
457 457
458 458 $ tm "nc a b" "up a b" " " "14 merge b no ancestor"
459 459 created new head
460 460 --------------
461 461 test L:nc a b R:up a b W: - 14 merge b no ancestor
462 462 --------------
463 463 searching for copies back to rev 1
464 464 resolving manifests
465 overwrite None partial False
466 ancestor 924404dff337 local 86a2aa42fc76+ remote 8dbce441892a
465 overwrite: False, partial: False
466 ancestor: 924404dff337, local: 86a2aa42fc76+, remote: 8dbce441892a
467 467 a: remote is newer -> g
468 468 b: versions differ -> m
469 469 rev: versions differ -> m
470 470 preserving b for resolve of b
471 471 preserving rev for resolve of rev
472 472 updating: a 1/3 files (33.33%)
473 473 getting a
474 474 updating: b 2/3 files (66.67%)
475 475 picked tool 'python ../merge' for b (binary False symlink False)
476 476 merging b
477 477 my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000
478 478 updating: rev 3/3 files (100.00%)
479 479 picked tool 'python ../merge' for rev (binary False symlink False)
480 480 merging rev
481 481 my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337
482 482 1 files updated, 2 files merged, 0 files removed, 0 files unresolved
483 483 (branch merge, don't forget to commit)
484 484 --------------
485 485 M a
486 486 M b
487 487 --------------
488 488
489 489 $ tm "up b " "nm a b" " " "15 merge b no ancestor, remove a"
490 490 created new head
491 491 --------------
492 492 test L:up b R:nm a b W: - 15 merge b no ancestor, remove a
493 493 --------------
494 494 searching for copies back to rev 1
495 495 resolving manifests
496 overwrite None partial False
497 ancestor 924404dff337 local 59318016310c+ remote bdb19105162a
496 overwrite: False, partial: False
497 ancestor: 924404dff337, local: 59318016310c+, remote: bdb19105162a
498 498 a: other deleted -> r
499 499 b: versions differ -> m
500 500 rev: versions differ -> m
501 501 preserving b for resolve of b
502 502 preserving rev for resolve of rev
503 503 updating: a 1/3 files (33.33%)
504 504 removing a
505 505 updating: b 2/3 files (66.67%)
506 506 picked tool 'python ../merge' for b (binary False symlink False)
507 507 merging b
508 508 my b@59318016310c+ other b@bdb19105162a ancestor b@000000000000
509 509 updating: rev 3/3 files (100.00%)
510 510 picked tool 'python ../merge' for rev (binary False symlink False)
511 511 merging rev
512 512 my rev@59318016310c+ other rev@bdb19105162a ancestor rev@924404dff337
513 513 0 files updated, 2 files merged, 1 files removed, 0 files unresolved
514 514 (branch merge, don't forget to commit)
515 515 --------------
516 516 M b
517 517 --------------
518 518
519 519 $ tm "nc a b" "up a b" " " "16 get a, merge b no ancestor"
520 520 created new head
521 521 --------------
522 522 test L:nc a b R:up a b W: - 16 get a, merge b no ancestor
523 523 --------------
524 524 searching for copies back to rev 1
525 525 resolving manifests
526 overwrite None partial False
527 ancestor 924404dff337 local 86a2aa42fc76+ remote 8dbce441892a
526 overwrite: False, partial: False
527 ancestor: 924404dff337, local: 86a2aa42fc76+, remote: 8dbce441892a
528 528 a: remote is newer -> g
529 529 b: versions differ -> m
530 530 rev: versions differ -> m
531 531 preserving b for resolve of b
532 532 preserving rev for resolve of rev
533 533 updating: a 1/3 files (33.33%)
534 534 getting a
535 535 updating: b 2/3 files (66.67%)
536 536 picked tool 'python ../merge' for b (binary False symlink False)
537 537 merging b
538 538 my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000
539 539 updating: rev 3/3 files (100.00%)
540 540 picked tool 'python ../merge' for rev (binary False symlink False)
541 541 merging rev
542 542 my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337
543 543 1 files updated, 2 files merged, 0 files removed, 0 files unresolved
544 544 (branch merge, don't forget to commit)
545 545 --------------
546 546 M a
547 547 M b
548 548 --------------
549 549
550 550 $ tm "up a b" "nc a b" " " "17 keep a, merge b no ancestor"
551 551 created new head
552 552 --------------
553 553 test L:up a b R:nc a b W: - 17 keep a, merge b no ancestor
554 554 --------------
555 555 searching for copies back to rev 1
556 556 resolving manifests
557 overwrite None partial False
558 ancestor 924404dff337 local 0b76e65c8289+ remote 4ce40f5aca24
557 overwrite: False, partial: False
558 ancestor: 924404dff337, local: 0b76e65c8289+, remote: 4ce40f5aca24
559 559 b: versions differ -> m
560 560 rev: versions differ -> m
561 561 preserving b for resolve of b
562 562 preserving rev for resolve of rev
563 563 updating: b 1/2 files (50.00%)
564 564 picked tool 'python ../merge' for b (binary False symlink False)
565 565 merging b
566 566 my b@0b76e65c8289+ other b@4ce40f5aca24 ancestor b@000000000000
567 567 updating: rev 2/2 files (100.00%)
568 568 picked tool 'python ../merge' for rev (binary False symlink False)
569 569 merging rev
570 570 my rev@0b76e65c8289+ other rev@4ce40f5aca24 ancestor rev@924404dff337
571 571 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
572 572 (branch merge, don't forget to commit)
573 573 --------------
574 574 M b
575 575 C a
576 576 --------------
577 577
578 578 $ tm "nm a b" "up a b" " " "18 merge b no ancestor"
579 579 created new head
580 580 --------------
581 581 test L:nm a b R:up a b W: - 18 merge b no ancestor
582 582 --------------
583 583 searching for copies back to rev 1
584 584 resolving manifests
585 overwrite None partial False
586 ancestor 924404dff337 local 02963e448370+ remote 8dbce441892a
585 overwrite: False, partial: False
586 ancestor: 924404dff337, local: 02963e448370+, remote: 8dbce441892a
587 587 b: versions differ -> m
588 588 rev: versions differ -> m
589 589 remote changed a which local deleted
590 590 use (c)hanged version or leave (d)eleted? c
591 591 a: prompt recreating -> g
592 592 preserving b for resolve of b
593 593 preserving rev for resolve of rev
594 594 updating: a 1/3 files (33.33%)
595 595 getting a
596 596 updating: b 2/3 files (66.67%)
597 597 picked tool 'python ../merge' for b (binary False symlink False)
598 598 merging b
599 599 my b@02963e448370+ other b@8dbce441892a ancestor b@000000000000
600 600 updating: rev 3/3 files (100.00%)
601 601 picked tool 'python ../merge' for rev (binary False symlink False)
602 602 merging rev
603 603 my rev@02963e448370+ other rev@8dbce441892a ancestor rev@924404dff337
604 604 1 files updated, 2 files merged, 0 files removed, 0 files unresolved
605 605 (branch merge, don't forget to commit)
606 606 --------------
607 607 M a
608 608 M b
609 609 --------------
610 610
611 611 $ tm "up a b" "nm a b" " " "19 merge b no ancestor, prompt remove a"
612 612 created new head
613 613 --------------
614 614 test L:up a b R:nm a b W: - 19 merge b no ancestor, prompt remove a
615 615 --------------
616 616 searching for copies back to rev 1
617 617 resolving manifests
618 overwrite None partial False
619 ancestor 924404dff337 local 0b76e65c8289+ remote bdb19105162a
618 overwrite: False, partial: False
619 ancestor: 924404dff337, local: 0b76e65c8289+, remote: bdb19105162a
620 620 local changed a which remote deleted
621 621 use (c)hanged version or (d)elete? c
622 622 a: prompt keep -> a
623 623 b: versions differ -> m
624 624 rev: versions differ -> m
625 625 preserving b for resolve of b
626 626 preserving rev for resolve of rev
627 627 updating: a 1/3 files (33.33%)
628 628 updating: b 2/3 files (66.67%)
629 629 picked tool 'python ../merge' for b (binary False symlink False)
630 630 merging b
631 631 my b@0b76e65c8289+ other b@bdb19105162a ancestor b@000000000000
632 632 updating: rev 3/3 files (100.00%)
633 633 picked tool 'python ../merge' for rev (binary False symlink False)
634 634 merging rev
635 635 my rev@0b76e65c8289+ other rev@bdb19105162a ancestor rev@924404dff337
636 636 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
637 637 (branch merge, don't forget to commit)
638 638 --------------
639 639 M b
640 640 C a
641 641 --------------
642 642
643 643 $ tm "up a " "um a b" " " "20 merge a and b to b, remove a"
644 644 created new head
645 645 --------------
646 646 test L:up a R:um a b W: - 20 merge a and b to b, remove a
647 647 --------------
648 648 searching for copies back to rev 1
649 649 unmatched files in other:
650 650 b
651 651 all copies found (* = to merge, ! = divergent):
652 652 b -> a *
653 653 checking for directory renames
654 654 resolving manifests
655 overwrite None partial False
656 ancestor 924404dff337 local e300d1c794ec+ remote 49b6d8032493
655 overwrite: False, partial: False
656 ancestor: 924404dff337, local: e300d1c794ec+, remote: 49b6d8032493
657 657 rev: versions differ -> m
658 658 a: remote moved to b -> m
659 659 preserving a for resolve of b
660 660 preserving rev for resolve of rev
661 661 removing a
662 662 updating: a 1/2 files (50.00%)
663 663 picked tool 'python ../merge' for b (binary False symlink False)
664 664 merging a and b to b
665 665 my b@e300d1c794ec+ other b@49b6d8032493 ancestor a@924404dff337
666 666 updating: rev 2/2 files (100.00%)
667 667 picked tool 'python ../merge' for rev (binary False symlink False)
668 668 merging rev
669 669 my rev@e300d1c794ec+ other rev@49b6d8032493 ancestor rev@924404dff337
670 670 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
671 671 (branch merge, don't forget to commit)
672 672 --------------
673 673 M b
674 674 a
675 675 --------------
676 676
677 677 $ tm "um a b" "up a " " " "21 merge a and b to b"
678 678 created new head
679 679 --------------
680 680 test L:um a b R:up a W: - 21 merge a and b to b
681 681 --------------
682 682 searching for copies back to rev 1
683 683 unmatched files in local:
684 684 b
685 685 all copies found (* = to merge, ! = divergent):
686 686 b -> a *
687 687 checking for directory renames
688 688 resolving manifests
689 overwrite None partial False
690 ancestor 924404dff337 local 62e7bf090eba+ remote f4db7e329e71
689 overwrite: False, partial: False
690 ancestor: 924404dff337, local: 62e7bf090eba+, remote: f4db7e329e71
691 691 b: local copied/moved to a -> m
692 692 rev: versions differ -> m
693 693 preserving b for resolve of b
694 694 preserving rev for resolve of rev
695 695 updating: b 1/2 files (50.00%)
696 696 picked tool 'python ../merge' for b (binary False symlink False)
697 697 merging b and a to b
698 698 my b@62e7bf090eba+ other a@f4db7e329e71 ancestor a@924404dff337
699 699 updating: rev 2/2 files (100.00%)
700 700 picked tool 'python ../merge' for rev (binary False symlink False)
701 701 merging rev
702 702 my rev@62e7bf090eba+ other rev@f4db7e329e71 ancestor rev@924404dff337
703 703 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
704 704 (branch merge, don't forget to commit)
705 705 --------------
706 706 M b
707 707 a
708 708 --------------
709 709
710 710
711 711 m "nm a b" "um x a" " " "22 get a, keep b"
712 712
713 713 $ tm "nm a b" "up a c" " " "23 get c, keep b"
714 714 created new head
715 715 --------------
716 716 test L:nm a b R:up a c W: - 23 get c, keep b
717 717 --------------
718 718 searching for copies back to rev 1
719 719 unmatched files in local:
720 720 b
721 721 unmatched files in other:
722 722 c
723 723 all copies found (* = to merge, ! = divergent):
724 724 b -> a *
725 725 checking for directory renames
726 726 resolving manifests
727 overwrite None partial False
728 ancestor 924404dff337 local 02963e448370+ remote 2b958612230f
727 overwrite: False, partial: False
728 ancestor: 924404dff337, local: 02963e448370+, remote: 2b958612230f
729 729 b: local copied/moved to a -> m
730 730 rev: versions differ -> m
731 731 c: remote created -> g
732 732 preserving b for resolve of b
733 733 preserving rev for resolve of rev
734 734 updating: b 1/3 files (33.33%)
735 735 picked tool 'python ../merge' for b (binary False symlink False)
736 736 merging b and a to b
737 737 my b@02963e448370+ other a@2b958612230f ancestor a@924404dff337
738 738 premerge successful
739 739 updating: c 2/3 files (66.67%)
740 740 getting c
741 741 updating: rev 3/3 files (100.00%)
742 742 picked tool 'python ../merge' for rev (binary False symlink False)
743 743 merging rev
744 744 my rev@02963e448370+ other rev@2b958612230f ancestor rev@924404dff337
745 745 1 files updated, 2 files merged, 0 files removed, 0 files unresolved
746 746 (branch merge, don't forget to commit)
747 747 --------------
748 748 M b
749 749 a
750 750 M c
751 751 --------------
752 752
@@ -1,1019 +1,1019 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 $ rm -rf sub
7 7 $ mkdir sub
8 8 $ cd sub
9 9 $ hg init t
10 10 $ cd t
11 11
12 12 first revision, no sub
13 13
14 14 $ echo a > a
15 15 $ hg ci -Am0
16 16 adding a
17 17
18 18 add first sub
19 19
20 20 $ echo s = s > .hgsub
21 21 $ hg add .hgsub
22 22 $ hg init s
23 23 $ echo a > s/a
24 24
25 25 Issue2232: committing a subrepo without .hgsub
26 26
27 27 $ hg ci -mbad s
28 28 abort: can't commit subrepos without .hgsub
29 29 [255]
30 30
31 31 $ hg -R s ci -Ams0
32 32 adding a
33 33 $ hg sum
34 34 parent: 0:f7b1eb17ad24 tip
35 35 0
36 36 branch: default
37 37 commit: 1 added, 1 subrepos
38 38 update: (current)
39 39 $ hg ci -m1
40 40 committing subrepository s
41 41
42 42 Revert can't (yet) revert subrepos:
43 43
44 44 $ echo b > s/a
45 45 $ hg revert s
46 46 s: reverting subrepos is unsupported
47 47
48 48 Revert currently ignores subrepos by default
49 49
50 50 $ hg revert -a
51 51 $ hg revert -R s -a -C
52 52 reverting s/a (glob)
53 53
54 54 Issue2022: update -C
55 55
56 56 $ echo b > s/a
57 57 $ hg sum
58 58 parent: 1:7cf8cfea66e4 tip
59 59 1
60 60 branch: default
61 61 commit: 1 subrepos
62 62 update: (current)
63 63 $ hg co -C 1
64 64 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
65 65 $ hg sum
66 66 parent: 1:7cf8cfea66e4 tip
67 67 1
68 68 branch: default
69 69 commit: (clean)
70 70 update: (current)
71 71
72 72 commands that require a clean repo should respect subrepos
73 73
74 74 $ echo b >> s/a
75 75 $ hg backout tip
76 76 abort: uncommitted changes in subrepo s
77 77 [255]
78 78 $ hg revert -C -R s s/a
79 79
80 80 add sub sub
81 81
82 82 $ echo ss = ss > s/.hgsub
83 83 $ hg init s/ss
84 84 $ echo a > s/ss/a
85 85 $ hg -R s add s/.hgsub
86 86 $ hg -R s/ss add s/ss/a
87 87 $ hg sum
88 88 parent: 1:7cf8cfea66e4 tip
89 89 1
90 90 branch: default
91 91 commit: 1 subrepos
92 92 update: (current)
93 93 $ hg ci -m2
94 94 committing subrepository s
95 95 committing subrepository s/ss (glob)
96 96 $ hg sum
97 97 parent: 2:df30734270ae tip
98 98 2
99 99 branch: default
100 100 commit: (clean)
101 101 update: (current)
102 102
103 103 bump sub rev (and check it is ignored by ui.commitsubrepos)
104 104
105 105 $ echo b > s/a
106 106 $ hg -R s ci -ms1
107 107 $ hg --config ui.commitsubrepos=no ci -m3
108 108 committing subrepository s
109 109
110 110 leave sub dirty (and check ui.commitsubrepos=no aborts the commit)
111 111
112 112 $ echo c > s/a
113 113 $ hg --config ui.commitsubrepos=no ci -m4
114 114 abort: uncommitted changes in subrepo s
115 115 (use --subrepos for recursive commit)
116 116 [255]
117 117 $ hg ci -m4
118 118 committing subrepository s
119 119 $ hg tip -R s
120 120 changeset: 3:1c833a7a9e3a
121 121 tag: tip
122 122 user: test
123 123 date: Thu Jan 01 00:00:00 1970 +0000
124 124 summary: 4
125 125
126 126
127 127 check caching
128 128
129 129 $ hg co 0
130 130 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
131 131 $ hg debugsub
132 132
133 133 restore
134 134
135 135 $ hg co
136 136 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
137 137 $ hg debugsub
138 138 path s
139 139 source s
140 140 revision 1c833a7a9e3a4445c711aaf0f012379cd0d4034e
141 141
142 142 new branch for merge tests
143 143
144 144 $ hg co 1
145 145 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
146 146 $ echo t = t >> .hgsub
147 147 $ hg init t
148 148 $ echo t > t/t
149 149 $ hg -R t add t
150 150 adding t/t (glob)
151 151
152 152 5
153 153
154 154 $ hg ci -m5 # add sub
155 155 committing subrepository t
156 156 created new head
157 157 $ echo t2 > t/t
158 158
159 159 6
160 160
161 161 $ hg st -R s
162 162 $ hg ci -m6 # change sub
163 163 committing subrepository t
164 164 $ hg debugsub
165 165 path s
166 166 source s
167 167 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
168 168 path t
169 169 source t
170 170 revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad
171 171 $ echo t3 > t/t
172 172
173 173 7
174 174
175 175 $ hg ci -m7 # change sub again for conflict test
176 176 committing subrepository t
177 177 $ hg rm .hgsub
178 178
179 179 8
180 180
181 181 $ hg ci -m8 # remove sub
182 182
183 183 merge tests
184 184
185 185 $ hg co -C 3
186 186 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
187 187 $ hg merge 5 # test adding
188 188 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
189 189 (branch merge, don't forget to commit)
190 190 $ hg debugsub
191 191 path s
192 192 source s
193 193 revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
194 194 path t
195 195 source t
196 196 revision 60ca1237c19474e7a3978b0dc1ca4e6f36d51382
197 197 $ hg ci -m9
198 198 created new head
199 199 $ hg merge 6 --debug # test change
200 200 searching for copies back to rev 2
201 201 resolving manifests
202 overwrite None partial False
203 ancestor 1f14a2e2d3ec local f0d2028bf86d+ remote 1831e14459c4
202 overwrite: False, partial: False
203 ancestor: 1f14a2e2d3ec, local: f0d2028bf86d+, remote: 1831e14459c4
204 204 .hgsubstate: versions differ -> m
205 205 updating: .hgsubstate 1/1 files (100.00%)
206 206 subrepo merge f0d2028bf86d+ 1831e14459c4 1f14a2e2d3ec
207 207 subrepo t: other changed, get t:6747d179aa9a688023c4b0cad32e4c92bb7f34ad:hg
208 208 getting subrepo t
209 209 resolving manifests
210 overwrite True partial False
211 ancestor 60ca1237c194+ local 60ca1237c194+ remote 6747d179aa9a
210 overwrite: True, partial: False
211 ancestor: 60ca1237c194+, local: 60ca1237c194+, remote: 6747d179aa9a
212 212 t: remote is newer -> g
213 213 updating: t 1/1 files (100.00%)
214 214 getting t
215 215 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
216 216 (branch merge, don't forget to commit)
217 217 $ hg debugsub
218 218 path s
219 219 source s
220 220 revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
221 221 path t
222 222 source t
223 223 revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad
224 224 $ echo conflict > t/t
225 225 $ hg ci -m10
226 226 committing subrepository t
227 227 $ HGMERGE=internal:merge hg merge --debug 7 # test conflict
228 228 searching for copies back to rev 2
229 229 resolving manifests
230 overwrite None partial False
231 ancestor 1831e14459c4 local e45c8b14af55+ remote f94576341bcf
230 overwrite: False, partial: False
231 ancestor: 1831e14459c4, local: e45c8b14af55+, remote: f94576341bcf
232 232 .hgsubstate: versions differ -> m
233 233 updating: .hgsubstate 1/1 files (100.00%)
234 234 subrepo merge e45c8b14af55+ f94576341bcf 1831e14459c4
235 235 subrepo t: both sides changed, merge with t:7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4:hg
236 236 merging subrepo t
237 237 searching for copies back to rev 2
238 238 resolving manifests
239 overwrite None partial False
240 ancestor 6747d179aa9a local 20a0db6fbf6c+ remote 7af322bc1198
239 overwrite: False, partial: False
240 ancestor: 6747d179aa9a, local: 20a0db6fbf6c+, remote: 7af322bc1198
241 241 t: versions differ -> m
242 242 preserving t for resolve of t
243 243 updating: t 1/1 files (100.00%)
244 244 picked tool 'internal:merge' for t (binary False symlink False)
245 245 merging t
246 246 my t@20a0db6fbf6c+ other t@7af322bc1198 ancestor t@6747d179aa9a
247 247 warning: conflicts during merge.
248 248 merging t incomplete! (edit conflicts, then use 'hg resolve --mark')
249 249 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
250 250 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
251 251 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
252 252 (branch merge, don't forget to commit)
253 253
254 254 should conflict
255 255
256 256 $ cat t/t
257 257 <<<<<<< local
258 258 conflict
259 259 =======
260 260 t3
261 261 >>>>>>> other
262 262
263 263 clone
264 264
265 265 $ cd ..
266 266 $ hg clone t tc
267 267 updating to branch default
268 268 cloning subrepo s from $TESTTMP/sub/t/s (glob)
269 269 cloning subrepo s/ss from $TESTTMP/sub/t/s/ss (glob)
270 270 cloning subrepo t from $TESTTMP/sub/t/t (glob)
271 271 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
272 272 $ cd tc
273 273 $ hg debugsub
274 274 path s
275 275 source s
276 276 revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
277 277 path t
278 278 source t
279 279 revision 20a0db6fbf6c3d2836e6519a642ae929bfc67c0e
280 280
281 281 push
282 282
283 283 $ echo bah > t/t
284 284 $ hg ci -m11
285 285 committing subrepository t
286 286 $ hg push
287 287 pushing to $TESTTMP/sub/t (glob)
288 288 pushing subrepo s/ss to $TESTTMP/sub/t/s/ss (glob)
289 289 searching for changes
290 290 no changes found
291 291 pushing subrepo s to $TESTTMP/sub/t/s (glob)
292 292 searching for changes
293 293 no changes found
294 294 pushing subrepo t to $TESTTMP/sub/t/t (glob)
295 295 searching for changes
296 296 adding changesets
297 297 adding manifests
298 298 adding file changes
299 299 added 1 changesets with 1 changes to 1 files
300 300 searching for changes
301 301 adding changesets
302 302 adding manifests
303 303 adding file changes
304 304 added 1 changesets with 1 changes to 1 files
305 305
306 306 push -f
307 307
308 308 $ echo bah > s/a
309 309 $ hg ci -m12
310 310 committing subrepository s
311 311 $ hg push
312 312 pushing to $TESTTMP/sub/t (glob)
313 313 pushing subrepo s/ss to $TESTTMP/sub/t/s/ss (glob)
314 314 searching for changes
315 315 no changes found
316 316 pushing subrepo s to $TESTTMP/sub/t/s (glob)
317 317 searching for changes
318 318 abort: push creates new remote head 12a213df6fa9!
319 319 (did you forget to merge? use push -f to force)
320 320 [255]
321 321 $ hg push -f
322 322 pushing to $TESTTMP/sub/t (glob)
323 323 pushing subrepo s/ss to $TESTTMP/sub/t/s/ss (glob)
324 324 searching for changes
325 325 no changes found
326 326 pushing subrepo s to $TESTTMP/sub/t/s (glob)
327 327 searching for changes
328 328 adding changesets
329 329 adding manifests
330 330 adding file changes
331 331 added 1 changesets with 1 changes to 1 files (+1 heads)
332 332 pushing subrepo t to $TESTTMP/sub/t/t (glob)
333 333 searching for changes
334 334 no changes found
335 335 searching for changes
336 336 adding changesets
337 337 adding manifests
338 338 adding file changes
339 339 added 1 changesets with 1 changes to 1 files
340 340
341 341 update
342 342
343 343 $ cd ../t
344 344 $ hg up -C # discard our earlier merge
345 345 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
346 346 $ echo blah > t/t
347 347 $ hg ci -m13
348 348 committing subrepository t
349 349
350 350 pull
351 351
352 352 $ cd ../tc
353 353 $ hg pull
354 354 pulling from $TESTTMP/sub/t (glob)
355 355 searching for changes
356 356 adding changesets
357 357 adding manifests
358 358 adding file changes
359 359 added 1 changesets with 1 changes to 1 files
360 360 (run 'hg update' to get a working copy)
361 361
362 362 should pull t
363 363
364 364 $ hg up
365 365 pulling subrepo t from $TESTTMP/sub/t/t (glob)
366 366 searching for changes
367 367 adding changesets
368 368 adding manifests
369 369 adding file changes
370 370 added 1 changesets with 1 changes to 1 files
371 371 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
372 372 $ cat t/t
373 373 blah
374 374
375 375 bogus subrepo path aborts
376 376
377 377 $ echo 'bogus=[boguspath' >> .hgsub
378 378 $ hg ci -m 'bogus subrepo path'
379 379 abort: missing ] in subrepo source
380 380 [255]
381 381
382 382 Issue1986: merge aborts when trying to merge a subrepo that
383 383 shouldn't need merging
384 384
385 385 # subrepo layout
386 386 #
387 387 # o 5 br
388 388 # /|
389 389 # o | 4 default
390 390 # | |
391 391 # | o 3 br
392 392 # |/|
393 393 # o | 2 default
394 394 # | |
395 395 # | o 1 br
396 396 # |/
397 397 # o 0 default
398 398
399 399 $ cd ..
400 400 $ rm -rf sub
401 401 $ hg init main
402 402 $ cd main
403 403 $ hg init s
404 404 $ cd s
405 405 $ echo a > a
406 406 $ hg ci -Am1
407 407 adding a
408 408 $ hg branch br
409 409 marked working directory as branch br
410 410 (branches are permanent and global, did you want a bookmark?)
411 411 $ echo a >> a
412 412 $ hg ci -m1
413 413 $ hg up default
414 414 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
415 415 $ echo b > b
416 416 $ hg ci -Am1
417 417 adding b
418 418 $ hg up br
419 419 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
420 420 $ hg merge tip
421 421 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
422 422 (branch merge, don't forget to commit)
423 423 $ hg ci -m1
424 424 $ hg up 2
425 425 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
426 426 $ echo c > c
427 427 $ hg ci -Am1
428 428 adding c
429 429 $ hg up 3
430 430 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
431 431 $ hg merge 4
432 432 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
433 433 (branch merge, don't forget to commit)
434 434 $ hg ci -m1
435 435
436 436 # main repo layout:
437 437 #
438 438 # * <-- try to merge default into br again
439 439 # .`|
440 440 # . o 5 br --> substate = 5
441 441 # . |
442 442 # o | 4 default --> substate = 4
443 443 # | |
444 444 # | o 3 br --> substate = 2
445 445 # |/|
446 446 # o | 2 default --> substate = 2
447 447 # | |
448 448 # | o 1 br --> substate = 3
449 449 # |/
450 450 # o 0 default --> substate = 2
451 451
452 452 $ cd ..
453 453 $ echo 's = s' > .hgsub
454 454 $ hg -R s up 2
455 455 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
456 456 $ hg ci -Am1
457 457 adding .hgsub
458 458 committing subrepository s
459 459 $ hg branch br
460 460 marked working directory as branch br
461 461 (branches are permanent and global, did you want a bookmark?)
462 462 $ echo b > b
463 463 $ hg -R s up 3
464 464 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
465 465 $ hg ci -Am1
466 466 adding b
467 467 committing subrepository s
468 468 $ hg up default
469 469 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
470 470 $ echo c > c
471 471 $ hg ci -Am1
472 472 adding c
473 473 $ hg up 1
474 474 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
475 475 $ hg merge 2
476 476 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
477 477 (branch merge, don't forget to commit)
478 478 $ hg ci -m1
479 479 $ hg up 2
480 480 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
481 481 $ hg -R s up 4
482 482 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
483 483 $ echo d > d
484 484 $ hg ci -Am1
485 485 adding d
486 486 committing subrepository s
487 487 $ hg up 3
488 488 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
489 489 $ hg -R s up 5
490 490 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
491 491 $ echo e > e
492 492 $ hg ci -Am1
493 493 adding e
494 494 committing subrepository s
495 495
496 496 $ hg up 5
497 497 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
498 498 $ hg merge 4 # try to merge default into br again
499 499 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
500 500 (branch merge, don't forget to commit)
501 501 $ cd ..
502 502
503 503 test subrepo delete from .hgsubstate
504 504
505 505 $ hg init testdelete
506 506 $ mkdir testdelete/nested testdelete/nested2
507 507 $ hg init testdelete/nested
508 508 $ hg init testdelete/nested2
509 509 $ echo test > testdelete/nested/foo
510 510 $ echo test > testdelete/nested2/foo
511 511 $ hg -R testdelete/nested add
512 512 adding testdelete/nested/foo (glob)
513 513 $ hg -R testdelete/nested2 add
514 514 adding testdelete/nested2/foo (glob)
515 515 $ hg -R testdelete/nested ci -m test
516 516 $ hg -R testdelete/nested2 ci -m test
517 517 $ echo nested = nested > testdelete/.hgsub
518 518 $ echo nested2 = nested2 >> testdelete/.hgsub
519 519 $ hg -R testdelete add
520 520 adding testdelete/.hgsub (glob)
521 521 $ hg -R testdelete ci -m "nested 1 & 2 added"
522 522 committing subrepository nested
523 523 committing subrepository nested2
524 524 $ echo nested = nested > testdelete/.hgsub
525 525 $ hg -R testdelete ci -m "nested 2 deleted"
526 526 $ cat testdelete/.hgsubstate
527 527 bdf5c9a3103743d900b12ae0db3ffdcfd7b0d878 nested
528 528 $ hg -R testdelete remove testdelete/.hgsub
529 529 $ hg -R testdelete ci -m ".hgsub deleted"
530 530 $ cat testdelete/.hgsubstate
531 531 bdf5c9a3103743d900b12ae0db3ffdcfd7b0d878 nested
532 532
533 533 test repository cloning
534 534
535 535 $ mkdir mercurial mercurial2
536 536 $ hg init nested_absolute
537 537 $ echo test > nested_absolute/foo
538 538 $ hg -R nested_absolute add
539 539 adding nested_absolute/foo (glob)
540 540 $ hg -R nested_absolute ci -mtest
541 541 $ cd mercurial
542 542 $ hg init nested_relative
543 543 $ echo test2 > nested_relative/foo2
544 544 $ hg -R nested_relative add
545 545 adding nested_relative/foo2 (glob)
546 546 $ hg -R nested_relative ci -mtest2
547 547 $ hg init main
548 548 $ echo "nested_relative = ../nested_relative" > main/.hgsub
549 549 $ echo "nested_absolute = `pwd`/nested_absolute" >> main/.hgsub
550 550 $ hg -R main add
551 551 adding main/.hgsub (glob)
552 552 $ hg -R main ci -m "add subrepos"
553 553 committing subrepository nested_absolute
554 554 committing subrepository nested_relative
555 555 $ cd ..
556 556 $ hg clone mercurial/main mercurial2/main
557 557 updating to branch default
558 558 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
559 559 $ cat mercurial2/main/nested_absolute/.hg/hgrc \
560 560 > mercurial2/main/nested_relative/.hg/hgrc
561 561 [paths]
562 562 default = $TESTTMP/sub/mercurial/nested_absolute
563 563 [paths]
564 564 default = $TESTTMP/sub/mercurial/nested_relative
565 565 $ rm -rf mercurial mercurial2
566 566
567 567 Issue1977: multirepo push should fail if subrepo push fails
568 568
569 569 $ hg init repo
570 570 $ hg init repo/s
571 571 $ echo a > repo/s/a
572 572 $ hg -R repo/s ci -Am0
573 573 adding a
574 574 $ echo s = s > repo/.hgsub
575 575 $ hg -R repo ci -Am1
576 576 adding .hgsub
577 577 committing subrepository s
578 578 $ hg clone repo repo2
579 579 updating to branch default
580 580 cloning subrepo s from $TESTTMP/sub/repo/s (glob)
581 581 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
582 582 $ hg -q -R repo2 pull -u
583 583 $ echo 1 > repo2/s/a
584 584 $ hg -R repo2/s ci -m2
585 585 $ hg -q -R repo2/s push
586 586 $ hg -R repo2/s up -C 0
587 587 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
588 588 $ echo 2 > repo2/s/a
589 589 $ hg -R repo2/s ci -m3
590 590 created new head
591 591 $ hg -R repo2 ci -m3
592 592 committing subrepository s
593 593 $ hg -q -R repo2 push
594 594 abort: push creates new remote head 9d66565e64e1!
595 595 (did you forget to merge? use push -f to force)
596 596 [255]
597 597 $ hg -R repo update
598 598 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
599 599 $ rm -rf repo2 repo
600 600
601 601
602 602 Issue1852 subrepos with relative paths always push/pull relative to default
603 603
604 604 Prepare a repo with subrepo
605 605
606 606 $ hg init issue1852a
607 607 $ cd issue1852a
608 608 $ hg init sub/repo
609 609 $ echo test > sub/repo/foo
610 610 $ hg -R sub/repo add sub/repo/foo
611 611 $ echo sub/repo = sub/repo > .hgsub
612 612 $ hg add .hgsub
613 613 $ hg ci -mtest
614 614 committing subrepository sub/repo (glob)
615 615 $ echo test >> sub/repo/foo
616 616 $ hg ci -mtest
617 617 committing subrepository sub/repo (glob)
618 618 $ cd ..
619 619
620 620 Create repo without default path, pull top repo, and see what happens on update
621 621
622 622 $ hg init issue1852b
623 623 $ hg -R issue1852b pull issue1852a
624 624 pulling from issue1852a
625 625 requesting all changes
626 626 adding changesets
627 627 adding manifests
628 628 adding file changes
629 629 added 2 changesets with 3 changes to 2 files
630 630 (run 'hg update' to get a working copy)
631 631 $ hg -R issue1852b update
632 632 abort: default path for subrepository sub/repo not found (glob)
633 633 [255]
634 634
635 635 Pull -u now doesn't help
636 636
637 637 $ hg -R issue1852b pull -u issue1852a
638 638 pulling from issue1852a
639 639 searching for changes
640 640 no changes found
641 641
642 642 Try the same, but with pull -u
643 643
644 644 $ hg init issue1852c
645 645 $ hg -R issue1852c pull -r0 -u issue1852a
646 646 pulling from issue1852a
647 647 adding changesets
648 648 adding manifests
649 649 adding file changes
650 650 added 1 changesets with 2 changes to 2 files
651 651 cloning subrepo sub/repo from issue1852a/sub/repo (glob)
652 652 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
653 653
654 654 Try to push from the other side
655 655
656 656 $ hg -R issue1852a push `pwd`/issue1852c
657 657 pushing to $TESTTMP/sub/issue1852c
658 658 pushing subrepo sub/repo to $TESTTMP/sub/issue1852c/sub/repo (glob)
659 659 searching for changes
660 660 no changes found
661 661 searching for changes
662 662 adding changesets
663 663 adding manifests
664 664 adding file changes
665 665 added 1 changesets with 1 changes to 1 files
666 666
667 667 Incoming and outgoing should not use the default path:
668 668
669 669 $ hg clone -q issue1852a issue1852d
670 670 $ hg -R issue1852d outgoing --subrepos issue1852c
671 671 comparing with issue1852c
672 672 searching for changes
673 673 no changes found
674 674 comparing with issue1852c/sub/repo
675 675 searching for changes
676 676 no changes found
677 677 [1]
678 678 $ hg -R issue1852d incoming --subrepos issue1852c
679 679 comparing with issue1852c
680 680 searching for changes
681 681 no changes found
682 682 comparing with issue1852c/sub/repo
683 683 searching for changes
684 684 no changes found
685 685 [1]
686 686
687 687 Check status of files when none of them belong to the first
688 688 subrepository:
689 689
690 690 $ hg init subrepo-status
691 691 $ cd subrepo-status
692 692 $ hg init subrepo-1
693 693 $ hg init subrepo-2
694 694 $ cd subrepo-2
695 695 $ touch file
696 696 $ hg add file
697 697 $ cd ..
698 698 $ echo subrepo-1 = subrepo-1 > .hgsub
699 699 $ echo subrepo-2 = subrepo-2 >> .hgsub
700 700 $ hg add .hgsub
701 701 $ hg ci -m 'Added subrepos'
702 702 committing subrepository subrepo-1
703 703 committing subrepository subrepo-2
704 704 $ hg st subrepo-2/file
705 705
706 706 Check hg update --clean
707 707 $ cd $TESTTMP/sub/t
708 708 $ rm -r t/t.orig
709 709 $ hg status -S --all
710 710 C .hgsub
711 711 C .hgsubstate
712 712 C a
713 713 C s/.hgsub
714 714 C s/.hgsubstate
715 715 C s/a
716 716 C s/ss/a
717 717 C t/t
718 718 $ echo c1 > s/a
719 719 $ cd s
720 720 $ echo c1 > b
721 721 $ echo c1 > c
722 722 $ hg add b
723 723 $ cd ..
724 724 $ hg status -S
725 725 M s/a
726 726 A s/b
727 727 ? s/c
728 728 $ hg update -C
729 729 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
730 730 $ hg status -S
731 731 ? s/b
732 732 ? s/c
733 733
734 734 Sticky subrepositories, no changes
735 735 $ cd $TESTTMP/sub/t
736 736 $ hg id
737 737 925c17564ef8 tip
738 738 $ hg -R s id
739 739 12a213df6fa9 tip
740 740 $ hg -R t id
741 741 52c0adc0515a tip
742 742 $ hg update 11
743 743 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
744 744 $ hg id
745 745 365661e5936a
746 746 $ hg -R s id
747 747 fc627a69481f
748 748 $ hg -R t id
749 749 e95bcfa18a35
750 750
751 751 Sticky subrepositorys, file changes
752 752 $ touch s/f1
753 753 $ touch t/f1
754 754 $ hg add -S s/f1
755 755 $ hg add -S t/f1
756 756 $ hg id
757 757 365661e5936a
758 758 $ hg -R s id
759 759 fc627a69481f+
760 760 $ hg -R t id
761 761 e95bcfa18a35+
762 762 $ hg update tip
763 763 subrepository sources for s differ
764 764 use (l)ocal source (fc627a69481f) or (r)emote source (12a213df6fa9)?
765 765 l
766 766 subrepository sources for t differ
767 767 use (l)ocal source (e95bcfa18a35) or (r)emote source (52c0adc0515a)?
768 768 l
769 769 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
770 770 $ hg id
771 771 925c17564ef8+ tip
772 772 $ hg -R s id
773 773 fc627a69481f+
774 774 $ hg -R t id
775 775 e95bcfa18a35+
776 776 $ hg update --clean tip
777 777 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
778 778
779 779 Sticky subrepository, revision updates
780 780 $ hg id
781 781 925c17564ef8 tip
782 782 $ hg -R s id
783 783 12a213df6fa9 tip
784 784 $ hg -R t id
785 785 52c0adc0515a tip
786 786 $ cd s
787 787 $ hg update -r -2
788 788 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
789 789 $ cd ../t
790 790 $ hg update -r 2
791 791 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
792 792 $ cd ..
793 793 $ hg update 10
794 794 subrepository sources for t differ (in checked out version)
795 795 use (l)ocal source (7af322bc1198) or (r)emote source (20a0db6fbf6c)?
796 796 l
797 797 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
798 798 $ hg id
799 799 e45c8b14af55+
800 800 $ hg -R s id
801 801 1c833a7a9e3a
802 802 $ hg -R t id
803 803 7af322bc1198
804 804
805 805 Sticky subrepository, file changes and revision updates
806 806 $ touch s/f1
807 807 $ touch t/f1
808 808 $ hg add -S s/f1
809 809 $ hg add -S t/f1
810 810 $ hg id
811 811 e45c8b14af55+
812 812 $ hg -R s id
813 813 1c833a7a9e3a+
814 814 $ hg -R t id
815 815 7af322bc1198+
816 816 $ hg update tip
817 817 subrepository sources for s differ
818 818 use (l)ocal source (1c833a7a9e3a) or (r)emote source (12a213df6fa9)?
819 819 l
820 820 subrepository sources for t differ
821 821 use (l)ocal source (7af322bc1198) or (r)emote source (52c0adc0515a)?
822 822 l
823 823 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
824 824 $ hg id
825 825 925c17564ef8 tip
826 826 $ hg -R s id
827 827 1c833a7a9e3a+
828 828 $ hg -R t id
829 829 7af322bc1198+
830 830
831 831 Sticky repository, update --clean
832 832 $ hg update --clean tip
833 833 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
834 834 $ hg id
835 835 925c17564ef8 tip
836 836 $ hg -R s id
837 837 12a213df6fa9 tip
838 838 $ hg -R t id
839 839 52c0adc0515a tip
840 840
841 841 Test subrepo already at intended revision:
842 842 $ cd s
843 843 $ hg update fc627a69481f
844 844 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
845 845 $ cd ..
846 846 $ hg update 11
847 847 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
848 848 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
849 849 $ hg id -n
850 850 11+
851 851 $ hg -R s id
852 852 fc627a69481f
853 853 $ hg -R t id
854 854 e95bcfa18a35
855 855
856 856 Test that removing .hgsubstate doesn't break anything:
857 857
858 858 $ hg rm -f .hgsubstate
859 859 $ hg ci -mrm
860 860 committing subrepository s
861 861 committing subrepository t
862 862 created new head
863 863 $ hg log -vr tip
864 864 changeset: 14:3941e0aa5236
865 865 tag: tip
866 866 parent: 11:365661e5936a
867 867 user: test
868 868 date: Thu Jan 01 00:00:00 1970 +0000
869 869 description:
870 870 rm
871 871
872 872
873 873
874 874 Test that removing .hgsub removes .hgsubstate:
875 875
876 876 $ hg rm .hgsub
877 877 $ hg ci -mrm2
878 878 $ hg log -vr tip
879 879 changeset: 15:8b31de9d13d1
880 880 tag: tip
881 881 user: test
882 882 date: Thu Jan 01 00:00:00 1970 +0000
883 883 files: .hgsub .hgsubstate
884 884 description:
885 885 rm2
886 886
887 887
888 888 Test behavior of add for explicit path in subrepo:
889 889 $ cd ..
890 890 $ hg init explicit
891 891 $ cd explicit
892 892 $ echo s = s > .hgsub
893 893 $ hg add .hgsub
894 894 $ hg init s
895 895 $ hg ci -m0
896 896 committing subrepository s
897 897 Adding with an explicit path in a subrepo adds the file
898 898 $ echo c1 > f1
899 899 $ echo c2 > s/f2
900 900 $ hg st -S
901 901 ? f1
902 902 ? s/f2
903 903 $ hg add s/f2
904 904 $ hg st -S
905 905 A s/f2
906 906 ? f1
907 907 $ hg ci -R s -m0
908 908 $ hg ci -Am1
909 909 adding f1
910 910 committing subrepository s
911 911 Adding with an explicit path in a subrepo with -S has the same behavior
912 912 $ echo c3 > f3
913 913 $ echo c4 > s/f4
914 914 $ hg st -S
915 915 ? f3
916 916 ? s/f4
917 917 $ hg add -S s/f4
918 918 $ hg st -S
919 919 A s/f4
920 920 ? f3
921 921 $ hg ci -R s -m1
922 922 $ hg ci -Ama2
923 923 adding f3
924 924 committing subrepository s
925 925 Adding without a path or pattern silently ignores subrepos
926 926 $ echo c5 > f5
927 927 $ echo c6 > s/f6
928 928 $ echo c7 > s/f7
929 929 $ hg st -S
930 930 ? f5
931 931 ? s/f6
932 932 ? s/f7
933 933 $ hg add
934 934 adding f5
935 935 $ hg st -S
936 936 A f5
937 937 ? s/f6
938 938 ? s/f7
939 939 $ hg ci -R s -Am2
940 940 adding f6
941 941 adding f7
942 942 $ hg ci -m3
943 943 committing subrepository s
944 944 Adding without a path or pattern with -S also adds files in subrepos
945 945 $ echo c8 > f8
946 946 $ echo c9 > s/f9
947 947 $ echo c10 > s/f10
948 948 $ hg st -S
949 949 ? f8
950 950 ? s/f10
951 951 ? s/f9
952 952 $ hg add -S
953 953 adding f8
954 954 adding s/f10 (glob)
955 955 adding s/f9 (glob)
956 956 $ hg st -S
957 957 A f8
958 958 A s/f10
959 959 A s/f9
960 960 $ hg ci -R s -m3
961 961 $ hg ci -m4
962 962 committing subrepository s
963 963 Adding with a pattern silently ignores subrepos
964 964 $ echo c11 > fm11
965 965 $ echo c12 > fn12
966 966 $ echo c13 > s/fm13
967 967 $ echo c14 > s/fn14
968 968 $ hg st -S
969 969 ? fm11
970 970 ? fn12
971 971 ? s/fm13
972 972 ? s/fn14
973 973 $ hg add 'glob:**fm*'
974 974 adding fm11
975 975 $ hg st -S
976 976 A fm11
977 977 ? fn12
978 978 ? s/fm13
979 979 ? s/fn14
980 980 $ hg ci -R s -Am4
981 981 adding fm13
982 982 adding fn14
983 983 $ hg ci -Am5
984 984 adding fn12
985 985 committing subrepository s
986 986 Adding with a pattern with -S also adds matches in subrepos
987 987 $ echo c15 > fm15
988 988 $ echo c16 > fn16
989 989 $ echo c17 > s/fm17
990 990 $ echo c18 > s/fn18
991 991 $ hg st -S
992 992 ? fm15
993 993 ? fn16
994 994 ? s/fm17
995 995 ? s/fn18
996 996 $ hg add -S 'glob:**fm*'
997 997 adding fm15
998 998 adding s/fm17 (glob)
999 999 $ hg st -S
1000 1000 A fm15
1001 1001 A s/fm17
1002 1002 ? fn16
1003 1003 ? s/fn18
1004 1004 $ hg ci -R s -Am5
1005 1005 adding fn18
1006 1006 $ hg ci -Am6
1007 1007 adding fn16
1008 1008 committing subrepository s
1009 1009
1010 1010 Test behavior of forget for explicit path in subrepo:
1011 1011 Forgetting an explicit path in a subrepo untracks the file
1012 1012 $ echo c19 > s/f19
1013 1013 $ hg add s/f19
1014 1014 $ hg st -S
1015 1015 A s/f19
1016 1016 $ hg forget s/f19
1017 1017 $ hg st -S
1018 1018 ? s/f19
1019 1019 $ rm s/f19
@@ -1,236 +1,236 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 43 searching for copies back to rev 1
44 44 unmatched files in other:
45 45 b
46 46 resolving manifests
47 overwrite False partial False
48 ancestor c19d34741b0a local c19d34741b0a+ remote 1e71731e6fbb
47 overwrite: False, partial: False
48 ancestor: c19d34741b0a, local: c19d34741b0a+, remote: 1e71731e6fbb
49 49 a: versions differ -> m
50 50 b: remote created -> g
51 51 preserving a for resolve of a
52 52 updating: a 1/2 files (50.00%)
53 53 picked tool 'true' for a (binary False symlink False)
54 54 merging a
55 55 my a@c19d34741b0a+ other a@1e71731e6fbb ancestor a@c19d34741b0a
56 56 updating: b 2/2 files (100.00%)
57 57 getting b
58 58 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
59 59 $ hg parents
60 60 changeset: 1:1e71731e6fbb
61 61 tag: tip
62 62 user: test
63 63 date: Thu Jan 01 00:00:00 1970 +0000
64 64 summary: 2
65 65
66 66 $ hg --debug up 0
67 67 resolving manifests
68 overwrite False partial False
69 ancestor 1e71731e6fbb local 1e71731e6fbb+ remote c19d34741b0a
68 overwrite: False, partial: False
69 ancestor: 1e71731e6fbb, local: 1e71731e6fbb+, remote: c19d34741b0a
70 70 a: versions differ -> m
71 71 b: other deleted -> r
72 72 preserving a for resolve of a
73 73 updating: b 1/2 files (50.00%)
74 74 removing b
75 75 updating: a 2/2 files (100.00%)
76 76 picked tool 'true' for a (binary False symlink False)
77 77 merging a
78 78 my a@1e71731e6fbb+ other a@c19d34741b0a ancestor a@1e71731e6fbb
79 79 0 files updated, 1 files merged, 1 files removed, 0 files unresolved
80 80 $ hg parents
81 81 changeset: 0:c19d34741b0a
82 82 user: test
83 83 date: Thu Jan 01 00:00:00 1970 +0000
84 84 summary: 1
85 85
86 86 $ hg --debug merge
87 87 abort: nothing to merge
88 88 (use 'hg update' instead)
89 89 [255]
90 90 $ hg parents
91 91 changeset: 0:c19d34741b0a
92 92 user: test
93 93 date: Thu Jan 01 00:00:00 1970 +0000
94 94 summary: 1
95 95
96 96 $ hg --debug up
97 97 searching for copies back to rev 1
98 98 unmatched files in other:
99 99 b
100 100 resolving manifests
101 overwrite False partial False
102 ancestor c19d34741b0a local c19d34741b0a+ remote 1e71731e6fbb
101 overwrite: False, partial: False
102 ancestor: c19d34741b0a, local: c19d34741b0a+, remote: 1e71731e6fbb
103 103 a: versions differ -> m
104 104 b: remote created -> g
105 105 preserving a for resolve of a
106 106 updating: a 1/2 files (50.00%)
107 107 picked tool 'true' for a (binary False symlink False)
108 108 merging a
109 109 my a@c19d34741b0a+ other a@1e71731e6fbb ancestor a@c19d34741b0a
110 110 updating: b 2/2 files (100.00%)
111 111 getting b
112 112 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
113 113 $ hg parents
114 114 changeset: 1:1e71731e6fbb
115 115 tag: tip
116 116 user: test
117 117 date: Thu Jan 01 00:00:00 1970 +0000
118 118 summary: 2
119 119
120 120 $ hg -v history
121 121 changeset: 1:1e71731e6fbb
122 122 tag: tip
123 123 user: test
124 124 date: Thu Jan 01 00:00:00 1970 +0000
125 125 files: a b
126 126 description:
127 127 2
128 128
129 129
130 130 changeset: 0:c19d34741b0a
131 131 user: test
132 132 date: Thu Jan 01 00:00:00 1970 +0000
133 133 files: a
134 134 description:
135 135 1
136 136
137 137
138 138 $ hg diff --nodates
139 139 diff -r 1e71731e6fbb a
140 140 --- a/a
141 141 +++ b/a
142 142 @@ -1,1 +1,1 @@
143 143 -a2
144 144 +abc
145 145
146 146
147 147 create a second head
148 148
149 149 $ cd ../r1
150 150 $ hg up 0
151 151 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
152 152 $ echo b2 > b
153 153 $ echo a3 > a
154 154 $ hg addremove
155 155 adding b
156 156 $ hg commit -m "3"
157 157 created new head
158 158
159 159 $ cd ../r2
160 160 $ hg -q pull ../r1
161 161 $ hg status
162 162 M a
163 163 $ hg parents
164 164 changeset: 1:1e71731e6fbb
165 165 user: test
166 166 date: Thu Jan 01 00:00:00 1970 +0000
167 167 summary: 2
168 168
169 169 $ hg --debug up
170 170 abort: crosses branches (merge branches or use --clean to discard changes)
171 171 [255]
172 172 $ hg --debug merge
173 173 abort: outstanding uncommitted changes
174 174 (use 'hg status' to list changes)
175 175 [255]
176 176 $ hg --debug merge -f
177 177 searching for copies back to rev 1
178 178 resolving manifests
179 overwrite False partial False
180 ancestor c19d34741b0a local 1e71731e6fbb+ remote 83c51d0caff4
179 overwrite: False, partial: False
180 ancestor: c19d34741b0a, local: 1e71731e6fbb+, remote: 83c51d0caff4
181 181 a: versions differ -> m
182 182 b: versions differ -> m
183 183 preserving a for resolve of a
184 184 preserving b for resolve of b
185 185 updating: a 1/2 files (50.00%)
186 186 picked tool 'true' for a (binary False symlink False)
187 187 merging a
188 188 my a@1e71731e6fbb+ other a@83c51d0caff4 ancestor a@c19d34741b0a
189 189 updating: b 2/2 files (100.00%)
190 190 picked tool 'true' for b (binary False symlink False)
191 191 merging b
192 192 my b@1e71731e6fbb+ other b@83c51d0caff4 ancestor b@000000000000
193 193 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
194 194 (branch merge, don't forget to commit)
195 195 $ hg parents
196 196 changeset: 1:1e71731e6fbb
197 197 user: test
198 198 date: Thu Jan 01 00:00:00 1970 +0000
199 199 summary: 2
200 200
201 201 changeset: 2:83c51d0caff4
202 202 tag: tip
203 203 parent: 0:c19d34741b0a
204 204 user: test
205 205 date: Thu Jan 01 00:00:00 1970 +0000
206 206 summary: 3
207 207
208 208 $ hg diff --nodates
209 209 diff -r 1e71731e6fbb a
210 210 --- a/a
211 211 +++ b/a
212 212 @@ -1,1 +1,1 @@
213 213 -a2
214 214 +abc
215 215
216 216
217 217 test a local add
218 218
219 219 $ cd ..
220 220 $ hg init a
221 221 $ hg init b
222 222 $ echo a > a/a
223 223 $ echo a > b/a
224 224 $ hg --cwd a commit -A -m a
225 225 adding a
226 226 $ cd b
227 227 $ hg add a
228 228 $ hg pull -u ../a
229 229 pulling from ../a
230 230 requesting all changes
231 231 adding changesets
232 232 adding manifests
233 233 adding file changes
234 234 added 1 changesets with 1 changes to 1 files
235 235 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
236 236 $ hg st
@@ -1,85 +1,85 b''
1 1 $ hg init
2 2
3 3 $ touch a
4 4 $ hg add a
5 5 $ hg commit -m "Added a"
6 6
7 7 $ touch main
8 8 $ hg add main
9 9 $ hg commit -m "Added main"
10 10 $ hg checkout 0
11 11 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
12 12
13 13 'main' should be gone:
14 14
15 15 $ ls
16 16 a
17 17
18 18 $ touch side1
19 19 $ hg add side1
20 20 $ hg commit -m "Added side1"
21 21 created new head
22 22 $ touch side2
23 23 $ hg add side2
24 24 $ hg commit -m "Added side2"
25 25
26 26 $ hg log
27 27 changeset: 3:91ebc10ed028
28 28 tag: tip
29 29 user: test
30 30 date: Thu Jan 01 00:00:00 1970 +0000
31 31 summary: Added side2
32 32
33 33 changeset: 2:b932d7dbb1e1
34 34 parent: 0:c2eda428b523
35 35 user: test
36 36 date: Thu Jan 01 00:00:00 1970 +0000
37 37 summary: Added side1
38 38
39 39 changeset: 1:71a760306caf
40 40 user: test
41 41 date: Thu Jan 01 00:00:00 1970 +0000
42 42 summary: Added main
43 43
44 44 changeset: 0:c2eda428b523
45 45 user: test
46 46 date: Thu Jan 01 00:00:00 1970 +0000
47 47 summary: Added a
48 48
49 49
50 50 $ hg heads
51 51 changeset: 3:91ebc10ed028
52 52 tag: tip
53 53 user: test
54 54 date: Thu Jan 01 00:00:00 1970 +0000
55 55 summary: Added side2
56 56
57 57 changeset: 1:71a760306caf
58 58 user: test
59 59 date: Thu Jan 01 00:00:00 1970 +0000
60 60 summary: Added main
61 61
62 62 $ ls
63 63 a
64 64 side1
65 65 side2
66 66
67 67 $ hg update --debug -C 1
68 68 resolving manifests
69 overwrite True partial False
70 ancestor 91ebc10ed028+ local 91ebc10ed028+ remote 71a760306caf
69 overwrite: True, partial: False
70 ancestor: 91ebc10ed028+, local: 91ebc10ed028+, remote: 71a760306caf
71 71 side2: other deleted -> r
72 72 side1: other deleted -> r
73 73 main: remote created -> g
74 74 updating: side1 1/3 files (33.33%)
75 75 removing side1
76 76 updating: side2 2/3 files (66.67%)
77 77 removing side2
78 78 updating: main 3/3 files (100.00%)
79 79 getting main
80 80 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
81 81
82 82 $ ls
83 83 a
84 84 main
85 85
General Comments 0
You need to be logged in to leave comments. Login now