[PATCH V4] subrepo: append subrepo path to subrepo error messages

Angel Ezquerra angel.ezquerra at gmail.com
Tue Dec 18 16:40:37 CST 2012


On Tue, Dec 18, 2012 at 11:35 PM, Angel Ezquerra
<angel.ezquerra at gmail.com> wrote:
> # HG changeset patch
> # User Angel Ezquerra <angel.ezquerra at gmail.com>
> # Date 1355438273 -3600
> # Node ID f15c5ad6479fd34258da8f78ff87c0ec6e90fd36
> # Parent  34a1a639d8358e43f4bcba7b0cff19f4e4e6958d
> subrepo: append subrepo path to subrepo error messages
>
> This change appends the subrepo path to subrepo errors. That is, when there
> is an error performing an operation a subrepo, rather than displaying a message
> such as:
>
> pushing subrepo MYSUBREPO to PATH
> searching for changes
> abort: push creates new remote head HEADHASH!
> hint: did you forget to merge? use push -f to force
>
> mercurial will show:
>
> pushing subrepo MYSUBREPO to PATH
> searching for changes
> abort: push creates new remote head HEADHASH! (in subrepo MYSUBREPO)
> hint: did you forget to merge? use push -f to force
>
> The rationale for this change is that the current error messages make it hard
> for TortoiseHg (and similar tools) to tell the user which subrepo caused the
> push failure.
>
> The "(in subrepo MYSUBREPO)" message has been added to those subrepo methods
> were it made sense (by using a decorator). We avoid appending "(in subrepo XXX)"
> multiple times when subrepos are nexted by throwing a "SubrepoAbort" exception
> after the extra message is appended. The decorator will then "ignore" (i.e. just
> re-raise) the exception and never add the message again.
>
> Because the state() function already printed the subrepo path when it threw an
> error, that error has been changed to avoid duplicating the subrepo path in the
> error message.
>
> Note that I have also updated several subrepo related tests to reflect these
> changes.
>

This new version tries to address the issues raised by Mads, Matt
Harbison and Laurens. In particular I hope to have gotten the
localization code right, changed the message from '(on subrepo XXX)'
to '(in subrepo XXX)' for consistency's sake, avoid appending the
message more than once and updated more of the subrepo tests (the ones
I could run on windows work fine).

Other than some tests that may fail on non windows platforms the only
remaining issue (IMHO) is whether we should reduce the number of
methods that are decorated to catch subrepo errors.

It would be great if someone could run the tests on Linux. All other
comments are also welcome!

Cheers,

Angel


More information about the Mercurial-devel mailing list