Patchwork [3,of,3,evolve-ext] evolve: changing bookmark argument to be a list

login
register
mail settings
Submitter Shubhanshu Agrawal
Date Dec. 11, 2015, 2:06 a.m.
Message ID <fa761be2e12d0e5b94ab.1449799593@shubhanshu-mbp.dhcp.thefacebook.com>
Download mbox | patch
Permalink /patch/11969/
State Changes Requested
Headers show

Comments

Shubhanshu Agrawal - Dec. 11, 2015, 2:06 a.m.
# HG changeset patch
# User Shubhanshu Agrawal <agrawal.shubhanshu@gmail.com>
# Date 1449799356 28800
#      Thu Dec 10 18:02:36 2015 -0800
# Node ID fa761be2e12d0e5b94abc6d19a80a8ac37fd1ec8
# Parent  2d2e9c7f56088f0ab07c09469e0cbca735381bbe
evolve: changing bookmark argument to be a list

Currently prune works with a single bookmark
the changes in this patch modifies the prune
command to accept a list of bookmarks
Pierre-Yves David - Dec. 11, 2015, 11:34 a.m.
On 12/11/2015 02:06 AM, Shubhanshu Agrawal wrote:
> # HG changeset patch
> # User Shubhanshu Agrawal <agrawal.shubhanshu@gmail.com>
> # Date 1449799356 28800
> #      Thu Dec 10 18:02:36 2015 -0800
> # Node ID fa761be2e12d0e5b94abc6d19a80a8ac37fd1ec8
> # Parent  2d2e9c7f56088f0ab07c09469e0cbca735381bbe
> evolve: changing bookmark argument to be a list

I've pushed patch 1, but the two other fails tests. can you look at this 
and send a V2?

Failing test are:

test-prune.t (with patch 2-3)
test-inhibit.t (with patch 3)

(also, you probably mean "prune:" in the title here)

Patch

diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -2268,7 +2268,7 @@ 
         _("record a fold (multiple precursors, one successors)")),
      ('', 'split', False,
         _("record a split (on precursor, multiple successors)")),
-     ('B', 'bookmark', '', _("remove revs only reachable from given"
+     ('B', 'bookmark', [], _("remove revs only reachable from given"
                              " bookmark"))] + metadataopts,
     _('[OPTION] [-r] REV...'))
     # -U  --noupdate option to prevent wc update and or bookmarks update ?
@@ -2297,9 +2297,7 @@ 
     """
     revs = scmutil.revrange(repo, list(revs) + opts.get('rev'))
     succs = opts['new'] + opts['succ']
-    bookmarks = None
-    if opts.get('bookmark'):
-        bookmarks = set([opts.get('bookmark')])
+    bookmarks = set(opts.get('bookmark'))
     metadata = _getmetadata(**opts)
     biject = opts.get('biject')
     fold = opts.get('fold')
diff --git a/tests/test-evolve.t b/tests/test-evolve.t
--- a/tests/test-evolve.t
+++ b/tests/test-evolve.t
@@ -170,6 +170,48 @@ 
 
   $ cd ..
 
+Prune bookmarks test
+
+  $ hg init bookmark-test
+  $ cd bookmark-test
+  $ hg debugbuilddag '..:a<2:m.:b<m.:c<m.:d'
+  $ hg bookmark -r 'a' 'multipledelete1'
+  $ hg bookmark -r 'b' 'multipledelete2'
+  $ hg bookmark -r 'c' 'singlenode1'
+  $ hg bookmark -r 'c' 'singlenode2'
+  $ hg bookmark -r 'd' 'delete'
+  $ hg bookmarks
+     delete                    4:e7bd5218ca15
+     multipledelete1           1:66f7d451a68b
+     multipledelete2           2:fa942426a6fd
+     singlenode1               3:6100d3090acf
+     singlenode2               3:6100d3090acf
+  $ hg prune -B multipledelete1 -B multipledelete2
+  bookmark 'multipledelete1' deleted
+  bookmark 'multipledelete2' deleted
+  2 changesets pruned
+  $ hg id -ir 66f7d451a68b
+  66f7d451a68b
+  $ hg id -ir fa942426a6fd
+  fa942426a6fd
+  $ hg prune -B singlenode1 -B singlenode2
+  bookmark 'singlenode1' deleted
+  bookmark 'singlenode2' deleted
+  1 changesets pruned
+  $ hg id -ir 6100d3090acf
+  6100d3090acf
+  $ hg prune -B unknownbookmark
+  abort: bookmark 'unknownbookmark' not found
+  [255]
+  $ hg prune -B unknownbookmark1 -B unknownbookmark2
+  abort: bookmark 'unknownbookmark1,unknownbookmark2' not found
+  [255]
+  $ hg prune -B delete -B unknownbookmark
+  abort: bookmark 'unknownbookmark' not found
+  [255]
+
+  $ cd ..
+
 ##########################
 importing Parren test
 ##########################