Mercurial > evolve
diff hgext/evolve.py @ 1184:bc601c010185 stable
evolve: remove the use of `rebase.concludenode`
Half of this function is now done in `merge.graft` and the over part is easy to
redo manually. So we remove the usage of this function to remove the dependency
of evolve on the rebase extension.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Sat, 13 Dec 2014 18:09:23 -0800 |
parents | 58370c718183 |
children | cc3e68120185 |
line wrap: on
line diff
--- a/hgext/evolve.py Sat Dec 13 17:47:09 2014 -0800 +++ b/hgext/evolve.py Sat Dec 13 18:09:23 2014 -0800 @@ -808,20 +808,25 @@ try: if repo['.'].rev() != dest.rev(): merge.update(repo, dest, False, True, False) - r = merge.graft(repo, orig, orig.p1(), - ['local', 'graft']) - if r[-1]: #some conflict + if keepbranch: + repo.dirstate.setbranch(orig.branch()) + r = merge.graft(repo, orig, orig.p1(), ['local', 'graft']) + if r[-1]: #some conflict raise util.Abort( 'unresolved merge conflicts (see hg help resolve)') - if keepbranch: - def _extrafn(ctx, extra): - extra['branch'] = ctx.branch() - else: - _extrafn = (lambda ctx, extra: None) + if commitmsg is None: + commitmsg = orig.description() + extra = {'rebase_source': orig.hex()} - nodenew = rebase.concludenode(repo, orig.node(), dest.node(), - node.nullid, commitmsg, - extrafn=_extrafn) + backup = repo.ui.backupconfig('phases', 'new-commit') + try: + targetphase = max(orig.phase(), phases.draft) + repo.ui.setconfig('phases', 'new-commit', targetphase, 'rebase') + # Commit might fail if unresolved files exist + nodenew = repo.commit(text=commitmsg, user=orig.user(), + date=orig.date(), extra=extra) + finally: + repo.ui.restoreconfig(backup) except util.Abort, exc: repo.dirstate.beginparentchange() repo.setparents(repo['.'].node(), nullid)