prune: detect bad input
We accept multiple changeset folded into one successors. One changesets split in
multiple successors. But we refuse multiple changesets split in multiple ones.
--- a/hgext/evolve.py Mon Feb 04 17:55:03 2013 +0100
+++ b/hgext/evolve.py Mon Feb 04 18:07:09 2013 +0100
@@ -1259,19 +1259,24 @@
wlock = repo.wlock()
try:
lock = repo.lock()
- new = set(scmutil.revrange(repo, succs))
- targetnodes = set(scmutil.revrange(repo, revs))
- if not targetnodes:
+ precs = []
+ for p in sorted(set(scmutil.revrange(repo, revs))):
+ cp = repo[p]
+ precs.append(cp)
+ if not precs:
raise util.Abort('nothing to prune')
- if new:
- sucs = tuple(repo[n] for n in new)
else:
sucs = ()
+
+ sucs = tuple(repo[n]
+ for n in sorted(set(scmutil.revrange(repo, succs))))
+ if len(sucs) > 1 and len(precs) > 1:
+ msg = "Can't use multiple successors for multiple precursors"
+ raise util.Abort(msg)
markers = []
- for n in targetnodes:
- markers.append((repo[n], sucs))
+ for p in precs:
+ markers.append((p, sucs))
createmarkers(repo, markers)
-
# update to an unkilled parent
wdp = repo['.']
newnode = wdp