changeset 16039:093b75c7b44b stable

pull: return 1 when no changes found (BC) Currently we have the following return codes if nothing is found: commit incoming outgoing pull push intended 1 1 1 1 1 documented 1 1 1 0 1 actual 1 1 1 0 1 This makes pull agree with the rest of the table and makes it easy to detect "nothing was pulled" in scripts.
author Matt Mackall <mpm@selenic.com>
date Mon, 30 Jan 2012 16:01:54 -0600
parents dad96e752079
children c0b2986b37b8
files mercurial/commands.py mercurial/help/glossary.txt tests/test-bookmarks-pushpull.t tests/test-bundle.t tests/test-convert.t tests/test-hook.t tests/test-https.t tests/test-mq-qimport-fail-cleanup.t tests/test-pending.t tests/test-phases-exchange.t tests/test-pull-r.t tests/test-pull.t tests/test-ssh.t tests/test-subrepo.t tests/test-treediscovery-legacy.t tests/test-treediscovery.t tests/test-url-rev.t
diffstat 17 files changed, 44 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Mon Jan 30 15:56:35 2012 -0600
+++ b/mercurial/commands.py	Mon Jan 30 16:01:54 2012 -0600
@@ -4261,7 +4261,7 @@
 
 def postincoming(ui, repo, modheads, optupdate, checkout):
     if modheads == 0:
-        return
+        return 1
     if optupdate:
         movemarkfrom = repo['.'].node()
         try:
@@ -4312,7 +4312,8 @@
     If SOURCE is omitted, the 'default' path will be used.
     See :hg:`help urls` for more information.
 
