[PATCH] strip: factor out revset calculation for strip -B
Ryan McElroy
rm at fb.com
Fri Oct 9 23:20:37 UTC 2015
# HG changeset patch
# User Ryan McElroy <rmcelroy at fb.com>
# Date 1444427339 25200
# Fri Oct 09 14:48:59 2015 -0700
# Node ID 34e4ead82b70ffeb4458ae38aa3ad749026378c3
# Parent b80b2ee71a08d00ec4008f3131bdf3c72e4ec2ba
strip: factor out revset calculation for strip -B
This will allow reusing it in evolve and overriding it in other extensions.
diff --git a/hgext/strip.py b/hgext/strip.py
--- a/hgext/strip.py
+++ b/hgext/strip.py
@@ -72,6 +72,12 @@ def strip(ui, repo, revs, update=True, b
finally:
release(lock, wlock)
+def stripbmrevset(repo, mark):
+ """The revset to strip when called with -B mark"""
+ return repo.revs("ancestors(bookmark(%s)) - "
+ "ancestors(head() and not bookmark(%s)) - "
+ "ancestors(bookmark() and not bookmark(%s))",
+ mark, mark, mark)
@command("strip",
[
@@ -142,10 +148,7 @@ def stripcmd(ui, repo, *revs, **opts):
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 = stripbmrevset(repo, mark)
revs.update(set(rsrevs))
if not revs:
del marks[mark]
More information about the Mercurial-devel
mailing list