[PATCH] scmutil: move repair.stripbmrevset as scmutil.bookmarkrevs

David Demelier markand at malikania.fr
Wed May 23 08:48:58 UTC 2018


# HG changeset patch
# User David Demelier <markand at malikania.fr>
# Date 1526387741 -7200
#      Tue May 15 14:35:41 2018 +0200
# Node ID 7f4a064834b8647f2986305cc5d8c0f5376e2340
# Parent  37ef6ee87488ac0095f8dedf75284f64d1d54455
scmutil: move repair.stripbmrevset as scmutil.bookmarkrevs

diff -r 37ef6ee87488 -r 7f4a064834b8 hgext/patchbomb.py
--- a/hgext/patchbomb.py	Sun May 13 11:09:53 2018 +0900
+++ b/hgext/patchbomb.py	Tue May 15 14:35:41 2018 +0200
@@ -94,7 +94,6 @@
     patch,
     pycompat,
     registrar,
-    repair,
     scmutil,
     templater,
     util,
@@ -624,7 +623,7 @@
     elif bookmark:
         if bookmark not in repo._bookmarks:
             raise error.Abort(_("bookmark '%s' not found") % bookmark)
-        revs = repair.stripbmrevset(repo, bookmark)
+        revs = scmutil.bookmarkrevs(repo, bookmark)
 
     revs = scmutil.revrange(repo, revs)
     if outgoing:
diff -r 37ef6ee87488 -r 7f4a064834b8 hgext/strip.py
--- a/hgext/strip.py	Sun May 13 11:09:53 2018 +0900
+++ b/hgext/strip.py	Tue May 15 14:35:41 2018 +0200
@@ -165,7 +165,7 @@
                 nodetobookmarks.setdefault(node, []).append(mark)
             for marks in nodetobookmarks.values():
                 if bookmarks.issuperset(marks):
-                    rsrevs = repair.stripbmrevset(repo, marks[0])
+                    rsrevs = scmutil.bookmarkrevs(repo, marks[0])
                     revs.update(set(rsrevs))
             if not revs:
                 with repo.lock(), repo.transaction('bookmark') as tr:
diff -r 37ef6ee87488 -r 7f4a064834b8 mercurial/commands.py
--- a/mercurial/commands.py	Sun May 13 11:09:53 2018 +0900
+++ b/mercurial/commands.py	Tue May 15 14:35:41 2018 +0200
@@ -50,7 +50,6 @@
     pycompat,
     rcutil,
     registrar,
-    repair,
     revsetlang,
     rewriteutil,
     scmutil,
@@ -1982,7 +1981,7 @@
         if bookmark not in repo._bookmarks:
             raise error.Abort(_("bookmark '%s' not found") % bookmark)
 
-        revs = repair.stripbmrevset(repo, bookmark)
+        revs = scmutil.bookmarkrevs(repo, bookmark)
     else:
         if not changesets:
             changesets = ['.']
diff -r 37ef6ee87488 -r 7f4a064834b8 mercurial/repair.py
--- a/mercurial/repair.py	Sun May 13 11:09:53 2018 +0900
+++ b/mercurial/repair.py	Tue May 15 14:35:41 2018 +0200
@@ -405,18 +405,6 @@
         else:
             ui.write(_('fncache already up to date\n'))
 
-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)
-
 def deleteobsmarkers(obsstore, indices):
     """Delete some obsmarkers from obsstore and return how many were deleted
 
diff -r 37ef6ee87488 -r 7f4a064834b8 mercurial/scmutil.py
--- a/mercurial/scmutil.py	Sun May 13 11:09:53 2018 +0900
+++ b/mercurial/scmutil.py	Tue May 15 14:35:41 2018 +0200
@@ -1585,3 +1585,13 @@
                 revs.add(rev)
 
     return revs
+
+def bookmarkrevs(repo, mark):
+    """
+    Select revisions reachable by a given bookmark"
+    """
+    return repo.revs("ancestors(bookmark(%s)) - "
+                     "ancestors(head() and not bookmark(%s)) - "
+                     "ancestors(bookmark() and not bookmark(%s))",
+                     mark, mark, mark)
+


More information about the Mercurial-devel mailing list