changeset 26624:bcace0fbb4c8

strip: factor out revset calculation for strip -B This will allow reusing it in evolve and overriding it in other extensions.
author Ryan McElroy <rmcelroy@fb.com>
date Fri, 09 Oct 2015 14:48:59 -0700
parents 5a95fe44121d
children adae8928fe09
files hgext/strip.py mercurial/repair.py
diffstat 2 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/strip.py	Fri Oct 09 11:22:01 2015 -0700
+++ b/hgext/strip.py	Fri Oct 09 14:48:59 2015 -0700
@@ -142,10 +142,7 @@
                     uniquebm = False
                     break
             if uniquebm:
-                rsrevs = repo.revs("ancestors(bookmark(%s)) - "
-                                   "ancestors(head() and not bookmark(%s)) - "
-                                   "ancestors(bookmark() and not bookmark(%s))",
-                                   mark, mark, mark)
+                rsrevs = repair.stripbmrevset(repo, mark)
                 revs.update(set(rsrevs))
             if not revs:
                 del marks[mark]
--- a/mercurial/repair.py	Fri Oct 09 11:22:01 2015 -0700
+++ b/mercurial/repair.py	Fri Oct 09 14:48:59 2015 -0700
@@ -299,3 +299,15 @@
     finally:
         lock.release()
 
+def stripbmrevset(repo, mark):
+    """
+    The revset to strip when strip is called with -B mark
+
+    Needs to live here so extensions can use it and wrap it even when strip is
+    not enabled or not present on a box.
+    """
+    return repo.revs("ancestors(bookmark(%s)) - "
+                     "ancestors(head() and not bookmark(%s)) - "
+                     "ancestors(bookmark() and not bookmark(%s))",
+                     mark, mark, mark)
+