zsh-users
 help / color / mirror / code / Atom feed
* vcs_info
@ 2011-09-15  7:41 Miek Gieben
  2011-09-15  8:48 ` vcs_info Julien Nicoulaud
  0 siblings, 1 reply; 8+ messages in thread
From: Miek Gieben @ 2011-09-15  7:41 UTC (permalink / raw)
  To: Zsh Users

[-- Attachment #1: Type: text/plain, Size: 990 bytes --]

Hello,

I just found out about vcs_info (http://eseth.org/2010/hg-in-zsh/), I played
with it a little and it looks very nice.

But I was wondering if the following setup is possible. I have
my home directory stored in .git. And in my $HOME I have multiple
other repositories (git, svn, hg, whatever). And it look like this
doesn't play well with each other.

    autoload -Uz vcs_info   
    precmd () { vcs_info }
    PS1='%F{5}[%F{2}%n%F{5}] %F{3}%3~ ${vcs_info_msg_0_}%f%# '

    cd ~
    [miekg] ~  (git)-[master]-% cd ~/src/godns          # correctly show ~

    # go to the git repo of godns
    [miekg] ~/src/godns  (git)-[tsig]-% cd ../go        # correctly show tsig branch of godns

    # go to the hg repo of go itself
    [miekg] ~/src/go  (git)-[master]-% hg id            # shows higher level git, not hg
    c934f6f5fe8b weekly/weekly.2011-09-01

Is there something I can do about this, or should this be considered a bug?

 grtz,

-- 
    Miek

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: vcs_info
  2011-09-15  7:41 vcs_info Miek Gieben
@ 2011-09-15  8:48 ` Julien Nicoulaud
  2011-09-15  9:03   ` vcs_info Miek Gieben
  2011-09-15 12:12   ` vcs_info Frank Terbeck
  0 siblings, 2 replies; 8+ messages in thread
From: Julien Nicoulaud @ 2011-09-15  8:48 UTC (permalink / raw)
  To: Zsh Users

