Mercurial > hg
changeset 37199:c5687ce3b411
infinitepush: drop the `--to` flag to push and use `-B` instead
The extension added a `--to` flag to specify the bookmark to which revs should
be pushed. This patch deletes that flag and instead uses the `-B` flag. After
this patch, bookmark passed as `-B` is parsed and if it matches the infinitepush
bookmark pattern, we consider that push as infinitepush.
This is still not the best of what we can do. Later patches in the series will
drop the use of `-B` flag and will instead handle things at bookmark bundle2
part. Plugging these logic to bookmark bundle2 part will also get rid of the
scratchbranchparttype bundle2 part.
Differential Revision: https://phab.mercurial-scm.org/D2108
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Fri, 09 Feb 2018 15:49:46 +0530 |
parents | 78c2e9418278 |
children | 8b5d7ef81066 |
files | hgext/infinitepush/__init__.py tests/test-infinitepush-bundlestore.t tests/test-infinitepush.t |
diffstat | 3 files changed, 22 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/infinitepush/__init__.py Fri Feb 09 14:16:03 2018 +0530 +++ b/hgext/infinitepush/__init__.py Fri Feb 09 15:49:46 2018 +0530 @@ -315,9 +315,6 @@ def clientextsetup(ui): entry = extensions.wrapcommand(commands.table, 'push', _push) - # Don't add the 'to' arg if it already exists - if not any(a for a in entry[1] if a[1] == 'to'): - entry[1].append(('', 'to', '', _('push revs to this bookmark'))) if not any(a for a in entry[1] if a[1] == 'non-forward-move'): entry[1].append(('', 'non-forward-move', None, @@ -743,7 +740,13 @@ return common, True, remoteheads def _push(orig, ui, repo, dest=None, *args, **opts): - bookmark = opts.get('to') or '' + + bookmark = opts.get('bookmark') + # we only support pushing one infinitepush bookmark at once + if len(bookmark) == 1: + bookmark = bookmark[0] + else: + bookmark = '' oldphasemove = None overrides = {(experimental, configbookmark): bookmark} @@ -759,6 +762,9 @@ ui.setconfig(experimental, confignonforwardmove, opts.get('non_forward_move'), '--non-forward-move') if scratchpush: + # this is an infinitepush, we don't want the bookmark to be applied + # rather that should be stored in the bundlestore + opts['bookmark'] = [] ui.setconfig(experimental, configscratchpush, True) oldphasemove = extensions.wrapfunction(exchange, '_localphasemove',
--- a/tests/test-infinitepush-bundlestore.t Fri Feb 09 14:16:03 2018 +0530 +++ b/tests/test-infinitepush-bundlestore.t Fri Feb 09 15:49:46 2018 +0530 @@ -26,7 +26,7 @@ remote: adding file changes remote: added 1 changesets with 1 changes to 1 files $ mkcommit scratchcommit - $ hg push -r . --to scratch/mybranch + $ hg push -r . -B scratch/mybranch pushing to ssh://user@dummy/repo searching for changes remote: pushing 1 commit: @@ -119,7 +119,7 @@ $ cd ../client2 $ hg up -q scratch/mybranch $ mkcommit 'new scratch commit' - $ hg push -r . --to scratch/mybranch + $ hg push -r . -B scratch/mybranch pushing to ssh://user@dummy/repo searching for changes remote: pushing 2 commits: @@ -140,7 +140,7 @@ scratch/mybranch 1de1d7d92f8965260391d0513fe8a8d5973d3042 Push scratch bookmark with no new revs - $ hg push -r . --to scratch/anotherbranch + $ hg push -r . -B scratch/anotherbranch pushing to ssh://user@dummy/repo searching for changes remote: pushing 2 commits: @@ -216,7 +216,7 @@ Test with pushrebase $ mkcommit scratchcommitwithpushrebase - $ hg push -r . --to scratch/mybranch + $ hg push -r . -B scratch/mybranch pushing to ssh://user@dummy/repo searching for changes remote: pushing 4 commits: @@ -237,7 +237,7 @@ Change the order of pushrebase and infinitepush $ mkcommit scratchcommitwithpushrebase2 - $ hg push -r . --to scratch/mybranch + $ hg push -r . -B scratch/mybranch pushing to ssh://user@dummy/repo searching for changes remote: pushing 5 commits: @@ -300,7 +300,7 @@ $ scratchbookmarks scratch/anotherbranch 1de1d7d92f8965260391d0513fe8a8d5973d3042 scratch/mybranch 6c10d49fe92751666c40263f96721b918170d3da - $ hg push -r . --to scratch/mybranch + $ hg push -r . -B scratch/mybranch pushing to ssh://user@dummy/repo searching for changes remote: non-forward push @@ -308,7 +308,7 @@ abort: push failed on remote [255] - $ hg push -r . --to scratch/mybranch --non-forward-move + $ hg push -r . -B scratch/mybranch --non-forward-move pushing to ssh://user@dummy/repo searching for changes remote: pushing 5 commits:
--- a/tests/test-infinitepush.t Fri Feb 09 14:16:03 2018 +0530 +++ b/tests/test-infinitepush.t Fri Feb 09 15:49:46 2018 +0530 @@ -49,7 +49,7 @@ $ hg ci -Am "scratchfirstpart" adding scratchfirstpart created new head - $ hg push -r . --to scratch/firstpart + $ hg push -r . -B scratch/firstpart pushing to ssh://user@dummy/repo searching for changes remote: pushing 1 commit: @@ -60,7 +60,7 @@ $ hg ci -Am "scratchsecondpart" adding scratchsecondpart created new head - $ hg push -r . --to scratch/secondpart + $ hg push -r . -B scratch/secondpart pushing to ssh://user@dummy/repo searching for changes remote: pushing 1 commit: @@ -96,7 +96,7 @@ $ hg log -r '.' -T '{node}\n' > ../testpullbycommithash1 $ echo testpullbycommithash2 > testpullbycommithash2 $ hg ci -Aqm "testpullbycommithash2" - $ hg push -r . --to scratch/mybranch -q + $ hg push -r . -B scratch/mybranch -q Create third client and pull by commit hash. Make sure testpullbycommithash2 has not fetched @@ -144,7 +144,7 @@ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ echo scratchontopofpublic > scratchontopofpublic $ hg ci -Aqm "scratchontopofpublic" - $ hg push -r . --to scratch/scratchontopofpublic + $ hg push -r . -B scratch/scratchontopofpublic pushing to ssh://user@dummy/repo searching for changes remote: pushing 1 commit: @@ -300,7 +300,7 @@ $ hg ci -Aqm "tofillmetadata" $ hg log -r . -T '{node}\n' d2b0410d4da084bc534b1d90df0de9eb21583496 - $ hg push -r . --to scratch/fillmetadata/fill + $ hg push -r . -B scratch/fillmetadata/fill pushing to ssh://user@dummy/repo searching for changes remote: pushing 6 commits: