hgext/evolve.py
changeset 1568 52c276d2ddb2
parent 1567 536fdfa3c48b
child 1575 0c8548df67fe
equal deleted inserted replaced
1567:536fdfa3c48b 1568:52c276d2ddb2
   964             class LocalMergeFailure(MergeFailure, exc.__class__):
   964             class LocalMergeFailure(MergeFailure, exc.__class__):
   965                 pass
   965                 pass
   966             exc.__class__ = LocalMergeFailure
   966             exc.__class__ = LocalMergeFailure
   967             raise
   967             raise
   968         oldbookmarks = repo.nodebookmarks(nodesrc)
   968         oldbookmarks = repo.nodebookmarks(nodesrc)
   969         if nodenew is not None:
   969         _finalizerelocate(repo, orig, dest, nodenew, tr)
   970             phases.retractboundary(repo, tr, destphase, [nodenew])
       
   971             obsolete.createmarkers(repo, [(repo[nodesrc], (repo[nodenew],))])
       
   972             for book in oldbookmarks:
       
   973                 repo._bookmarks[book] = nodenew
       
   974         else:
       
   975             obsolete.createmarkers(repo, [(repo[nodesrc], ())])
       
   976             # Behave like rebase, move bookmarks to dest
       
   977             for book in oldbookmarks:
       
   978                 repo._bookmarks[book] = dest.node()
       
   979         for book in destbookmarks: # restore bookmark that rebase move
       
   980             repo._bookmarks[book] = dest.node()
       
   981         if oldbookmarks or destbookmarks:
       
   982             repo._bookmarks.recordchange(tr)
       
   983         tr.close()
   970         tr.close()
   984     finally:
   971     finally:
   985         tr.release()
   972         tr.release()
   986     return nodenew
   973     return nodenew
   987 
   974 
  3683         nodenew = repo.commit(text=commitmsg, user=orig.user(),
  3670         nodenew = repo.commit(text=commitmsg, user=orig.user(),
  3684                               date=orig.date(), extra=extra)
  3671                               date=orig.date(), extra=extra)
  3685     finally:
  3672     finally:
  3686         repo.ui.restoreconfig(backup)
  3673         repo.ui.restoreconfig(backup)
  3687     return nodenew
  3674     return nodenew
       
  3675 
       
  3676 def _finalizerelocate(repo, orig, dest, nodenew, tr):
       
  3677     destbookmarks = repo.nodebookmarks(dest.node())
       
  3678     nodesrc = orig.node()
       
  3679     destphase = repo[nodesrc].phase()
       
  3680     oldbookmarks = repo.nodebookmarks(nodesrc)
       
  3681     if nodenew is not None:
       
  3682         phases.retractboundary(repo, tr, destphase, [nodenew])
       
  3683         obsolete.createmarkers(repo, [(repo[nodesrc], (repo[nodenew],))])
       
  3684         for book in oldbookmarks:
       
  3685             repo._bookmarks[book] = nodenew
       
  3686     else:
       
  3687         obsolete.createmarkers(repo, [(repo[nodesrc], ())])
       
  3688         # Behave like rebase, move bookmarks to dest
       
  3689         for book in oldbookmarks:
       
  3690             repo._bookmarks[book] = dest.node()
       
  3691     for book in destbookmarks: # restore bookmark that rebase move
       
  3692         repo._bookmarks[book] = dest.node()
       
  3693     if oldbookmarks or destbookmarks:
       
  3694         repo._bookmarks.recordchange(tr)