hgext3rd/evolve/evolvecmd.py
changeset 3632 8d38b88233cb
parent 3631 8db32b33cdf1
child 3633 ed3032ee53eb
equal deleted inserted replaced
3631:8db32b33cdf1 3632:8d38b88233cb
   221         repo.ui.write(('hg commit --msg "%s update to %s"\n' %
   221         repo.ui.write(('hg commit --msg "%s update to %s"\n' %
   222                        (TROUBLES['PHASEDIVERGENT'], bumped)))
   222                        (TROUBLES['PHASEDIVERGENT'], bumped)))
   223         return (False, '')
   223         return (False, '')
   224     if progresscb:
   224     if progresscb:
   225         progresscb()
   225         progresscb()
   226     newid = tmpctx = None
       
   227     tmpctx = bumped
   226     tmpctx = bumped
   228     tr = repo.currenttransaction()
       
   229     assert tr is not None
       
   230     bmupdate = _bookmarksupdater(repo, bumped.node(), tr)
       
   231     # function to update the bookmark from the rebased changeset to new resolved
       
   232     # changeset
       
   233     rebasedbmupdate = None
       
   234 
   227 
   235     # Checking for whether the phase-divergent changeset has common parents as
   228     # Checking for whether the phase-divergent changeset has common parents as
   236     # it's precursors. Phase-divergent changeset and precursor having different
   229     # it's precursors. Phase-divergent changeset and precursor having different
   237     # parents is a result of when the changeset is rebased, grabbed, histedit or
   230     # parents is a result of when the changeset is rebased, grabbed, histedit or
   238     # evolved or any other operation which can change parent. In such cases,
   231     # evolved or any other operation which can change parent. In such cases,
   246             tmpid = relocate(repo, bumped, prec.p1())
   239             tmpid = relocate(repo, bumped, prec.p1())
   247             if tmpid is not None:
   240             if tmpid is not None:
   248                 tmpctx = repo[tmpid]
   241                 tmpctx = repo[tmpid]
   249                 compat.createmarkers(repo, [(bumped, (tmpctx,))],
   242                 compat.createmarkers(repo, [(bumped, (tmpctx,))],
   250                                      operation='evolve')
   243                                      operation='evolve')
   251                 # after rebasing, the changeset against which revert should
       
   252                 # happen should be the new rebased changeset
       
   253                 bumped = tmpctx
       
   254                 rebasedbmupdate = _bookmarksupdater(repo, bumped.node(), tr)
       
   255         except MergeFailure:
   244         except MergeFailure:
   256             evolvestate['current'] = bumped.hex()
   245             evolvestate['current'] = bumped.hex()
   257             evolvestate['precursor'] = prec.hex()
   246             evolvestate['precursor'] = prec.hex()
   258             evolvestate.save()
   247             evolvestate.save()
   259             repo.ui.write_err(_('evolution failed!\n'))
   248             repo.ui.write_err(_('evolution failed!\n'))
   260             msg = _("fix conflict and run 'hg evolve --continue'\n")
   249             msg = _("fix conflict and run 'hg evolve --continue'\n")
   261             repo.ui.write_err(msg)
   250             repo.ui.write_err(msg)
   262             raise
   251             raise
       
   252 
       
   253     return _resolvephasedivergent(ui, repo, prec, bumped, tmpctx)
       
   254 
       
   255 def _resolvephasedivergent(ui, repo, prec, bumped, tmpctx=None):
       
   256 
       
   257     tr = repo.currenttransaction()
       
   258     assert tr is not None
       
   259     bmupdate = _bookmarksupdater(repo, bumped.node(), tr)
       
   260     newid = None
       
   261 
       
   262     # function to update the bookmark from the rebased changeset to new resolved
       
   263     # changeset
       
   264     rebasedbmupdate = None
       
   265     if tmpctx and tmpctx.node() != bumped.node():
       
   266         rebasedbmupdate = _bookmarksupdater(repo, tmpctx.node(), tr)
       
   267         bumped = tmpctx
   263 
   268 
   264     # Create the new commit context
   269     # Create the new commit context
   265     repo.ui.status(_('computing new diff\n'))
   270     repo.ui.status(_('computing new diff\n'))
   266     files = set()
   271     files = set()
   267     copied = copies.pathcopies(prec, bumped)
   272     copied = copies.pathcopies(prec, bumped)