comparison hgext/evolve.py @ 1513:4f7e0e0318a5

prune: reuse revset from repair instead of copy-pasting code
author Ryan McElroy <rmcelroy@fb.com>
date Fri, 09 Oct 2015 16:21:30 -0700
parents c40108ae8fb0
children 324cd13838f1
comparison
equal deleted inserted replaced
1512:c40108ae8fb0 1513:4f7e0e0318a5
69 import errno 69 import errno
70 sha1re = re.compile(r'\b[0-9a-f]{6,40}\b') 70 sha1re = re.compile(r'\b[0-9a-f]{6,40}\b')
71 71
72 import mercurial 72 import mercurial
73 from mercurial import util 73 from mercurial import util
74 from mercurial import repair
74 75
75 try: 76 try:
76 from mercurial import obsolete 77 from mercurial import obsolete
77 if not obsolete._enabled: 78 if not obsolete._enabled:
78 obsolete._enabled = True 79 obsolete._enabled = True
2145 for m, n in marks.iteritems(): 2146 for m, n in marks.iteritems():
2146 if m != mark and n == repo[mark].node(): 2147 if m != mark and n == repo[mark].node():
2147 uniquebm = False 2148 uniquebm = False
2148 break 2149 break
2149 if uniquebm: 2150 if uniquebm:
2150 rsrevs = repo.revs("ancestors(bookmark(%s)) - " 2151 if util.safehasattr(repair, 'stripbmrevset'):
2151 "ancestors(head() and not bookmark(%s)) - " 2152 rsrevs = repair.stripbmrevset(repo, mark)
2152 "ancestors(bookmark() and not bookmark(%s)) - " 2153 else:
2153 "obsolete()", 2154 rsrevs = repo.revs("ancestors(bookmark(%s)) - "
2154 mark, mark, mark) 2155 "ancestors(head() and not bookmark(%s)) - "
2156 "ancestors(bookmark() and not bookmark(%s)) - "
2157 "obsolete()",
2158 mark, mark, mark)
2155 revs = set(revs) 2159 revs = set(revs)
2156 revs.update(set(rsrevs)) 2160 revs.update(set(rsrevs))
2157 revs = sorted(revs) 2161 revs = sorted(revs)
2158 return marks, revs 2162 return marks, revs
2159 2163