diff -r c3f6e97c71b1 -r 4140d680784e hgext/evolve.py --- a/hgext/evolve.py Tue Jun 30 18:32:12 2015 -0700 +++ b/hgext/evolve.py Thu Jun 25 13:33:50 2015 -0700 @@ -2137,6 +2137,8 @@ ('r', 'rev', [], _("revisions to prune")), ('k', 'keep', None, _("does not modify working copy during prune")), ('', 'biject', False, _("do a 1-1 map between rev and successor ranges")), + ('', 'fold', False, _("record a fold (multiple precursors, one successors)")), + ('', 'split', False, _("record a split (on precursor, multiple successors)")), ('B', 'bookmark', '', _("remove revs only reachable from given" " bookmark"))] + metadataopts, _('[OPTION] [-r] REV...')) @@ -2159,12 +2161,22 @@ revisions to prune and successor changesets. This option may be removed in a future release (with the functionality absorbed automatically). + If you specify multiple revisions in --succ, you are recording a "split" + and have to acknowledge it by usng --split. The same logic apply when you + prune multiple changesets with a single successors, this will record a + "fold" requires a --fold flag. """ revs = scmutil.revrange(repo, list(revs) + opts.get('rev')) succs = opts['new'] + opts['succ'] bookmark = opts.get('bookmark') metadata = _getmetadata(**opts) biject = opts.get('biject') + fold = opts.get('fold') + split = opts.get('split') + + options = [o for o in ('biject', 'fold', 'split') if opts.get(o)] + if 1 < len(options): + raise util.Abort(_("can only specify one of %s") % ', '.join(options)) if bookmark: marks,revs = _reachablefrombookmark(repo, revs, bookmark) @@ -2204,15 +2216,20 @@ if not biject and len(sucs) > 1 and len(precs) > 1: msg = "Can't use multiple successors for multiple precursors" raise util.Abort(msg) - - if biject and len(sucs) != len(precs): + elif biject and len(sucs) != len(precs): msg = "Can't use %d successors for %d precursors" \ % (len(sucs), len(precs)) raise util.Abort(msg) - - relations = [(p, sucs) for p in precs] - if biject: + elif (len(precs) == 1 and len(sucs) > 1) and not split: + msg = "please add --split if you want to do a split" + raise util.Abort(msg) + elif len(sucs) == 1 and len(precs) > 1 and not fold: + msg = "please add --fold if you want to do a fold" + raise util.Abort(msg) + elif biject: relations = [(p, (s,)) for p, s in zip(precs, sucs)] + else: + relations = [(p, sucs) for p in precs] wdp = repo['.']