push: return 1 if no changes found (
issue3228)
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 0
This fixes the lower-right entry.
--- a/mercurial/commands.py Mon Jan 30 11:26:20 2012 -0600
+++ b/mercurial/commands.py Mon Jan 30 11:32:09 2012 -0600
@@ -4426,7 +4426,7 @@
result = repo.push(other, opts.get('force'), revs=revs,
newbranch=opts.get('new_branch'))
- result = (result == 0)
+ result = not result
if opts.get('bookmark'):
rb = other.listkeys('bookmarks')
--- a/mercurial/localrepo.py Mon Jan 30 11:26:20 2012 -0600
+++ b/mercurial/localrepo.py Mon Jan 30 11:32:09 2012 -0600
@@ -1592,7 +1592,8 @@
def push(self, remote, force=False, revs=None, newbranch=False):
'''Push outgoing changesets (limited by revs) from the current
repository to remote. Return an integer:
- - 0 means HTTP error *or* nothing to push
+ - None means nothing to push
+ - 0 means HTTP error
- 1 means we pushed and remote head count is unchanged *or*
we have outgoing changesets but refused to push
- other values as described by addchangegroup()
@@ -1626,7 +1627,7 @@
if not outgoing.missing:
# nothing to push
scmutil.nochangesfound(self.ui, outgoing.excluded)
- ret = 1
+ ret = None
else:
# something to push
if not force:
--- a/tests/test-mq-safety.t Mon Jan 30 11:26:20 2012 -0600
+++ b/tests/test-mq-safety.t Mon Jan 30 11:32:09 2012 -0600
@@ -173,6 +173,7 @@
pushing to ../forcepush2
searching for changes
no changes found (ignored 1 secret changesets)
+ [1]
$ hg phase --draft 'mq()'
$ hg push --force -r default ../forcepush2
pushing to ../forcepush2
--- a/tests/test-phases-exchange.t Mon Jan 30 11:26:20 2012 -0600
+++ b/tests/test-phases-exchange.t Mon Jan 30 11:32:09 2012 -0600
@@ -98,6 +98,7 @@
pushing to ../beta
searching for changes
no changes found
+ [1]
$ hgph
@ 3 public a-D - b555f63b6063
|
@@ -372,6 +373,7 @@
pushing to ../alpha
searching for changes
no changes found
+ [1]
$ cd ..
$ cd alpha
$ hgph
@@ -555,6 +557,7 @@
pushing to ../alpha
searching for changes
no changes found
+ [1]
$ hgph
o 6 public a-F - b740e3e5c05d
|
@@ -659,6 +662,7 @@
pushing to ../alpha
searching for changes
no changes found
+ [1]
$ hgph
o 9 public a-H - 967b449fbc94
|
@@ -932,6 +936,7 @@
pushing to http://localhost:$HGPORT/
searching for changes
no changes found
+ [1]
$ hg phase f54f1bb90ff3
2: draft
--- a/tests/test-push-warn.t Mon Jan 30 11:26:20 2012 -0600
+++ b/tests/test-push-warn.t Mon Jan 30 11:32:09 2012 -0600
@@ -116,6 +116,7 @@
pushing to ../c
searching for changes
no changes found
+ [1]
$ hg push -r 3 ../c
pushing to ../c
--- a/tests/test-ssh.t Mon Jan 30 11:26:20 2012 -0600
+++ b/tests/test-ssh.t Mon Jan 30 11:32:09 2012 -0600
@@ -185,6 +185,7 @@
searching for changes
no changes found
updating bookmark foo
+ [1]
$ hg book -d foo
$ hg in -B
comparing with ssh://user@dummy/remote
--- a/tests/test-subrepo-relative-path.t Mon Jan 30 11:26:20 2012 -0600
+++ b/tests/test-subrepo-relative-path.t Mon Jan 30 11:32:09 2012 -0600
@@ -96,6 +96,7 @@
no changes found
searching for changes
no changes found
+ [1]
$ cat dummylog
Got arguments 1:user@dummy 2:hg -R cloned serve --stdio
--- a/tests/test-treediscovery-legacy.t Mon Jan 30 11:26:20 2012 -0600
+++ b/tests/test-treediscovery-legacy.t Mon Jan 30 11:32:09 2012 -0600
@@ -51,6 +51,7 @@
$ hg push -R empty1 $remote
pushing to http://localhost:$HGPORT/
no changes found
+ [1]
$ tstop
Base repo:
@@ -110,6 +111,7 @@
pushing to http://localhost:$HGPORT/
searching for changes
no changes found
+ [1]
$ cd ..
Local is empty:
@@ -140,6 +142,7 @@
$ hg push $remote
pushing to http://localhost:$HGPORT/
no changes found
+ [1]
$ hg pull $remote
pulling from http://localhost:$HGPORT/
requesting all changes
@@ -184,6 +187,7 @@
pushing to http://localhost:$HGPORT/
searching for changes
no changes found
+ [1]
$ hg pull $remote
pulling from http://localhost:$HGPORT/
searching for changes
--- a/tests/test-treediscovery.t Mon Jan 30 11:26:20 2012 -0600
+++ b/tests/test-treediscovery.t Mon Jan 30 11:32:09 2012 -0600
@@ -45,6 +45,7 @@
$ hg push -R empty1 $remote
pushing to http://localhost:$HGPORT/
no changes found
+ [1]
$ tstop
Base repo:
@@ -104,6 +105,7 @@
pushing to http://localhost:$HGPORT/
searching for changes
no changes found
+ [1]
$ cd ..
Local is empty:
@@ -130,6 +132,7 @@
$ hg push $remote
pushing to http://localhost:$HGPORT/
no changes found
+ [1]
$ hg pull $remote
pulling from http://localhost:$HGPORT/
requesting all changes
@@ -172,6 +175,7 @@
pushing to http://localhost:$HGPORT/
searching for changes
no changes found
+ [1]
$ hg pull $remote
pulling from http://localhost:$HGPORT/
searching for changes