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 15:19 , Frank Terbeck wrote:

> You need to set the `check-for-changes' style. After that, it should
> work.

It appears that the %c and %u escapes were added some time between 4.3.9 (stock standard Mac OS X Snow Leopard 10.6.7) and 4.3.11 (installed via MacPorts).  Having upgraded to 4.3.11 I can now get the "staged" flag to show up:

15:25 ~project ➤ zstyle ':vcs_info:*' formats '%b/%c/%u'                       ±master
15:28 ~project ➤ vcs_info ; echo $vcs_info_msg_0_                              ±master
master//
15:28 ~project ➤ touch blah                                                    ±master
15:28 ~project ➤ vcs_info ; echo $vcs_info_msg_0_                             ±master!
master//
15:28 ~project ➤ git add blah                                                 ±master!
15:29 ~project ➤ vcs_info ; echo $vcs_info_msg_0_                             ±master!
master/S/

>  I'm not sure if with the hg backend, it's also required to set
> the `get-revision' style (Seth?).  If it is, that's missing from the
> manual and should be fixed.

15:36 ~hg-stuff ➤ zstyle -L ':vcs_info:*'                                        ☿trunk
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' enable ALL
zstyle ':vcs_info:*' formats %b/%c/%u
zstyle ':vcs_info:*' get-revision true

15:36 ~hg-stuff ➤ touch blah                                                      ☿trunk
15:36 ~hg-stuff ➤ vcs_info ; echo $vcs_info_msg_0_                               ☿trunk?
trunk:ceaa49e8a06cc8880d434b8b3c329a4598f5b8be:0//
15:36 ~hg-stuff ➤ hg add blah                                                    ☿trunk?
15:37 ~hg-stuff ➤ zstyle ':vcs_info:*' get-revision false                        ☿trunk+
15:38 ~hg-stuff ➤ vcs_info ; echo $vcs_info_msg_0_                               ☿trunk+
trunk//
15:38 ~hg-stuff ➤ zstyle ':vcs_info:*' get-revision true                         ☿trunk+
15:38 ~hg-stuff ➤ vcs_info ; echo $vcs_info_msg_0_                               ☿trunk+
trunk:ceaa49e8a06cc8880d434b8b3c329a4598f5b8be:0//U

So apparently the get-revision style needs to be true in order to get the 'unstaged' changes flag to show up for Mercurial.

But now I'm even more confused since vcs_info's "staged" and "unstaged" changes don't conform to my expectations. I'm expecting that my working copy is in one of three states: "dirty" (signified by '?' above), having "added but uncommitted" changes (see '+' above), or unchanged from VCS. Thus (by my thinking), "unstaged" should conform to "dirty", "staged" should conform to "added but uncommitted" - but it looks like that's not the case.

> There is a file `Misc/vcs_info-examples', which is included with newer
> versions of zsh. If contains a number of examples for `vcs_info' as its
> name suggests.

I have been working through that and other sources. My initial problem getting the %c/%u escapes to do anything was due to user error (using the wrong version of ZSH or at least the vcs_info function).

>  <http://eseth.org/2010/hg-in-zsh/>

I'll keep note of that for sure!

Regards
Alex



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