--- a/hgext/evolve.py Mon Sep 14 13:52:34 2015 -0700
+++ b/hgext/evolve.py Wed Sep 16 17:12:38 2015 -0700
@@ -805,74 +805,75 @@
nodeid was actually created. If created is False, nodeid
references a changeset existing before the rewrite call.
"""
- if len(old.parents()) > 1: #XXX remove this unecessary limitation.
- raise error.Abort(_('cannot amend merge changesets'))
- base = old.p1()
- updatebookmarks = _bookmarksupdater(repo, old.node())
-
- # commit a new version of the old changeset, including the update
- # collect all files which might be affected
- files = set(old.files())
- for u in updates:
- files.update(u.files())
-
- # Recompute copies (avoid recording a -> b -> a)
- copied = copies.pathcopies(base, head)
-
-
- # prune files which were reverted by the updates
- def samefile(f):
- if f in head.manifest():
- a = head.filectx(f)
- if f in base.manifest():
- b = base.filectx(f)
- return (a.data() == b.data()
- and a.flags() == b.flags())
+ if True:
+ if len(old.parents()) > 1: #XXX remove this unecessary limitation.
+ raise error.Abort(_('cannot amend merge changesets'))
+ base = old.p1()
+ updatebookmarks = _bookmarksupdater(repo, old.node())
+
+ # commit a new version of the old changeset, including the update
+ # collect all files which might be affected
+ files = set(old.files())
+ for u in updates:
+ files.update(u.files())
+
+ # Recompute copies (avoid recording a -> b -> a)
+ copied = copies.pathcopies(base, head)
+
+
+ # prune files which were reverted by the updates
+ def samefile(f):
+ if f in head.manifest():
+ a = head.filectx(f)
+ if f in base.manifest():
+ b = base.filectx(f)
+ return (a.data() == b.data()
+ and a.flags() == b.flags())
+ else:
+ return False
else:
- return False
- else:
- return f not in base.manifest()
- files = [f for f in files if not samefile(f)]
- # commit version of these files as defined by head
- headmf = head.manifest()
- def filectxfn(repo, ctx, path):
- if path in headmf:
- fctx = head[path]
- flags = fctx.flags()
- mctx = memfilectx(repo, fctx.path(), fctx.data(),
- islink='l' in flags,
- isexec='x' in flags,
- copied=copied.get(path))
- return mctx
- return None
-
- message = cmdutil.logmessage(repo.ui, commitopts)
- if not message:
- message = old.description()
-
- user = commitopts.get('user') or old.user()
- date = commitopts.get('date') or None # old.date()
- extra = dict(commitopts.get('extra', {}))
- extra['branch'] = head.branch()
-
- new = context.memctx(repo,
- parents=newbases,
- text=message,
- files=files,
- filectxfn=filectxfn,
- user=user,
- date=date,
- extra=extra)
-
- if commitopts.get('edit'):
- new._text = cmdutil.commitforceeditor(repo, new, [])
- revcount = len(repo)
- newid = repo.commitctx(new)
- new = repo[newid]
- created = len(repo) != revcount
- updatebookmarks(newid)
-
- return newid, created
+ return f not in base.manifest()
+ files = [f for f in files if not samefile(f)]
+ # commit version of these files as defined by head
+ headmf = head.manifest()
+ def filectxfn(repo, ctx, path):
+ if path in headmf:
+ fctx = head[path]
+ flags = fctx.flags()
+ mctx = memfilectx(repo, fctx.path(), fctx.data(),
+ islink='l' in flags,
+ isexec='x' in flags,
+ copied=copied.get(path))
+ return mctx
+ return None
+
+ message = cmdutil.logmessage(repo.ui, commitopts)
+ if not message:
+ message = old.description()
+
+ user = commitopts.get('user') or old.user()
+ date = commitopts.get('date') or None # old.date()
+ extra = dict(commitopts.get('extra', {}))
+ extra['branch'] = head.branch()
+
+ new = context.memctx(repo,
+ parents=newbases,
+ text=message,
+ files=files,
+ filectxfn=filectxfn,
+ user=user,
+ date=date,
+ extra=extra)
+
+ if commitopts.get('edit'):
+ new._text = cmdutil.commitforceeditor(repo, new, [])
+ revcount = len(repo)
+ newid = repo.commitctx(new)
+ new = repo[newid]
+ created = len(repo) != revcount
+ updatebookmarks(newid)
+
+ return newid, created
class MergeFailure(util.Abort):
pass