Commits

Pierre-Yves David committed 19a1a8f

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.

Comments (0)

Files changed (1)

     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