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

Re: Submitting vcs_info function



Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx>:
> On 2008-09-17 at 22:18 +0200, Frank Terbeck wrote:
> >               All functions named VCS_INFO_* are for internal use only.
[...]
> >               ${VCS_INFO_message_N_} (Note the trailing underscore)
> 
> It's a rather confusing distinction that functions named VCS_INFO_* are
> internal but variables named VCS_INFO_* are how you get access to the
> results.

Hm, good point. I think I'll rename the variables to vcs_info_msg_N_.

> > Comments welcome. :)
> 
> In general, this looks great and I intend to use it.
> 
> > VCS_INFO_svn_get_data () { # {{{
> >     setopt localoptions noksharrays extendedglob
> >     local svnbase svnbranch
> >     local -a svninfo
> > 
> >     svnbase="."
> >     while [[ -d "${svnbase}/../.svn" ]]; do
> >         svnbase="${svnbase}/.."
> >     done
> 
> However, this is a deal-breaker for me at present, since it doesn't
> handle svn:externals so will chase up to the top-level.  For many cases,

Yes, that's quite right.
There is a big difference in what the different backends can do. The
most complete one is the one for git - since that's the system I know
best by far.

The svn backend was done in a pretty basic environment (as you can
probably tell). And that is correct for many of the other backends as
well.

Improvements are explicitly encouraged. :-)

> for personal development, on my server, that means getting up to my
> home directory svn repo, as various other repositories, including some
> dev ones, are things I automatically get (unless I use --no-externals).
> 
> I suspect that you're going to need to use svn info at each step up and
> stop, using previous results, if .svn doesn't exist or the value of
> "Repository UUID" differs in the new directory.
> 
> This might be another case where the simple branch option logic is
> helpful?  Although "svn info" is a lightweight local operation, I'm not
> so sure about calling it N times before every prompt.

Well, how deep are your typical repositories? Do they go a lot
further then, say, five levels?

> >     svnbase="$(VCS_INFO_realpath ${svnbase})"
> >     svninfo=( ${${${(M)${(f)"$( svn info )"}:#(#s)(URL|Revision)*}/*: /}/*\//} )
> > 
> >     rrn=${svnbase:t}
> >     zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" branchformat svnbranch || svnbranch="%b:%r"
> >     zformat -f svnbranch "${svnbranch}" "b:${svninfo[1]}" "r:${svninfo[2]}"
> >     VCS_INFO_formats '' "${svnbranch}" "${svnbase}"
> >     return 0
> > }
> 
> I note that svn info has the --non-interactive option, which you
> probably want here.

I guess you are right.

> Also, I don't believe that "svn info" makes any guarantees about output
> ordering.

That would be unfortunate. I wouldn't mind, if there would be another
more machine-friendly way to extract the information... But that would
have to be done by a subversion-dev.

> This appears to work for me:
[...]

I'll take a look at that one tomorrow.

Thanks for your thoughts. :)

Regards, Frank

-- 
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925



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