Mercurial > hg-stable
changeset 37196:320b1f95f676
infinitepush: drop `--list-remote`, `--remote-path` flags to bookmark cmd
The extension adds these two flags to list remote bookmarks using the `hg
bookmark` command. These are not required in core currently and needs some
discussion before getting them in, so let's drop them for now. This makes us
deleting the wrapping of `hg bookmark` command on client side.
The end goal here is to have minimal or no wrapping at client side.
Differential Revision: https://phab.mercurial-scm.org/D2103
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Fri, 09 Feb 2018 13:36:50 +0530 |
parents | 5a9692d0d6fc |
children | 3be6f435db4f |
files | hgext/infinitepush/__init__.py tests/test-infinitepush-bundlestore.t |
diffstat | 2 files changed, 0 insertions(+), 109 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/infinitepush/__init__.py Thu Feb 08 17:27:47 2018 +0530 +++ b/hgext/infinitepush/__init__.py Fri Feb 09 13:36:50 2018 +0530 @@ -336,21 +336,6 @@ ('', 'bundle-store', None, _('force push to go to bundle store (EXPERIMENTAL)'))) - bookcmd = extensions.wrapcommand(commands.table, 'bookmarks', exbookmarks) - bookcmd[1].append( - ('', 'list-remote', None, - 'list remote bookmarks. ' - 'Positional arguments are interpreted as wildcard patterns. ' - 'Only allowed wildcard is \'*\' in the end of the pattern. ' - 'If no positional arguments are specified then it will list ' - 'the most "important" remote bookmarks. ' - 'Otherwise it will list remote bookmarks ' - 'that match at least one pattern ' - '')) - bookcmd[1].append( - ('', 'remote-path', '', - 'name of the remote path to list the bookmarks')) - extensions.wrapcommand(commands.table, 'pull', _pull) extensions.wrapcommand(commands.table, 'update', _update) @@ -363,59 +348,6 @@ partorder.insert( index, partorder.pop(partorder.index(scratchbranchparttype))) -def _showbookmarks(ui, bookmarks, **opts): - # Copy-paste from commands.py - fm = ui.formatter('bookmarks', opts) - for bmark, n in sorted(bookmarks.iteritems()): - fm.startitem() - if not ui.quiet: - fm.plain(' ') - fm.write('bookmark', '%s', bmark) - pad = ' ' * (25 - encoding.colwidth(bmark)) - fm.condwrite(not ui.quiet, 'node', pad + ' %s', n) - fm.plain('\n') - fm.end() - -def exbookmarks(orig, ui, repo, *names, **opts): - pattern = opts.get('list_remote') - delete = opts.get('delete') - remotepath = opts.get('remote_path') - path = ui.paths.getpath(remotepath or None, default=('default')) - if pattern: - destpath = path.pushloc or path.loc - other = hg.peer(repo, opts, destpath) - if not names: - raise error.Abort( - '--list-remote requires a bookmark pattern', - hint='use "hg book" to get a list of your local bookmarks') - else: - fetchedbookmarks = other.listkeyspatterns('bookmarks', - patterns=names) - _showbookmarks(ui, fetchedbookmarks, **opts) - return - elif delete and 'remotenames' in extensions._extensions: - existing_local_bms = set(repo._bookmarks.keys()) - scratch_bms = [] - other_bms = [] - for name in names: - if _scratchbranchmatcher(name) and name not in existing_local_bms: - scratch_bms.append(name) - else: - other_bms.append(name) - - if len(scratch_bms) > 0: - if remotepath == '': - remotepath = 'default' - _deleteinfinitepushbookmarks(ui, - repo, - remotepath, - scratch_bms) - - if len(other_bms) > 0 or len(scratch_bms) == 0: - return orig(ui, repo, *other_bms, **opts) - else: - return orig(ui, repo, *names, **opts) - def _checkheads(orig, pushop): if pushop.ui.configbool(experimental, configscratchpush, False): return
--- a/tests/test-infinitepush-bundlestore.t Thu Feb 08 17:27:47 2018 +0530 +++ b/tests/test-infinitepush-bundlestore.t Fri Feb 09 13:36:50 2018 +0530 @@ -369,47 +369,6 @@ |/ o initialcommit public - $ hg book --list-remote scratch/* - scratch/anotherbranch 1de1d7d92f8965260391d0513fe8a8d5973d3042 - scratch/mybranch 8872775dd97a750e1533dc1fbbca665644b32547 - $ hg book --list-remote - abort: --list-remote requires a bookmark pattern - (use "hg book" to get a list of your local bookmarks) - [255] - $ hg book --config infinitepush.defaultremotepatterns=scratch/another* --list-remote - abort: --list-remote requires a bookmark pattern - (use "hg book" to get a list of your local bookmarks) - [255] - $ hg book --list-remote scratch/my - $ hg book --list-remote scratch/my* - scratch/mybranch 8872775dd97a750e1533dc1fbbca665644b32547 - $ hg book --list-remote scratch/my* -T json - [ - { - "bookmark": "scratch/mybranch", - "node": "8872775dd97a750e1533dc1fbbca665644b32547" - } - ] - $ cd ../repo - $ hg book scratch/serversidebook - $ hg book serversidebook - $ cd ../client - $ hg book --list-remote scratch/* -T json - [ - { - "bookmark": "scratch/anotherbranch", - "node": "1de1d7d92f8965260391d0513fe8a8d5973d3042" - }, - { - "bookmark": "scratch/mybranch", - "node": "8872775dd97a750e1533dc1fbbca665644b32547" - }, - { - "bookmark": "scratch/serversidebook", - "node": "0000000000000000000000000000000000000000" - } - ] - Push to svn server should fail $ hg push svn+ssh://svn.vip.facebook.com/svnroot/tfb/trunk/www -r . --to scratch/serversidebook abort: infinite push does not work with svn repo