# HG changeset patch # User Pierre-Yves David # Date 2019-04-05 12:35:33 # Node ID a362b0b95e42c8f7d46d7e3a0eb4cc531fa5f2d6 # Parent 232a33a11ce08de7b9b01d63d3f7f8706553098f 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') diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -4503,7 +4503,10 @@ def pull(ui, repo, source="default", **o 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 diff --git a/tests/test-obsolete-distributed.t b/tests/test-obsolete-distributed.t --- a/tests/test-obsolete-distributed.t +++ b/tests/test-obsolete-distributed.t @@ -504,6 +504,21 @@ X` has to process a X that is filtered l (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