Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: vcs_info on a hg repository with a git subrepository; actionformats works ok, formats does not



On Mon, Sep 17, 2012 at 9:57 AM, Seth House <seth@xxxxxxxxx> wrote:
> That said, their addition of git commands to the debug output isn't
> outputting terribly useful info. I wonder if that is intentional.

It is, indeed, intentional:
http://selenic.com/hg/diff/58a6f3f4d553/mercurial/subrepo.py

> The --debug flag is used to get hg to output the full sha.

Relying on --debug here is not ideal. Something like this was bound to
happen eventually. Unfortunately, I don't believe there's a way to
retrieve all info of interest to VCS_Info with a single call to
Mercurial. (Invoking the Python interpreter is too slow to do more
than once while drawing the shell prompt.) I have done quite a bit of
experimenting, searching, and asking on this.

I propose one of the following:

1) Alter the hg backend to work without the full 40-char hash.

The ``hg id`` command will always return a unique hash. The only thing
the full hash is being used for in the hg backend is comparisons with
MQ patches and that can be changed to be a left-match instead. We can
document why the full hash isn't available and if users are expecting
40-chars we can give an example of how to pad the value with spaces.
This changes existing behavior.

2) Continue using --debug and add a workaround for this issue.

It's plausible that the output of interest will always appear at the
bottom of the debug output. Mercurial does have a
backward-compatibility policy for its output formats but this does not
extend to debug output (obviously).

FWIW, my personal preference is the first option as I feel the 40-char
hash is rarely desired or useful in a shell prompt.

Thoughts?



Messages sorted by: Reverse Date, Date, Thread, Author