Mercurial > evolve
changeset 1564:42c30774e63d
prune: 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
Also changes to inhibit module which internally
calls the cmdprune function. the change is to
wrap the bookmark input into a list.
author | Shubhanshu Agrawal <agrawal.shubhanshu@gmail.com> |
---|---|
date | Fri, 11 Dec 2015 12:27:37 -0800 |
parents | 6a9f0261b181 |
children | 9590332b26c8 |
files | hgext/evolve.py hgext/inhibit.py tests/test-prune.t |
diffstat | 3 files changed, 67 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/evolve.py Fri Dec 11 10:42:46 2015 -0800 +++ b/hgext/evolve.py Fri Dec 11 12:27:37 2015 -0800 @@ -2276,7 +2276,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 ? @@ -2305,9 +2305,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')
--- a/hgext/inhibit.py Fri Dec 11 10:42:46 2015 -0800 +++ b/hgext/inhibit.py Fri Dec 11 12:27:37 2015 -0800 @@ -97,7 +97,7 @@ 'new': [], 'succ': [], 'rev': [], - 'bookmark': bookmarks[0], + 'bookmark': [bookmarks[0]], 'keep': None, 'biject': False, }
--- a/tests/test-prune.t Fri Dec 11 10:42:46 2015 -0800 +++ b/tests/test-prune.t Fri Dec 11 12:27:37 2015 -0800 @@ -279,11 +279,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) @@ -307,6 +311,27 @@ $ hg bookmarks B 10:ff43616e5d0f delete 6:2702dd0c91e7 + multipledelete1 12:e46a4836065c + multipledelete2 13:b4594d867745 + singlenode1 14:43227190fef8 + singlenode2 14:43227190fef8 + $ hg prune -B multipledelete1 -B multipledelete2 + bookmark 'multipledelete1' deleted + bookmark 'multipledelete2' deleted + 2 changesets pruned + $ hg prune -B singlenode1 -B singlenode2 + bookmark 'singlenode1' deleted + bookmark 'singlenode2' deleted + 1 changesets pruned + $ 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] $ hg prune -B delete bookmark 'delete' deleted 3 changesets pruned @@ -317,23 +342,23 @@ [255] $ hg debugobsstorestat - markers total: 4 - for known precursors: 4 + markers total: 7 + for known precursors: 7 with parents data: [04] (re) - markers with no successors: 4 + markers with no successors: 7 1 successors: 0 2 successors: 0 more than 2 successors: 0 available keys: - user: 4 - disconnected clusters: 4 - any known node: 4 + user: 7 + disconnected clusters: 7 + any known node: 7 smallest length: 1 longer length: 1 median length: 1 mean length: 1 - using parents data: 4 - any known node: 4 + using parents data: 7 + any known node: 7 smallest length: 1 longer length: 1 median length: 1 @@ -347,14 +372,22 @@ (leaving bookmark rg) $ hg bookmark r10 $ hg log -G - o 11:cd0038e05e1b[rg] (stable/draft) add rg + o 15:cd0038e05e1b[rg] (stable/draft) add rg | - | @ 10:ff43616e5d0f[B r10] (stable/draft) r10 + | x 14:43227190fef8[] (extinct/draft) r14 + | | + | | x 13:b4594d867745[] (extinct/draft) r13 + | | | + | | | x 12:e46a4836065c[] (extinct/draft) r12 + | | |/ + | | o 11:bab5d5bf48bd[] (stable/draft) r11 + | |/ + +---@ 10:ff43616e5d0f[B r10] (stable/draft) r10 + | | + o | 8:d62d843c9a01[] (stable/draft) r8 + | | + o | 7:e7d9710d9fc6[] (stable/draft) r7 |/ - o 8:d62d843c9a01[] (stable/draft) r8 - | - o 7:e7d9710d9fc6[] (stable/draft) r7 - | o 3:2b6d669947cd[] (stable/draft) r3 |\ | o 2:fa942426a6fd[] (stable/draft) r2 @@ -366,12 +399,22 @@ $ hg prune 11 1 changesets pruned $ hg log -G - @ 10:ff43616e5d0f[B r10] (stable/draft) r10 + o 15:cd0038e05e1b[rg] (stable/draft) add rg | - o 8:d62d843c9a01[rg] (stable/draft) r8 - | - o 7:e7d9710d9fc6[] (stable/draft) r7 - | + | x 14:43227190fef8[] (extinct/draft) r14 + | | + | | x 13:b4594d867745[] (extinct/draft) r13 + | | | + | | | x 12:e46a4836065c[] (extinct/draft) r12 + | | |/ + | | x 11:bab5d5bf48bd[] (extinct/draft) r11 + | |/ + +---@ 10:ff43616e5d0f[B r10] (stable/draft) r10 + | | + o | 8:d62d843c9a01[] (stable/draft) r8 + | | + o | 7:e7d9710d9fc6[] (stable/draft) r7 + |/ o 3:2b6d669947cd[] (stable/draft) r3 |\ | o 2:fa942426a6fd[] (stable/draft) r2 @@ -387,5 +430,5 @@ B 8:d62d843c9a01 * CELESTE 8:d62d843c9a01 r10 8:d62d843c9a01 - rg 8:d62d843c9a01 + rg 15:cd0038e05e1b