Mercurial > hg > mercurial-source
changeset 37984:78c2e9418278
infinitepush: drop the `--create` flag to push command
The extension added a `--create` flag for creating a new bookmark on the
bundlestore. This patch changes the bahviour to create a bookmark if it does not
exists and removes the requirement of the `--create` and then drop the logic
around the `--create` flag.
Tests are changed to drop the usage of `--create` flag.
Differential Revision: https://phab.mercurial-scm.org/D2107
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Fri, 09 Feb 2018 14:16:03 +0530 |
parents | 7fa00a6f8180 |
children | c5687ce3b411 |
files | hgext/infinitepush/__init__.py hgext/infinitepush/bundleparts.py tests/test-infinitepush-bundlestore.t tests/test-infinitepush.t |
diffstat | 4 files changed, 12 insertions(+), 31 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/infinitepush/__init__.py +++ b/hgext/infinitepush/__init__.py @@ -175,9 +175,6 @@ configitem('experimental', 'server-bundlestore-bookmark', default='', ) -configitem('experimental', 'server-bundlestore-create', - default='', -) configitem('experimental', 'infinitepush-scratchpush', default=False, ) @@ -187,7 +184,6 @@ experimental = 'experimental' configbookmark = 'server-bundlestore-bookmark' -configcreate = 'server-bundlestore-create' configscratchpush = 'infinitepush-scratchpush' confignonforwardmove = 'non-forward-move' @@ -328,10 +324,6 @@ _('allows moving a remote bookmark to an ' 'arbitrary place'))) - if not any(a for a in entry[1] if a[1] == 'create'): - entry[1].append( - ('', 'create', None, _('create a new remote bookmark'))) - entry[1].append( ('', 'bundle-store', None, _('force push to go to bundle store (EXPERIMENTAL)'))) @@ -752,11 +744,9 @@ def _push(orig, ui, repo, dest=None, *args, **opts): bookmark = opts.get('to') or '' - create = opts.get('create') or False oldphasemove = None - overrides = {(experimental, configbookmark): bookmark, - (experimental, configcreate): create} + overrides = {(experimental, configbookmark): bookmark} with ui.configoverride(overrides, 'infinitepush'): scratchpush = opts.get('bundle_store') @@ -839,7 +829,6 @@ @exchange.b2partsgenerator(scratchbranchparttype) def partgen(pushop, bundler): bookmark = pushop.ui.config(experimental, configbookmark) - create = pushop.ui.configbool(experimental, configcreate) scratchpush = pushop.ui.configbool(experimental, configscratchpush) if 'changesets' in pushop.stepsdone or not scratchpush: return @@ -865,8 +854,7 @@ pushop.outgoing, nonforwardmove, pushop.ui, - bookmark, - create) + bookmark) for scratchpart in scratchparts: bundler.addpart(scratchpart) @@ -1028,15 +1016,10 @@ bookmark = params.get('bookmark') bookprevnode = params.get('bookprevnode', '') - create = params.get('create') force = params.get('force') if bookmark: oldnode = index.getnode(bookmark) - - if not oldnode and not create: - raise error.Abort("unknown bookmark %s" % bookmark, - hint="use --create if you want to create one") else: oldnode = None bundleheads = bundle.revs('heads(bundle())') @@ -1110,7 +1093,7 @@ bundle.close() @bundle2.parthandler(scratchbranchparttype, - ('bookmark', 'bookprevnode' 'create', 'force', + ('bookmark', 'bookprevnode', 'force', 'pushbackbookmarks', 'cgversion')) def bundle2scratchbranch(op, part): '''unbundle a bundle2 part containing a changegroup to store'''
--- a/hgext/infinitepush/bundleparts.py +++ b/hgext/infinitepush/bundleparts.py @@ -23,7 +23,7 @@ scratchbranchparttype = 'b2x:infinitepush' def getscratchbranchparts(repo, peer, outgoing, confignonforwardmove, - ui, bookmark, create): + ui, bookmark): if not outgoing.missing: raise error.Abort(_('no commits to push')) @@ -49,8 +49,6 @@ params['bookprevnode'] = '' if bookmark in repo: params['bookprevnode'] = repo[bookmark].hex() - if create: - params['create'] = '1' if confignonforwardmove: params['force'] = '1'
--- a/tests/test-infinitepush-bundlestore.t +++ b/tests/test-infinitepush-bundlestore.t @@ -18,7 +18,7 @@ $ hg clone ssh://user@dummy/repo client -q $ cd client $ mkcommit initialcommit - $ hg push -r . --create + $ hg push -r . pushing to ssh://user@dummy/repo searching for changes remote: adding changesets @@ -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 --create + $ hg push -r . --to scratch/mybranch pushing to ssh://user@dummy/repo searching for changes remote: pushing 1 commit: @@ -140,7 +140,7 @@ scratch/mybranch 1de1d7d92f8965260391d0513fe8a8d5973d3042 Push scratch bookmark with no new revs - $ hg push -r . --to scratch/anotherbranch --create + $ hg push -r . --to scratch/anotherbranch pushing to ssh://user@dummy/repo searching for changes remote: pushing 2 commits:
--- a/tests/test-infinitepush.t +++ b/tests/test-infinitepush.t @@ -49,7 +49,7 @@ $ hg ci -Am "scratchfirstpart" adding scratchfirstpart created new head - $ hg push -r . --to scratch/firstpart --create + $ hg push -r . --to 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 --create + $ hg push -r . --to 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 --create -q + $ hg push -r . --to 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 --create + $ hg push -r . --to 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 --create + $ hg push -r . --to scratch/fillmetadata/fill pushing to ssh://user@dummy/repo searching for changes remote: pushing 6 commits: