Mercurial > evolve
comparison hgext/evolve.py @ 1134:7173c70ab2c3
prune: stop reinjecting all selected revisions back into the revrange
This trigger quadratic complexity for no good reason.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Mon, 20 Oct 2014 15:59:34 -0700 |
parents | 7a1784a1c642 |
children | db16c4ad15d0 |
comparison
equal
deleted
inserted
replaced
1133:8b3b0549a4b6 | 1134:7173c70ab2c3 |
---|---|
1702 You can use the ``--biject`` option to specify a 1-1 (bijection) between | 1702 You can use the ``--biject`` option to specify a 1-1 (bijection) between |
1703 revisions to prune and successor changesets. This option may be removed in | 1703 revisions to prune and successor changesets. This option may be removed in |
1704 a future release (with the functionality absorbed automatically). | 1704 a future release (with the functionality absorbed automatically). |
1705 | 1705 |
1706 """ | 1706 """ |
1707 revs = set(scmutil.revrange(repo, list(revs) + opts.get('rev'))) | 1707 revs = scmutil.revrange(repo, list(revs) + opts.get('rev')) |
1708 succs = opts['new'] + opts['succ'] | 1708 succs = opts['new'] + opts['succ'] |
1709 bookmark = opts.get('bookmark') | 1709 bookmark = opts.get('bookmark') |
1710 metadata = _getmetadata(**opts) | 1710 metadata = _getmetadata(**opts) |
1711 biject = opts.get('biject') | 1711 biject = opts.get('biject') |
1712 | 1712 |
1720 raise util.Abort(_('nothing to prune')) | 1720 raise util.Abort(_('nothing to prune')) |
1721 | 1721 |
1722 wlock = lock = None | 1722 wlock = lock = None |
1723 try: | 1723 try: |
1724 wlock = repo.wlock() | 1724 wlock = repo.wlock() |
1725 sortedrevs = lambda specs: sorted(set(scmutil.revrange(repo, specs))) | |
1726 lock = repo.lock() | 1725 lock = repo.lock() |
1727 # defines pruned changesets | 1726 # defines pruned changesets |
1728 precs = [] | 1727 precs = [] |
1729 for p in sortedrevs(revs): | 1728 revs.sort() |
1729 for p in revs: | |
1730 cp = repo[p] | 1730 cp = repo[p] |
1731 if not cp.mutable(): | 1731 if not cp.mutable(): |
1732 # note: createmarkers() would have raised something anyway | 1732 # note: createmarkers() would have raised something anyway |
1733 raise util.Abort('cannot prune immutable changeset: %s' % cp, | 1733 raise util.Abort('cannot prune immutable changeset: %s' % cp, |
1734 hint='see "hg help phases" for details') | 1734 hint='see "hg help phases" for details') |
1735 precs.append(cp) | 1735 precs.append(cp) |
1736 if not precs: | 1736 if not precs: |
1737 raise util.Abort('nothing to prune') | 1737 raise util.Abort('nothing to prune') |
1738 | 1738 |
1739 # defines successors changesets | 1739 # defines successors changesets |
1740 sucs = tuple(repo[n] for n in sortedrevs(succs)) | 1740 sucs = tuple(repo[n] for n in scmutil.revrange(repo, succs)) |
1741 if not biject and len(sucs) > 1 and len(precs) > 1: | 1741 if not biject and len(sucs) > 1 and len(precs) > 1: |
1742 msg = "Can't use multiple successors for multiple precursors" | 1742 msg = "Can't use multiple successors for multiple precursors" |
1743 raise util.Abort(msg) | 1743 raise util.Abort(msg) |
1744 | 1744 |
1745 if biject and len(sucs) != len(precs): | 1745 if biject and len(sucs) != len(precs): |