prune: reuse revset from repair instead of copy-pasting code
authorRyan McElroy <rmcelroy@fb.com>
Fri, 09 Oct 2015 16:21:30 -0700
changeset 1513 4f7e0e0318a5
parent 1512 c40108ae8fb0
child 1514 324cd13838f1
prune: reuse revset from repair instead of copy-pasting code
hgext/evolve.py
--- a/hgext/evolve.py	Mon Oct 12 01:23:59 2015 -0700
+++ b/hgext/evolve.py	Fri Oct 09 16:21:30 2015 -0700
@@ -71,6 +71,7 @@
 
 import mercurial
 from mercurial import util
+from mercurial import repair
 
 try:
     from mercurial import obsolete
@@ -2147,11 +2148,14 @@
             uniquebm = False
             break
     if uniquebm:
-        rsrevs = repo.revs("ancestors(bookmark(%s)) - "
-                           "ancestors(head() and not bookmark(%s)) - "
-                           "ancestors(bookmark() and not bookmark(%s)) - "
-                           "obsolete()",
-                           mark, mark, mark)
+        if util.safehasattr(repair, 'stripbmrevset'):
+            rsrevs = repair.stripbmrevset(repo, mark)
+        else:
+            rsrevs = repo.revs("ancestors(bookmark(%s)) - "
+                               "ancestors(head() and not bookmark(%s)) - "
+                               "ancestors(bookmark() and not bookmark(%s)) - "
+                               "obsolete()",
+                               mark, mark, mark)
         revs = set(revs)
         revs.update(set(rsrevs))
         revs = sorted(revs)