-    Returns 0 on success, 1 if an update had unresolved files.
+    Returns 0 on success, 1 if no changes found or an update had
+    unresolved files.
     """
     source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch'))
     other = hg.peer(repo, opts, source)
--- a/mercurial/help/glossary.txt	Mon Jan 30 15:56:35 2012 -0600
+++ b/mercurial/help/glossary.txt	Mon Jan 30 16:01:54 2012 -0600
@@ -366,8 +366,8 @@
     repositories have only a single root changeset.
 
 Secret
-    Secret changesets are changesets that may not be shared via push
-    or pull. See :hg:`help phases`.
+    Changesets in the secret phase may not be shared via push, pull,
+    or clone. See :hg:`help phases`.
 
 Tag
     An alternative name given to a changeset. Tags can be used in all
--- a/tests/test-bookmarks-pushpull.t	Mon Jan 30 15:56:35 2012 -0600
+++ b/tests/test-bookmarks-pushpull.t	Mon Jan 30 16:01:54 2012 -0600
@@ -44,6 +44,7 @@
   pulling from ../a
   no changes found
   importing bookmark X
+  [1]
   $ hg bookmark
      X                         0:4e3505fd9583
      Y                         0:4e3505fd9583
@@ -184,6 +185,7 @@
   no changes found
   divergent bookmark X stored as X@1
   importing bookmark Z
+  [1]
   $ hg clone http://localhost:$HGPORT/ cloned-bookmarks
   requesting all changes
   adding changesets
--- a/tests/test-bundle.t	Mon Jan 30 15:56:35 2012 -0600
+++ b/tests/test-bundle.t	Mon Jan 30 16:01:54 2012 -0600
@@ -85,6 +85,7 @@
   pulling from ../full.hg
   searching for changes
   no changes found
+  [1]
 
 Pull full.hg into empty (using --cwd)
 
@@ -119,6 +120,7 @@
   pulling from full.hg
   searching for changes
   no changes found
+  [1]
 
 Pull full.hg into empty (using -R)
 
@@ -126,6 +128,7 @@
   pulling from full.hg
   searching for changes
   no changes found
+  [1]
 
 Rollback empty
 
--- a/tests/test-convert.t	Mon Jan 30 15:56:35 2012 -0600
+++ b/tests/test-convert.t	Mon Jan 30 16:01:54 2012 -0600
@@ -293,6 +293,7 @@
   pulling from ../a
   searching for changes
   no changes found
+  [1]
   $ touch bogusfile
 
 should fail
--- a/tests/test-hook.t	Mon Jan 30 15:56:35 2012 -0600
+++ b/tests/test-hook.t	Mon Jan 30 16:01:54 2012 -0600
@@ -196,6 +196,7 @@
   listkeys hook: HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'} 
   listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'} 
   importing bookmark bar
+  [1]
   $ cd ../a
 
 test that prepushkey can prevent incoming keys
--- a/tests/test-https.t	Mon Jan 30 15:56:35 2012 -0600
+++ b/tests/test-https.t	Mon Jan 30 16:01:54 2012 -0600
@@ -160,6 +160,7 @@
   pulling from https://localhost:$HGPORT/
   searching for changes
   no changes found
+  [1]
   $ mv copy-pull/.hg/hgrc.bu copy-pull/.hg/hgrc
 
 cacert configured globally, also testing expansion of environment
@@ -171,11 +172,13 @@
   pulling from https://localhost:$HGPORT/
   searching for changes
   no changes found
+  [1]
   $ P=`pwd` hg -R copy-pull pull --insecure
   warning: localhost certificate with fingerprint 91:4f:1a:ff:87:24:9c:09:b6:85:9b:88:b1:90:6d:30:75:64:91:ca not verified (check hostfingerprints or web.cacerts config setting)
   pulling from https://localhost:$HGPORT/
   searching for changes
   no changes found
+  [1]
 
 cacert mismatch
 
@@ -188,6 +191,7 @@
   pulling from https://127.0.0.1:$HGPORT/
   searching for changes
   no changes found
+  [1]
   $ hg -R copy-pull pull --config web.cacerts=pub-other.pem
   abort: error: *:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed (glob)
   [255]
@@ -196,6 +200,7 @@
   pulling from https://localhost:$HGPORT/
   searching for changes
   no changes found
+  [1]
 
 Test server cert which isn't valid yet
 
@@ -255,6 +260,7 @@
   pulling from https://localhost:$HGPORT/
   searching for changes
   no changes found
+  [1]
 
 Test https with cacert and fingerprint through proxy
 
@@ -262,10 +268,12 @@
   pulling from https://localhost:$HGPORT/
   searching for changes
   no changes found
+  [1]
   $ http_proxy=http://localhost:$HGPORT1/ hg -R copy-pull pull https://127.0.0.1:$HGPORT/
   pulling from https://127.0.0.1:$HGPORT/
   searching for changes
   no changes found
+  [1]
 
 Test https with cert problems through proxy
 
--- a/tests/test-mq-qimport-fail-cleanup.t	Mon Jan 30 15:56:35 2012 -0600
+++ b/tests/test-mq-qimport-fail-cleanup.t	Mon Jan 30 16:01:54 2012 -0600
@@ -34,6 +34,7 @@
   b.patch
 
   $ hg pull -q -r 0 . # update phase
+  [1]
   $ hg qimport -r 0
   abort: revision 0 is not mutable
   (see "hg help phases" for details)
--- a/tests/test-pending.t	Mon Jan 30 15:56:35 2012 -0600
+++ b/tests/test-pending.t	Mon Jan 30 16:01:54 2012 -0600
@@ -102,6 +102,7 @@
   rollback completed
   abort: pretxnchangegroup hook failed
   pull 0000000000000000000000000000000000000000
+  [1]
 
 test external hook
 
@@ -117,3 +118,4 @@
   rollback completed
   abort: pretxnchangegroup hook exited with status 1
   pull 0000000000000000000000000000000000000000
+  [1]
--- a/tests/test-phases-exchange.t	Mon Jan 30 15:56:35 2012 -0600
+++ b/tests/test-phases-exchange.t	Mon Jan 30 16:01:54 2012 -0600
@@ -136,6 +136,7 @@
   pulling from ../alpha
   searching for changes
   no changes found
+  [1]
   $ hgph
   o  4 public a-D - b555f63b6063
   |
@@ -343,6 +344,7 @@
   pulling from ../alpha
   searching for changes
   no changes found
+  [1]
   $ hgph
   @  6 public n-B - 145e75495359
   |
@@ -775,6 +777,7 @@
   pulling from ../mu
   searching for changes
   no changes found
+  [1]
   $ hgph
   @  11 draft A-secret - 435b5d83910c
   |
@@ -927,6 +930,7 @@
   pulling from http://localhost:$HGPORT/
   searching for changes
   no changes found
+  [1]
   $ hg phase f54f1bb90ff3
   2: draft
 
--- a/tests/test-pull-r.t	Mon Jan 30 15:56:35 2012 -0600
+++ b/tests/test-pull-r.t	Mon Jan 30 16:01:54 2012 -0600
@@ -100,4 +100,5 @@
 This used to abort: received changelog group is empty:
 
   $ hg pull -qr 1 ../repo
+  [1]
 
--- a/tests/test-pull.t	Mon Jan 30 15:56:35 2012 -0600
+++ b/tests/test-pull.t	Mon Jan 30 16:01:54 2012 -0600
@@ -48,6 +48,7 @@
   pulling from http://foo@localhost:$HGPORT/
   searching for changes
   no changes found
+  [1]
 
   $ hg rollback --dry-run --verbose
   repository tip rolled back to revision -1 (undo pull: http://foo:***@localhost:$HGPORT/)
@@ -77,6 +78,7 @@
   [255]
 
   $ hg pull -q file:../test
+  [1]
 
 It's tricky to make file:// URLs working on every platform with
 regular shell commands.
@@ -88,3 +90,4 @@
 
   $ URL=`python -c "import os; print 'file://localhost' + ('/' + os.getcwd().replace(os.sep, '/')).replace('//', '/') + '/../test'"`
   $ hg pull -q "$URL"
+  [1]
--- a/tests/test-ssh.t	Mon Jan 30 15:56:35 2012 -0600
+++ b/tests/test-ssh.t	Mon Jan 30 16:01:54 2012 -0600
@@ -80,6 +80,7 @@
   pulling from ssh://user@dummy/remote
   searching for changes
   no changes found
+  [1]
 
 local change
 
@@ -198,6 +199,7 @@
   no changes found
   updating bookmark foo
   importing bookmark foo
+  [1]
   $ hg book -d foo
   $ hg push -B foo
   pushing to ssh://user@dummy/remote
--- a/tests/test-subrepo.t	Mon Jan 30 15:56:35 2012 -0600
+++ b/tests/test-subrepo.t	Mon Jan 30 16:01:54 2012 -0600
@@ -580,6 +580,7 @@
   cloning subrepo s from $TESTTMP/sub/repo/s (glob)
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg -q -R repo2 pull -u
+  [1]
   $ echo 1 > repo2/s/a
   $ hg -R repo2/s ci -m2
   $ hg -q -R repo2/s push
@@ -638,6 +639,7 @@
   pulling from issue1852a
   searching for changes
   no changes found
+  [1]
 
 Try the same, but with pull -u
 
--- a/tests/test-treediscovery-legacy.t	Mon Jan 30 15:56:35 2012 -0600
+++ b/tests/test-treediscovery-legacy.t	Mon Jan 30 16:01:54 2012 -0600
@@ -48,6 +48,7 @@
   $ hg pull -R empty1 $remote
   pulling from http://localhost:$HGPORT/
   no changes found
+  [1]
   $ hg push -R empty1 $remote
   pushing to http://localhost:$HGPORT/
   no changes found
@@ -107,6 +108,7 @@
   pulling from http://localhost:$HGPORT/
   searching for changes
   no changes found
+  [1]
   $ hg push $remote
   pushing to http://localhost:$HGPORT/
   searching for changes
@@ -231,6 +233,7 @@
   pulling from http://localhost:$HGPORT/
   searching for changes
   no changes found
+  [1]
   $ hg push $remote
   pushing to http://localhost:$HGPORT/
   searching for changes
@@ -275,6 +278,7 @@
   pulling from http://localhost:$HGPORT/
   searching for changes
   no changes found
+  [1]
   $ hg push $remote
   pushing to http://localhost:$HGPORT/
   searching for changes
--- a/tests/test-treediscovery.t	Mon Jan 30 15:56:35 2012 -0600
+++ b/tests/test-treediscovery.t	Mon Jan 30 16:01:54 2012 -0600
@@ -42,6 +42,7 @@
   $ hg pull -R empty1 $remote
   pulling from http://localhost:$HGPORT/
   no changes found
+  [1]
   $ hg push -R empty1 $remote
   pushing to http://localhost:$HGPORT/
   no changes found
@@ -101,6 +102,7 @@
   pulling from http://localhost:$HGPORT/
   searching for changes
   no changes found
+  [1]
   $ hg push $remote
   pushing to http://localhost:$HGPORT/
   searching for changes
@@ -219,6 +221,7 @@
   pulling from http://localhost:$HGPORT/
   searching for changes
   no changes found
+  [1]
   $ hg push $remote
   pushing to http://localhost:$HGPORT/
   searching for changes
@@ -263,6 +266,7 @@
   pulling from http://localhost:$HGPORT/
   searching for changes
   no changes found
+  [1]
   $ hg push $remote
   pushing to http://localhost:$HGPORT/
   searching for changes
--- a/tests/test-url-rev.t	Mon Jan 30 15:56:35 2012 -0600
+++ b/tests/test-url-rev.t	Mon Jan 30 16:01:54 2012 -0600
@@ -141,6 +141,7 @@
 No new revs, no update:
 
   $ hg pull -qu
+  [1]
 
   $ hg parents -q
   0:1f0dee641bb7