Mercurial > hg
changeset 42130:a362b0b95e42
pull: improved message issued in case of failed update
When running `hg pull --update`, the update step may fail. Nothing in the error
message help to understand the abort is related to the secondary step (update)
instead of the primary step (pull).
We now add some information to the error message to clarify it comes from the
update part. It is useful in various situation (uncommitted changes blocking the
update, update to hidden destination, etc...)
The pull output is updated from:
$ hg pull ../repo-Bob --rev 956063ac4557 --update
pulling from ../repo-Bob
searching for changes
adding changesets
adding manifests
adding file changes
added 2 changesets with 0 changes to 2 files (+1 heads)
(2 other changesets obsolete on arrival)
abort: filtered revision '6'!
to:
$ hg pull ../repo-Bob --rev 956063ac4557 --update
pulling from ../repo-Bob
searching for changes
adding changesets
adding manifests
adding file changes
added 2 changesets with 0 changes to 2 files (+1 heads)
(2 other changesets obsolete on arrival)
abort: cannot update to target: filtered revision '6'!
(I am not sure why the actual error, "filtered revision '6'", is not using the
more modern format mentioning the obsolescence fate of '6')
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 05 Apr 2019 14:35:33 +0200 |
parents | 232a33a11ce0 |
children | b26455ffa7fa |
files | mercurial/commands.py tests/test-obsolete-distributed.t |
diffstat | 2 files changed, 19 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Fri Apr 05 15:56:05 2019 +0200 +++ b/mercurial/commands.py Fri Apr 05 14:35:33 2019 +0200 @@ -4503,7 +4503,10 @@ try: ret = postincoming(ui, repo, modheads, opts.get('update'), checkout, brev) - + except error.FilteredRepoLookupError as exc: + msg = _('cannot update to target: %s') % exc.args[0] + exc.args = (msg,) + exc.args[1:] + raise finally: del repo._subtoppath
--- a/tests/test-obsolete-distributed.t Fri Apr 05 15:56:05 2019 +0200 +++ b/tests/test-obsolete-distributed.t Fri Apr 05 14:35:33 2019 +0200 @@ -504,6 +504,21 @@ (2 other changesets obsolete on arrival) (run 'hg heads' to see heads) +With --update + + $ hg rollback + repository tip rolled back to revision 4 (undo pull) + $ hg pull ../repo-Bob --rev 956063ac4557 --update + pulling from ../repo-Bob + searching for changes + adding changesets + adding manifests + adding file changes + added 2 changesets with 0 changes to 2 files (+1 heads) + (2 other changesets obsolete on arrival) + abort: cannot update to target: filtered revision '6'! + [255] + $ cd .. Test pull report consistency