D2108: infinitepush: drop the `--to` flag to push and use `-B` instead

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Tue Mar 27 12:37:30 UTC 2018


pulkit updated this revision to Diff 7334.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2108?vs=5369&id=7334

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

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

CHANGE DETAILS

diff --git a/tests/test-issue4074.t b/tests/test-issue4074.t
--- a/tests/test-issue4074.t
+++ b/tests/test-issue4074.t
@@ -26,4 +26,3 @@
 Time a check-in, should never take more than 10 seconds user time:
 
   $ hg ci --time -m1
-  time: real .* secs .user [0-9][.].* sys .* (re)
diff --git a/tests/test-infinitepush.t b/tests/test-infinitepush.t
--- 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
+  $ hg push -r . -B 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
+  $ hg push -r . -B 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 -q
+  $ hg push -r . -B 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
+  $ hg push -r . -B 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
+  $ hg push -r . -B scratch/fillmetadata/fill
   pushing to ssh://user@dummy/repo
   searching for changes
   remote: pushing 6 commits:
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
@@ -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
+  $ hg push -r . -B scratch/mybranch
   pushing to ssh://user@dummy/repo
   searching for changes
   remote: pushing 1 commit:
@@ -119,7 +119,7 @@
   $ cd ../client2
   $ hg up -q scratch/mybranch
   $ mkcommit 'new scratch commit'
-  $ hg push -r . --to scratch/mybranch
+  $ hg push -r . -B scratch/mybranch
   pushing to ssh://user@dummy/repo
   searching for changes
   remote: pushing 2 commits:
@@ -140,7 +140,7 @@
   scratch/mybranch 1de1d7d92f8965260391d0513fe8a8d5973d3042
 
 Push scratch bookmark with no new revs
-  $ hg push -r . --to scratch/anotherbranch
+  $ hg push -r . -B scratch/anotherbranch
   pushing to ssh://user@dummy/repo
   searching for changes
   remote: pushing 2 commits:
@@ -216,7 +216,7 @@
 
 Test with pushrebase
   $ mkcommit scratchcommitwithpushrebase
-  $ hg push -r . --to scratch/mybranch
+  $ hg push -r . -B scratch/mybranch
   pushing to ssh://user@dummy/repo
   searching for changes
   remote: pushing 4 commits:
@@ -237,7 +237,7 @@
 
 Change the order of pushrebase and infinitepush
   $ mkcommit scratchcommitwithpushrebase2
-  $ hg push -r . --to scratch/mybranch
+  $ hg push -r . -B scratch/mybranch
   pushing to ssh://user@dummy/repo
   searching for changes
   remote: pushing 5 commits:
@@ -300,15 +300,15 @@
   $ scratchbookmarks
   scratch/anotherbranch 1de1d7d92f8965260391d0513fe8a8d5973d3042
   scratch/mybranch 6c10d49fe92751666c40263f96721b918170d3da
-  $ hg push -r . --to scratch/mybranch
+  $ 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 . --to scratch/mybranch --non-forward-move
+  $ hg push -r . -B scratch/mybranch --non-forward-move
   pushing to ssh://user@dummy/repo
   searching for changes
   remote: pushing 5 commits:
diff --git a/hgext/infinitepush/__init__.py b/hgext/infinitepush/__init__.py
--- a/hgext/infinitepush/__init__.py
+++ b/hgext/infinitepush/__init__.py
@@ -315,9 +315,6 @@
 
 def clientextsetup(ui):
     entry = extensions.wrapcommand(commands.table, 'push', _push)
-    # Don't add the 'to' arg if it already exists
-    if not any(a for a in entry[1] if a[1] == 'to'):
-        entry[1].append(('', 'to', '', _('push revs to this bookmark')))
 
     if not any(a for a in entry[1] if a[1] == 'non-forward-move'):
         entry[1].append(('', 'non-forward-move', None,
@@ -743,7 +740,13 @@
     return common, True, remoteheads
 
 def _push(orig, ui, repo, dest=None, *args, **opts):
-    bookmark = opts.get('to') or ''
+
+    bookmark = opts.get('bookmark')
+    # we only support pushing one infinitepush bookmark at once
+    if len(bookmark) == 1:
+        bookmark = bookmark[0]
+    else:
+        bookmark = ''
 
     oldphasemove = None
     overrides = {(experimental, configbookmark): bookmark}
@@ -759,6 +762,9 @@
         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
+            opts['bookmark'] = []
             ui.setconfig(experimental, configscratchpush, True)
             oldphasemove = extensions.wrapfunction(exchange,
                                                    '_localphasemove',



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


More information about the Mercurial-devel mailing list