infinitepush: delete the non-forward-move flag for hg push
authorPulkit Goyal <7895pulkit@gmail.com>
Fri, 30 Mar 2018 12:50:06 -0700
changeset 37203 f083e7fd6313
parent 37202 95cc57a74363
child 37204 0d6c12668691
infinitepush: delete the non-forward-move flag for hg push Differential Revision: https://phab.mercurial-scm.org/D2955
hgext/infinitepush/__init__.py
hgext/infinitepush/bundleparts.py
tests/test-infinitepush-bundlestore.t
--- a/hgext/infinitepush/__init__.py	Wed Mar 21 19:23:10 2018 +0530
+++ b/hgext/infinitepush/__init__.py	Fri Mar 30 12:50:06 2018 -0700
@@ -164,14 +164,10 @@
 configitem('experimental', 'infinitepush-scratchpush',
     default=False,
 )
-configitem('experimental', 'non-forward-move',
-    default=False,
-)
 
 experimental = 'experimental'
 configbookmark = 'server-bundlestore-bookmark'
 configscratchpush = 'infinitepush-scratchpush'
-confignonforwardmove = 'non-forward-move'
 
 scratchbranchparttype = bundleparts.scratchbranchparttype
 revsetpredicate = registrar.revsetpredicate()
@@ -301,11 +297,6 @@
 def clientextsetup(ui):
     entry = extensions.wrapcommand(commands.table, 'push', _push)
 
-    if not any(a for a in entry[1] if a[1] == 'non-forward-move'):
-        entry[1].append(('', 'non-forward-move', None,
-                         _('allows moving a remote bookmark to an '
-                           'arbitrary place')))
-
     entry[1].append(
         ('', 'bundle-store', None,
          _('force push to go to bundle store (EXPERIMENTAL)')))
@@ -710,8 +701,6 @@
             # containing `pushkey` part to update bookmarks)
             ui.setconfig(experimental, 'bundle2.pushback', True)
 
-        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
@@ -804,12 +793,9 @@
     # code path.
     bundler.addparam("infinitepush", "True")
 
-    nonforwardmove = pushop.force or pushop.ui.configbool(experimental,
-                                                          confignonforwardmove)
     scratchparts = bundleparts.getscratchbranchparts(pushop.repo,
                                                      pushop.remote,
                                                      pushop.outgoing,
-                                                     nonforwardmove,
                                                      pushop.ui,
                                                      bookmark)
 
@@ -836,12 +822,7 @@
     if oldnode in bundle and list(bundle.set('bundle() & %s::', oldnode)):
         return revs
 
-    # Forced non-fast forward update
-    if force:
-        return revs
-    else:
-        raise error.Abort(_('non-forward push'),
-                          hint=_('use --non-forward-move to override'))
+    return revs
 
 @contextlib.contextmanager
 def logservicecall(logger, service, **kwargs):
--- a/hgext/infinitepush/bundleparts.py	Wed Mar 21 19:23:10 2018 +0530
+++ b/hgext/infinitepush/bundleparts.py	Fri Mar 30 12:50:06 2018 -0700
@@ -22,8 +22,7 @@
 
 scratchbranchparttype = 'b2x:infinitepush'
 
-def getscratchbranchparts(repo, peer, outgoing, confignonforwardmove,
-                          ui, bookmark):
+def getscratchbranchparts(repo, peer, outgoing, ui, bookmark):
     if not outgoing.missing:
         raise error.Abort(_('no commits to push'))
 
@@ -49,8 +48,6 @@
         params['bookprevnode'] = ''
         if bookmark in repo:
             params['bookprevnode'] = repo[bookmark].hex()
-    if confignonforwardmove:
-        params['force'] = '1'
 
     # Do not send pushback bundle2 part with bookmarks if remotenames extension
     # is enabled. It will be handled manually in `_push()`
--- a/tests/test-infinitepush-bundlestore.t	Wed Mar 21 19:23:10 2018 +0530
+++ b/tests/test-infinitepush-bundlestore.t	Fri Mar 30 12:50:06 2018 -0700
@@ -303,14 +303,6 @@
   $ hg push -r . -B scratch/mybranch
   pushing to ssh://user@dummy/repo
   searching for changes
-  remote: non-forward push
-  remote: (use --non-forward-move to override)
-  abort: push failed on remote
-  [255]
-
-  $ hg push -r . -B scratch/mybranch --non-forward-move
-  pushing to ssh://user@dummy/repo
-  searching for changes
   remote: pushing 5 commits:
   remote:     20759b6926ce  scratchcommit
   remote:     1de1d7d92f89  new scratch commit