comparison hgext/evolve.py @ 1415:aaccca501ae0

evolve: drop len comparison in prune and fold Computing the length of a smartest may be significantly more expensive than computing it length.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Mon, 22 Jun 2015 15:04:54 -0700
parents 4198e2fad6ba
children ed9a8b1ee9bd
comparison
equal deleted inserted replaced
1414:4198e2fad6ba 1415:aaccca501ae0
2085 precs.append(cp) 2085 precs.append(cp)
2086 if not precs: 2086 if not precs:
2087 raise util.Abort('nothing to prune') 2087 raise util.Abort('nothing to prune')
2088 2088
2089 if not obsolete.isenabled(repo, obsolete.allowunstableopt): 2089 if not obsolete.isenabled(repo, obsolete.allowunstableopt):
2090 if len(repo.revs("(%ld::) - %ld", revs, revs)) != 0: 2090 if repo.revs("(%ld::) - %ld", revs, revs):
2091 raise util.Abort(_("cannot prune in the middle of a stack")) 2091 raise util.Abort(_("cannot prune in the middle of a stack"))
2092 2092
2093 # defines successors changesets 2093 # defines successors changesets
2094 sucs = scmutil.revrange(repo, succs) 2094 sucs = scmutil.revrange(repo, succs)
2095 sucs.sort() 2095 sucs.sort()
2581 raise util.Abort(_("cannot fold non-linear revisions " 2581 raise util.Abort(_("cannot fold non-linear revisions "
2582 "(multiple heads given)")) 2582 "(multiple heads given)"))
2583 head = repo[heads.first()] 2583 head = repo[heads.first()]
2584 disallowunstable = not obsolete.isenabled(repo, obsolete.allowunstableopt) 2584 disallowunstable = not obsolete.isenabled(repo, obsolete.allowunstableopt)
2585 if disallowunstable: 2585 if disallowunstable:
2586 if len(repo.revs("(%ld::) - %ld", revs, revs)) != 0: 2586 if repo.revs("(%ld::) - %ld", revs, revs):
2587 raise util.Abort(_("cannot fold chain not ending with a head "\ 2587 raise util.Abort(_("cannot fold chain not ending with a head "\
2588 "or with branching")) 2588 "or with branching"))
2589 wlock = lock = None 2589 wlock = lock = None
2590 try: 2590 try:
2591 wlock = repo.wlock() 2591 wlock = repo.wlock()