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

Re: vcs_info: can't get %c and %u to perform as expected



On 06/05/2011, at 16:35 , Frank Terbeck wrote:

> Well, the `hg' backend doesn't support `staged' (that's documented,
> too). Mercurial doesn't expose its staging area like git does, so we
> can't tell if there are staged changes 
> AFAIK, for it.

My confusion is thus down to what vcs_info means by "staged" and
"unstaged". With my current system for Mercurial (and soon, with
git) I can display a symbol when there are new files or edits, a
different symbol when there are changes ready to be committed
(i.e.: "added").

For now, my quest is to figure out if/how vcs_info can expose
the information from 'git status —porcelain' or 'hg status' to a
ZSH prompt.  Both output something along the lines of
 ? - a new file
 A - a new file to be added on next commit
 M - existing file with changes for next commit

Thus matching for "^?", "^A" or "^M" can tell me what I'm after.
In my nomenclature, the "?" in the status output means "unknown
files", while "A" or "M" mean "uncommitted changes". In both
cases I can simply call the repository "dirty".

Which all boils down to presenting a ZSH prompt that indicates
to the user, "there's nothing to do here" or "it's dirty, you
need to clean up."  Ultimately I will simply be presenting
the branch name in a different colour to indicate the status,
rather than cluttering up the RPROMPT with extra characters.

All the extra details (hg patches applied, branch name,
revision number, etc) are extraneous to my needs: I can find
that information by executing the commands appropriate for the
VCS. I don't want my prompt cluttered up with more information
that what I absolutely need (while Seth's nethack prompt is
*very cute* and *very clever*, it's not my style).

I now have something interesting to play with over the weekend.

Regards
Alex



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