Patchwork [3,of,3] strip: changing bookmark argument to be a list

login
register
mail settings
Submitter Shubhanshu Agrawal
Date Nov. 16, 2015, 8:05 p.m.
Message ID <7b25c4165a42e38d2bb7.1447704302@shubhanshu-mbp.local>
Download mbox | patch
Permalink /patch/11475/
State Superseded
Headers show

Comments

Shubhanshu Agrawal - Nov. 16, 2015, 8:05 p.m.
# HG changeset patch
# User Shubhanshu Agrawal <agrawal.shubhanshu@gmail.com>
# Date 1447603596 -19800
#      Sun Nov 15 21:36:36 2015 +0530
# Node ID 7b25c4165a42e38d2bb7f1549c9e899de49beaaf
# Parent  bf69fb14d9bc27092c45899218589e372b396011
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

Patch

diff -r bf69fb14d9bc -r 7b25c4165a42 hgext/strip.py
--- a/hgext/strip.py	Sun Nov 15 21:03:44 2015 +0530
+++ b/hgext/strip.py	Sun Nov 15 21:36:36 2015 +0530
@@ -87,8 +87,8 @@ 
           ('n', '', None, _('ignored  (DEPRECATED)')),
           ('k', 'keep', None, _("do not modify working directory during "
                                 "strip")),
-          ('B', 'bookmark', '', _("remove revs only reachable from given"
-                                  " bookmark"))],
+          ('B', 'bookmark', [], _("remove revs only reachable from given"
+                                  " bookmark"), 'list')],
           _('hg strip [-k] [-f] [-n] [-B bookmark] [-r] REV...'))
 def stripcmd(ui, repo, *revs, **opts):
     """strip changesets and all their descendants from the repository
@@ -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):
diff -r bf69fb14d9bc -r 7b25c4165a42 tests/test-strip.t
--- a/tests/test-strip.t	Sun Nov 15 21:03:44 2015 +0530
+++ b/tests/test-strip.t	Sun Nov 15 21:36:36 2015 +0530
@@ -573,11 +573,15 @@ 
   $ cd ..
   $ hg init bookmarks
   $ cd bookmarks
-  $ hg debugbuilddag '..<2.*1/2:m<2+3:c<m+3:a<2.:b'
+  $ hg debugbuilddag '..<2.*1/2:m<2+3:c<m+3:a<2.:b<m+2:d<2.:e<m+1:f'
   $ hg bookmark -r 'a' 'todelete'
   $ hg bookmark -r 'b' 'B'
   $ hg bookmark -r 'b' 'nostrip'
   $ hg bookmark -r 'c' 'delete'
+  $ hg bookmark -r 'd' 'multipledelete1'
+  $ hg bookmark -r 'e' 'multipledelete2'
+  $ hg bookmark -r 'f' 'singlenode1'
+  $ hg bookmark -r 'f' 'singlenode2'
   $ hg up -C todelete
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (activating bookmark todelete)
@@ -597,6 +601,27 @@ 
   $ hg bookmarks
      B                         9:ff43616e5d0f
      delete                    6:2702dd0c91e7
+     multipledelete1           11:e46a4836065c
+     multipledelete2           12:b4594d867745
+     singlenode1               13:43227190fef8
+     singlenode2               13:43227190fef8
+  $ hg strip -B multipledelete1 -B multipledelete2
+  saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/e46a4836065c-89ec65c2-backup.hg (glob)
+  bookmark 'multipledelete2' deleted
+  bookmark 'multipledelete1' deleted
+  $ hg id -ir e46a4836065c
+  abort: unknown revision 'e46a4836065c'!
+  [255]
+  $ hg id -ir b4594d867745
+  abort: unknown revision 'b4594d867745'!
+  [255]
+  $ hg strip -B singlenode1 -B singlenode2
+  saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/43227190fef8-8da858f2-backup.hg (glob)
+  bookmark 'singlenode1' deleted
+  bookmark 'singlenode2' deleted
+  $ hg id -ir 43227190fef8
+  abort: unknown revision '43227190fef8'!
+  [255]
   $ hg strip -B delete
   saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/*-backup.hg (glob)
   bookmark 'delete' deleted
@@ -626,14 +651,14 @@ 
   
   options ([+] can be repeated):
   
-   -r --rev REV [+]    strip specified revision (optional, can specify revisions
-                       without this option)
-   -f --force          force removal of changesets, discard uncommitted changes
-                       (no backup)
-      --no-backup      no backups
-   -k --keep           do not modify working directory during strip
-   -B --bookmark VALUE remove revs only reachable from given bookmark
-      --mq             operate on patch repository
+   -r --rev REV [+]       strip specified revision (optional, can specify
+                          revisions without this option)
+   -f --force             force removal of changesets, discard uncommitted
+                          changes (no backup)
+      --no-backup         no backups
+   -k --keep              do not modify working directory during strip
+   -B --bookmark list [+] remove revs only reachable from given bookmark
+      --mq                operate on patch repository
   
   (use "hg strip -h" to show more help)
   [255]