Hello Ryan,
Thanks for the reply. Further comments below...
Rob.
> -----Original Message-----
> From: Ryan Schmidt [mailto:subversion-2006d@ryandesign.com]
> Sent: 06 October 2006 21:47
> To: Rob Hubbard
> Cc: Subversion Mailing List (E-mail)
> Subject: Re: Feature Request: more svn info
>
>
> On Oct 6, 2006, at 10:35, Rob Hubbard wrote:
>
> > (1) Single info replies
> >
> > I would really like to be able to have svn info be capable of
> > replying with just a single piece of information. I'm not
> sure what
> > the syntax should be, but perhaps something like
> >
> > svn info . --just "Revision"
> >
> > This would be very useful in, for example, simple bash scripts, or
> > even just on the command line, within `back-ticks`.
> >
> > I suppose this could be done in, for example, a Python wrapper
> > script or bash function, but it would be better if svn could do
> > this directly.
>
> Just the revision(s) is(are) obtainable with the svnversion command.
But SVN version is always recursive, and as far as I can tell can only be applied to directories, not files (as at svn 1.2.3 on Windoze).
> The rest is quite easy with standard shell parsing tools.
>
> $ svn info | grep '^Repository Root:'
> Repository Root: http://example/svn
Yes, that's true. It's harder just to get the part of the line I'm interested in though, rather than the whole line. The above would be no good in backticks. I'd need to use perhaps a Python-based regex search returning just the group in something like "^Repository Root:\(.*\)$".
> Or you can parse it with any XML tool of your choice.
>
> $ svn info --xml
That too is a good suggestion. I do do this sort of thing in more complex scripts (for efficiency). But my concern here is the easy extraction of information during day-to-day command line usage, or perhaps when writing very simple scripts.
> > (2) URL and Path fragments
> >
> > When writing svn or svnlook-based scripts, I have often had
> to hard
> > code information about where the location of the repository ends
> > and the path within the repository begins.
> >
> > [And perhaps there is a simple method that I have overlooked.]
> >
> > Thus some mechanism for splitting such paths would be useful. For
> > example, options such as:
> > --url-to-repository
> > --path-within-repository
> > and perhaps also
> > --scheme
> > --directory
> > --filename
> >
> > The minimum, I suppose, would be a method of obtaining the URL to
> > the repository (from svn info) or the path to the repository (from
> > svnlook info).
>
> svn info provides you with the full URL and the repository URL. From
> this you can deduce the path within the repository. Certainly
> finding
> the scheme is easy. I'm not sure how your hypothetical --path-within-
> repository differs from --directory (is --directory just `basename
> $PATH_WITHIN_REPOSITORY`?) As for --filename, if you call svn
> info on
> a file, you get a line that lists the name. So I think svn info
> already provides all the info you want.
>
> $ svn info http://example/svn/vendor/pma/current/index.php
> Path: index.php
> Name: index.php
> URL: http://example/svn/vendor/pma/current/index.php
> Repository Root: http://example/svn
> Repository UUID: [snip]
> Revision: 214
> Node Kind: file
> Last Changed Author: rschmidt
> Last Changed Rev: 206
> Last Changed Date: 2006-09-28 21:27:44 -0500 (Thu, 28 Sep 2006)
Ah, well I'm not normally seeing "Repository Root". I have SVN 1.2.3 (admittedly, a bit old now) on Windoze (with Cygwin, thank goodness). I'm not sure what the rules are, or whether it's a bug that has been fixed in later versions of SVN, but "svn info" on a *path* does not list the "Repository Root", unless, for example, I specify "-rHEAD" or even (curiously) "-rBASE".
Yes, it's not difficult to extract fragments of the path or URL from the combination of URL, Repository Root and Node Kind (if you have them all). But, I think that SVN would nevertheless benefit from easier (more direct) access to some of these bits of information; I pity those users of SVN on Windoze trying to do this using a batch file "script".
However, you do make some good suggestions. Thanks for those.
> $ svn --version | head -n 1
> svn, version 1.4.0 (r21228)
>
> The above all applies to the svn command when working with a working
> copy or a repository URL. Not sure how this would apply to svnlook.
>
_____________________________________________________________________
This message has been checked for all known viruses by the MessageLabs Virus Scanning Service, on behalf of Celoxica Ltd.
This email and any files transmitted with it are confidential and
may be legally privileged. It is intended solely for the use of the
individual or entity to whom it is addressed. If you have received
this in error, please contact the sender and delete the material
immediately. Whilst this email has been swept for viruses, you
should carry out your own virus check before opening any
attachment. Celoxica Ltd accepts no liability for any loss or
damage which may be caused by software viruses or interception
or interruption of this email.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Mon Oct 9 11:23:48 2006