Mercurial > hg
changeset 12711:b885f28fa4fa
fetch: fix and document exit codes (issue2356)
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 11 Oct 2010 14:39:13 -0500 |
parents | e23895aea892 |
children | 1b546140b85e |
files | hgext/fetch.py tests/test-fetch.t |
diffstat | 2 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/fetch.py Sun Oct 10 23:32:09 2010 +0200 +++ b/hgext/fetch.py Mon Oct 11 14:39:13 2010 -0500 @@ -29,6 +29,8 @@ order, use --switch-parent. See :hg:`help dates` for a list of formats valid for -d/--date. + + Returns 0 on success. ''' date = opts.get('date') @@ -86,7 +88,7 @@ if newchildren[0] != parent: return hg.clean(repo, newchildren[0]) else: - return + return 0 # Are there more than one additional branch heads? newchildren = [n for n in newchildren if n != parent] @@ -99,7 +101,7 @@ ui.status(_('not merging with %d other new branch heads ' '(use "hg heads ." and "hg merge" to merge them)\n') % (len(newheads) - 1)) - return + return 1 # Otherwise, let's merge. err = False @@ -132,6 +134,8 @@ 'with local\n') % (repo.changelog.rev(n), short(n))) + return err + finally: release(lock, wlock)
--- a/tests/test-fetch.t Sun Oct 10 23:32:09 2010 +0200 +++ b/tests/test-fetch.t Mon Oct 11 14:39:13 2010 -0500 @@ -305,6 +305,7 @@ adding file changes added 3 changesets with 2 changes to 1 files (+2 heads) not merging with 1 other new branch heads (use "hg heads ." and "hg merge" to merge them) + [1] parent should be 3 (fetch did not merge anything)