[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn info --show-item [was: svn info --detail]

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Wed, 25 Feb 2015 10:57:45 +0000

Branko Čibej wrote:
> Johan Corveleyn wrote:
>> +1. Very nice feature.
>>
>> I've been wondering though (sorry, haven't read through the source,
>> just thinking about how it works): does it support multiple
>> --show-item options? As in:
>>
>>     $ svn info --show-item=last-changed-rev --show-item=last-changed-author TARGET
>>     12345
>>     johndoe

Currently it sees only the last --show-item option on the command line and ignores any others.

>> I don't know how this would work together with multple (or recursive)
>> targets, but maybe something like this might be okay:
>>
>>     $ svn info --show-item=last-changed-rev
>>                --show-item=last-changed-author --depth=immediates .
>>     12345      johndoe     .
>>     54321      jrandom     README
>>     ...
>>
>> ?

> No, it doesn't support multiple --show-item options. There are a several
> reasons for that:
>
>   * The first is a design decision from day one that we won't complicate
>     the command-line client by supporting multiple instances of the same
>     option. There's no code for that currently, [...]

Actually, several options already support multiple instances: --with-revprop, --search, ...

Multiple items need not require multiple options anyway:

  --show-item=last-changed-rev,last-changed-author

>   * As you note, there are potential problems with the output format.
>     Since --show-item is mainly intended to be used by simple scripts
>     (the output is not translated, for example), allowing multiple
>     values for one invocation would insanely complicate result parsing
>     and we'd probably have to invent whitespace escaping for the values.
>     This is already a potential problem with multiple targets.

The output escaping/parsing issues are basically the same as for 'svn list -v' and 'svn status -v'. Here's a flexible possibility, shown by examples:

# similar to 'svn status -v'
svn info --show-item='%8{revision} %8{last-changed-rev} %-12{last-changed-author}'
1662195  1662137  rhuijben     .

# similar to 'svn ls -v'
svn info --show-item='%7{last-changed-rev} %-8.8{last-changed-author} %10{file-size} %12{last-changed-date}'
1662137 rhuijben            2015-02-24T23:06:53.819595Z

But, while all that might be nice, the main aim of this feature was to have an easy way to answer questions such as:

'is this a trunk WC or a branch WC?'

  $ svn info --show-item=relative-url .
  ^/subversion/trunk

'what is the URL of this working copy's repository?'

  $ svn info --show-item=repos-root-url .
https://svn.apache.org/repos/asf

'what is the youngest revision in the repository?'

  $ svn info --show-item=revision ^/
  1662196

- Julian
Received on 2015-02-25 11:59:44 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.