diff hgext/strip.py @ 27030:cf9ed6d32ccb

strip: changing bookmark argument to be a list Currently strip works with a single bookmark, the changes in this patch modifies the strip extension to accept a list of bookmarks
author Shubhanshu Agrawal <agrawal.shubhanshu@gmail.com>
date Thu, 19 Nov 2015 12:50:10 +0530
parents 8279c5d116a0
children b9d0b45df7b2
line wrap: on
line diff
--- a/hgext/strip.py	Sun Nov 15 21:03:44 2015 +0530
+++ b/hgext/strip.py	Thu Nov 19 12:50:10 2015 +0530
@@ -87,7 +87,7 @@
           ('n', '', None, _('ignored  (DEPRECATED)')),
           ('k', 'keep', None, _("do not modify working directory during "
                                 "strip")),
-          ('B', 'bookmark', '', _("remove revs only reachable from given"
+          ('B', 'bookmark', [], _("remove revs only reachable from given"
                                   " bookmark"))],
           _('hg strip [-k] [-f] [-n] [-B bookmark] [-r] REV...'))
 def stripcmd(ui, repo, *revs, **opts):
@@ -129,9 +129,7 @@
 
     wlock = repo.wlock()
     try:
-        bookmarks = None
-        if opts.get('bookmark'):
-            bookmarks = set([opts.get('bookmark')])
+        bookmarks = set(opts.get('bookmark'))
         if bookmarks:
             repomarks = repo._bookmarks
             if not bookmarks.issubset(repomarks):
@@ -146,8 +144,8 @@
                 nodetobookmarks.setdefault(node, []).append(mark)
             for marks in nodetobookmarks.values():
                 if bookmarks.issuperset(marks):
-                   rsrevs = repair.stripbmrevset(repo, marks[0])
-                   revs.update(set(rsrevs))
+                    rsrevs = repair.stripbmrevset(repo, marks[0])
+                    revs.update(set(rsrevs))
             if not revs:
                 for bookmark in bookmarks:
                     del repomarks[bookmark]