Patchwork D2103: infinitepush: drop `--list-remote`, `--remote-path` flags to bookmark cmd

login
register
mail settings
Submitter phabricator
Date Feb. 9, 2018, 11:46 a.m.
Message ID <differential-rev-PHID-DREV-5vig5jwkmefxqrpvyknz-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/27505/
State New
Headers show

Comments

phabricator - Feb. 9, 2018, 11:46 a.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2103

AFFECTED FILES
  hgext/infinitepush/__init__.py
  tests/test-infinitepush-bundlestore.t

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/test-infinitepush-bundlestore.t b/tests/test-infinitepush-bundlestore.t
--- a/tests/test-infinitepush-bundlestore.t
+++ b/tests/test-infinitepush-bundlestore.t
@@ -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
diff --git a/hgext/infinitepush/__init__.py b/hgext/infinitepush/__init__.py
--- a/hgext/infinitepush/__init__.py
+++ b/hgext/infinitepush/__init__.py
@@ -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