diff hgext/infinitepush/__init__.py @ 37198: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
line wrap: on
line diff
--- a/hgext/infinitepush/__init__.py	Fri Feb 09 14:02:03 2018 +0530
+++ b/hgext/infinitepush/__init__.py	Fri Feb 09 14:16:03 2018 +0530
@@ -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'''