Mercurial > public > mercurial-scm > hg-stable
diff hgext/transplant.py @ 16507:1f020021adfa stable
transplant: do not rollback on patching error (issue3379)
Otherwise, all transplanted revisions are gone and the failing one cannot be
fixed (unless it is the first one).
I do not know what is the expected behaviour with rollback, probably something
pull-like. Non-conflicting cases should work as previously. But something like:
$ hg transplant r1 r2
commiting r1 as c1
failing r2
$ hg transplant --continue
committing r2 as c2
$ hg rollback
would reset the repository to its state before the "transplant --continue"
instead of the whole transplant session. To fix this we might need a way to
open an existing journal file, not sure this is worth the pain.
author | Patrick Mezard <patrick@mezard.eu> |
---|---|
date | Sun, 22 Apr 2012 16:40:38 +0200 |
parents | 91196ebcaeed |
children | ebf6d38c9063 |
line wrap: on
line diff
--- a/hgext/transplant.py Sat Apr 21 21:40:25 2012 +0200 +++ b/hgext/transplant.py Sun Apr 22 16:40:38 2012 +0200 @@ -20,6 +20,9 @@ from mercurial import patch, revlog, scmutil, util, error, cmdutil from mercurial import revset, templatekw +class TransplantError(error.Abort): + pass + cmdtable = {} command = cmdutil.command(cmdtable) @@ -171,11 +174,17 @@ del revmap[rev] if patchfile or domerge: try: - n = self.applyone(repo, node, - source.changelog.read(node), - patchfile, merge=domerge, - log=opts.get('log'), - filter=opts.get('filter')) + try: + n = self.applyone(repo, node, + source.changelog.read(node), + patchfile, merge=domerge, + log=opts.get('log'), + filter=opts.get('filter')) + except TransplantError: + # Do not rollback, it is up to the user to + # fix the merge or cancel everything + tr.close() + raise if n and domerge: self.ui.status(_('%s merged at %s\n') % (revstr, short(n))) @@ -259,8 +268,8 @@ p2 = node self.log(user, date, message, p1, p2, merge=merge) self.ui.write(str(inst) + '\n') - raise util.Abort(_('fix up the merge and run ' - 'hg transplant --continue')) + raise TransplantError(_('fix up the merge and run ' + 'hg transplant --continue')) else: files = None if merge: