diff tests/test-default-push.t @ 29413:31d3ab7985b8

ui: path option to declare which revisions to push by default Now that we have a mechanism for declaring path sub-options, we can start to pile on features! Many power users have expressed frustration that bare `hg push` attempts to push all local revisions to the remote. This patch introduces the "pushrev" path sub-option to control which revisions are pushed when no "-r" argument is specified. The value of this sub-option is a revset, naturally. A future feature addition could potentially introduce a "pushnames" sub-options that declares the list of names (branches, bookmarks, topics, etc) to push by default. The entire "what to push by default" feature should probably be considered before this patch lands.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 26 Jun 2016 07:59:02 -0700
parents 44f717c87903
children b3100653bafd
line wrap: on
line diff
--- a/tests/test-default-push.t	Sat Jun 25 18:35:14 2016 -0700
+++ b/tests/test-default-push.t	Sun Jun 26 07:59:02 2016 -0700
@@ -105,4 +105,43 @@
   adding file changes
   added 1 changesets with 1 changes to 1 files
 
+:pushrev is used when no -r is passed
+
+  $ cat >> .hg/hgrc << EOF
+  > default:pushrev = .
+  > EOF
+  $ hg -q up -r 0
+  $ echo head1 > foo
+  $ hg -q commit -A -m head1
+  $ hg -q up -r 0
+  $ echo head2 > foo
+  $ hg -q commit -A -m head2
+  $ hg push -f
+  pushing to file:/*/$TESTTMP/pushurlsource/../pushurldest (glob)
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files (+1 heads)
+
+  $ hg --config 'paths.default:pushrev=draft()' push -f
+  pushing to file:/*/$TESTTMP/pushurlsource/../pushurldest (glob)
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files (+1 heads)
+
+Invalid :pushrev raises appropriately
+
+  $ hg --config 'paths.default:pushrev=notdefined()' push
+  pushing to file:/*/$TESTTMP/pushurlsource/../pushurldest (glob)
+  hg: parse error: unknown identifier: notdefined
+  [255]
+
+  $ hg --config 'paths.default:pushrev=(' push
+  pushing to file:/*/$TESTTMP/pushurlsource/../pushurldest (glob)
+  hg: parse error at 1: not a prefix: end
+  [255]
+
   $ cd ..