diff --git a/hgext/fetch.py b/hgext/fetch.py --- a/hgext/fetch.py +++ b/hgext/fetch.py @@ -29,6 +29,8 @@ def fetch(ui, repo, source='default', ** 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 @@ def fetch(ui, repo, source='default', ** 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 @@ def fetch(ui, repo, source='default', ** 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 @@ def fetch(ui, repo, source='default', ** 'with local\n') % (repo.changelog.rev(n), short(n))) + return err + finally: release(lock, wlock) diff --git a/tests/test-fetch.t b/tests/test-fetch.t --- a/tests/test-fetch.t +++ b/tests/test-fetch.t @@ -305,6 +305,7 @@ heads) with a local change 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)