[-- Attachment #1: Type: text/plain, Size: 1391 bytes --]

Hi,

It seems by default Git repos have precedence over Hg repos. You can force
the order this way:

zstyle ':vcs_info:*' enable hg bzr svn git


I works fine for me (full setup here:
https://gitorious.org/prso/dotfiles/blobs/master/zsh/conf.d/07_Prompt.sh).

May be it would be better if vcs_info automatically picked the inner repo ?

 -- Julien

2011/9/15 Miek Gieben <miek@miek.nl>

> Hello,
>
> I just found out about vcs_info (http://eseth.org/2010/hg-in-zsh/), I
> played
> with it a little and it looks very nice.
>
> But I was wondering if the following setup is possible. I have
> my home directory stored in .git. And in my $HOME I have multiple
> other repositories (git, svn, hg, whatever). And it look like this
> doesn't play well with each other.
>
>    autoload -Uz vcs_info
>    precmd () { vcs_info }
>    PS1='%F{5}[%F{2}%n%F{5}] %F{3}%3~ ${vcs_info_msg_0_}%f%# '
>
>    cd ~
>    [miekg] ~  (git)-[master]-% cd ~/src/godns          # correctly show ~
>
>    # go to the git repo of godns
>    [miekg] ~/src/godns  (git)-[tsig]-% cd ../go        # correctly show
> tsig branch of godns
>
>    # go to the hg repo of go itself
>    [miekg] ~/src/go  (git)-[master]-% hg id            # shows higher level
> git, not hg
>    c934f6f5fe8b weekly/weekly.2011-09-01
>
> Is there something I can do about this, or should this be considered a bug?
>
>  grtz,
>
> --
>    Miek
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: vcs_info
  2011-09-15  8:48 ` vcs_info Julien Nicoulaud
@ 2011-09-15  9:03   ` Miek Gieben
  2011-09-15  9:15     ` vcs_info Julien Nicoulaud
  2011-09-15 12:12   ` vcs_info Frank Terbeck
  1 sibling, 1 reply; 8+ messages in thread
From: Miek Gieben @ 2011-09-15  9:03 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 539 bytes --]

[ Quoting Julien Nicoulaud at 10:48 on September 15 in "Re: vcs_info"... ]
> Hi,
> 
> It seems by default Git repos have precedence over Hg repos. You can force
> the order this way:
> 
> zstyle ':vcs_info:*' enable hg bzr svn git

Ah, that is a nice work around.

> I works fine for me (full setup here:
> https://gitorious.org/prso/dotfiles/blobs/master/zsh/conf.d/07_Prompt.sh).
> 
> May be it would be better if vcs_info automatically picked the inner repo ?

Yes, I think so too.

Thanks for your help.

grtz Miek

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: vcs_info
  2011-09-15  9:03   ` vcs_info Miek Gieben
@ 2011-09-15  9:15     ` Julien Nicoulaud
  2011-09-15  9:38       ` vcs_info René Neumann
  0 siblings, 1 reply; 8+ messages in thread
From: Julien Nicoulaud @ 2011-09-15  9:15 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 835 bytes --]

By the way, does anyone know a way to make vcs_info ignore this $HOME repo
without ignoring the nested repositories ? There is a "disable-patterns"
style, but it matches the current working directory, and not the repo root
directory...

2011/9/15 Miek Gieben <miek@miek.nl>

> [ Quoting Julien Nicoulaud at 10:48 on September 15 in "Re: vcs_info"... ]
> > Hi,
> >
> > It seems by default Git repos have precedence over Hg repos. You can
> force
> > the order this way:
> >
> > zstyle ':vcs_info:*' enable hg bzr svn git
>
> Ah, that is a nice work around.
>
> > I works fine for me (full setup here:
> > https://gitorious.org/prso/dotfiles/blobs/master/zsh/conf.d/07_Prompt.sh
> ).
> >
> > May be it would be better if vcs_info automatically picked the inner repo
> ?
>
> Yes, I think so too.
>
> Thanks for your help.
>
> grtz Miek
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: vcs_info
  2011-09-15  9:15     ` vcs_info Julien Nicoulaud
@ 2011-09-15  9:38       ` René Neumann
  2011-09-15 12:30         ` vcs_info Quabug.Yuan
  0 siblings, 1 reply; 8+ messages in thread
From: René Neumann @ 2011-09-15  9:38 UTC (permalink / raw)
  To: zsh-users

Am 15.09.2011 11:15, schrieb Julien Nicoulaud:
> By the way, does anyone know a way to make vcs_info ignore this $HOME repo
> without ignoring the nested repositories ? There is a "disable-patterns"
> style, but it matches the current working directory, and not the repo root
> directory...

I have achieved this by simply using ".config.git" as the git-repository
name for my $HOME. This makes sure, that under no circumstances I check
something into the HOME-git where it does not belong.

Then I used a simple alias:

alias config='GIT_DIR=$HOME/.config.git/ git --work-tree=$HOME'

(This also removes the nested-repository-problem of yours :))

- René


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: vcs_info
  2011-09-15  8:48 ` vcs_info Julien Nicoulaud
  2011-09-15  9:03   ` vcs_info Miek Gieben
@ 2011-09-15 12:12   ` Frank Terbeck
  2011-09-15 13:01     ` vcs_info Julien Nicoulaud
  1 sibling, 1 reply; 8+ messages in thread
From: Frank Terbeck @ 2011-09-15 12:12 UTC (permalink / raw)
  To: Zsh Users

Julien Nicoulaud wrote:
> It seems by default Git repos have precedence over Hg repos. You can force
> the order this way:
>
> zstyle ':vcs_info:*' enable hg bzr svn git
>
>
> I works fine for me (full setup here:
> https://gitorious.org/prso/dotfiles/blobs/master/zsh/conf.d/07_Prompt.sh).
>
> May be it would be better if vcs_info automatically picked the inner repo ?

This is not possible.

The detections are run sequentially and not in parallel. And with git
for example, you just ask whether you're in a git-working-directory and
git tells you - you don't traverse the directory tree yourself. So there
is no simple way to do this.

I'm also really not a big fan of ~ in git. Because, you probably don't
track everything and use a lot of ignores. And then "git clean -xdf" is
the new "rm -Rf /"...

Regards, Frank


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: vcs_info
  2011-09-15  9:38       ` vcs_info René Neumann
@ 2011-09-15 12:30         ` Quabug.Yuan
  0 siblings, 0 replies; 8+ messages in thread
From: Quabug.Yuan @ 2011-09-15 12:30 UTC (permalink / raw)
  To: René Neumann; +Cc: zsh-users

On Thu, Sep 15, 2011 at 5:38 PM, René Neumann <lists@necoro.eu> wrote:
> Am 15.09.2011 11:15, schrieb Julien Nicoulaud:
>> By the way, does anyone know a way to make vcs_info ignore this $HOME repo
>> without ignoring the nested repositories ? There is a "disable-patterns"
>> style, but it matches the current working directory, and not the repo root
>> directory...
>
> I have achieved this by simply using ".config.git" as the git-repository
> name for my $HOME. This makes sure, that under no circumstances I check
> something into the HOME-git where it does not belong.
>
> Then I used a simple alias:
>
> alias config='GIT_DIR=$HOME/.config.git/ git --work-tree=$HOME'
>
> (This also removes the nested-repository-problem of yours :))
>
> - René
>

It's a nice trick that I always wonder.
Thanks.

 - quabug


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: vcs_info
  2011-09-15 12:12   ` vcs_info Frank Terbeck
@ 2011-09-15 13:01     ` Julien Nicoulaud
  0 siblings, 0 replies; 8+ messages in thread
From: Julien Nicoulaud @ 2011-09-15 13:01 UTC (permalink / raw)
  To: Frank Terbeck; +Cc: Zsh Users

[-- Attachment #1: Type: text/plain, Size: 1321 bytes --]

2011/9/15 Frank Terbeck <ft@bewatermyfriend.org>

> Julien Nicoulaud wrote:
> > It seems by default Git repos have precedence over Hg repos. You can
> force
> > the order this way:
> >
> > zstyle ':vcs_info:*' enable hg bzr svn git
> >
> >
> > I works fine for me (full setup here:
> > https://gitorious.org/prso/dotfiles/blobs/master/zsh/conf.d/07_Prompt.sh
> ).
> >
> > May be it would be better if vcs_info automatically picked the inner repo
> ?
>
> This is not possible.
>
> The detections are run sequentially and not in parallel. And with git
> for example, you just ask whether you're in a git-working-directory and
> git tells you - you don't traverse the directory tree yourself. So there
> is no simple way to do this.
>
Maybe we could add a disable-repo-patterns style, matching the repo root
directory instead of the working directory ? vcs_info is able to use the
relative path in the repo in formats (%S), so one would think it "knows"
about the repo root directory ?

>
> I'm also really not a big fan of ~ in git. Because, you probably don't
> track everything and use a lot of ignores. And then "git clean -xdf" is
> the new "rm -Rf /"...
>
Actually, I have a ~/.gitignore with *. When I want to add a file, I just
force it. I have been using this for years, not accident so far...


> Regards, Frank
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-09-15 13:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-15  7:41 vcs_info Miek Gieben
2011-09-15  8:48 ` vcs_info Julien Nicoulaud
2011-09-15  9:03   ` vcs_info Miek Gieben
2011-09-15  9:15     ` vcs_info Julien Nicoulaud
2011-09-15  9:38       ` vcs_info René Neumann
2011-09-15 12:30         ` vcs_info Quabug.Yuan
2011-09-15 12:12   ` vcs_info Frank Terbeck
2011-09-15 13:01     ` vcs_info Julien Nicoulaud

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).