##// END OF EJS Templates
merge: use repo.parents and parent contexts in update
Matt Mackall -
r3167:e67c22bc default
parent child Browse files
Show More
@@ -320,12 +320,12 def update(repo, node, branchmerge=False
320 320
321 321 ### check phase
322 322
323 pl = repo.dirstate.parents()
324 if not overwrite and pl[1] != nullid:
323 pl = repo.parents()
324 if not overwrite and len(pl) > 1:
325 325 raise util.Abort(_("outstanding uncommitted merges"))
326 326
327 p1, p2 = pl[0], node
328 pa = repo.changelog.ancestor(p1, p2)
327 p1, p2 = pl[0], repo.changectx(node)
328 pa = p1.ancestor(p2)
329 329
330 330 # are we going backwards?
331 331 backwards = (pa == p2)
@@ -345,17 +345,16 def update(repo, node, branchmerge=False
345 345 if modified or added or removed:
346 346 raise util.Abort(_("outstanding uncommitted changes"))
347 347
348 m1 = repo.changectx(p1).manifest().copy()
349 m2 = repo.changectx(p2).manifest().copy()
350 ma = repo.changectx(pa).manifest()
348 m1 = p1.manifest().copy()
349 m2 = p2.manifest().copy()
350 ma = pa.manifest()
351 351
352 352 # resolve the manifest to determine which files
353 353 # we care about merging
354 354 repo.ui.note(_("resolving manifests\n"))
355 355 repo.ui.debug(_(" overwrite %s branchmerge %s partial %s\n") %
356 356 (overwrite, branchmerge, bool(partial)))
357 repo.ui.debug(_(" ancestor %s local %s remote %s\n") %
358 (short(p1), short(p2), short(pa)))
357 repo.ui.debug(_(" ancestor %s local %s remote %s\n") % (p1, p2, pa))
359 358
360 359 action = []
361 360 copy = {}
@@ -369,7 +368,7 def update(repo, node, branchmerge=False
369 368 if not branchmerge:
370 369 action += forgetremoved(m2, status)
371 370 if not (backwards or overwrite):
372 copy = findcopies(repo, m1, m2, repo.changelog.rev(pa))
371 copy = findcopies(repo, m1, m2, pa.rev())
373 372
374 373 action += manifestmerge(repo.ui, m1, m2, ma, overwrite, backwards)
375 374 del m1, m2, ma
@@ -378,10 +377,10 def update(repo, node, branchmerge=False
378 377
379 378 if not branchmerge:
380 379 # we don't need to do any magic, just jump to the new rev
381 p1, p2 = p2, nullid
380 p1, p2 = p2, repo.changectx(nullid)
382 381
383 xp1, xp2 = hex(p1), hex(p2)
384 if p2 == nullid: xp2 = ''
382 xp1, xp2 = str(p1), str(p2)
383 if p2.node() == nullid: xp2 = ''
385 384
386 385 repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2)
387 386
@@ -389,7 +388,7 def update(repo, node, branchmerge=False
389 388
390 389 # update dirstate
391 390 if not partial:
392 repo.dirstate.setparents(p1, p2)
391 repo.dirstate.setparents(p1.node(), p2.node())
393 392 recordupdates(repo, action, branchmerge)
394 393
395 394 if show_stats:
@@ -406,8 +405,7 def update(repo, node, branchmerge=False
406 405 " you can redo the full merge using:\n"
407 406 " hg update -C %s\n"
408 407 " hg merge %s\n"
409 % (repo.changelog.rev(p1),
410 repo.changelog.rev(p2))))
408 % (p1.rev(), p2.rev())))
411 409 elif remind:
412 410 repo.ui.status(_("(branch merge, don't forget to commit)\n"))
413 411 elif unresolved:
@@ -62,10 +62,10 precommit hook: p1=8ea2ef7ad3e8cac946c72
62 62 precommit.forbid hook
63 63 abort: precommit.forbid hook exited with status 1
64 64 4:8ea2ef7ad3e8
65 preupdate hook: p1=b702efe9688826e3a91283852b328b84dbf37bc2 p2=
65 preupdate hook: p1=b702efe96888 p2=
66 66 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
67 preupdate hook: p1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 p2=
68 update hook: p1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 p2= err=0
67 preupdate hook: p1=8ea2ef7ad3e8 p2=
68 update hook: p1=8ea2ef7ad3e8 p2= err=0
69 69 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
70 70 3:4c52fb2e4022
71 71 prechangegroup.forbid hook
General Comments 0
You need to be logged in to leave comments. Login now