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

RE: Why does `svnversion -c` give me a range?

From: Cooke, Mark <mark.cooke_at_siemens.com>
Date: Thu, 5 Dec 2013 10:23:37 +0100

> -----Original Message-----
> From: Daniel Shahaf [mailto:d.s_at_daniel.shahaf.name]
> Sent: 04 December 2013 16:08
>
> Ryan Schmidt wrote on Wed, Dec 04, 2013 at 06:14:33 -0600:
> >
> > On Dec 4, 2013, at 06:00, Cooke, Mark wrote:
> >
> > > I would like to include the svn revision number in my
> project's version info but I am confused by the results of
> svnversion. I want the version number of a tagged tree to
> always be the same (i.e. the last commit to the tag) but if
> the tag is to be rebuilt using a fresh checkout some time
> later `svnversion` seems to report the HEAD revision. So I
> looked at `svnversion -c` but this always seems to give me a
> range e.g. `2:1476`, even directly after an update.
> > >
> > > I have read the red book but it is quite vague about the
> -c option. Why is `-c` always giving me a range?
> >
> > I think the `-c` option means: given all the item in this
> directory and recursive subdirectories, give the oldest and
> newest changed file. So, the oldest item in your working copy
> was last changed in revision 2, and the newest was last
> changed in revision 1476.
> >
> > And `svnversion` without any flag does seem to give the latest
> > revision to which the working copy was updated, not the last changed
> > revision.
> >
>
> Note that "bare" svnversion can give a range as well:
>
> % svnversion -c ~srv/conf
> 105:143
> % svnversion ~srv/conf
> 142:143

Understood, however for my example I get a different "sort" of answer with(out) `-c` on all my WCs (including an unmodified fresh checkout), without `-c` gave a single revision, with `-c` always gives a range. That seems to me to be inconsistent (even wrong):
{{{
D:\PROJECTS\Support\Code>svn --version
svn, version 1.7.10 (r1485443)
   compiled Jun 1 2013, 07:40:50
<snip>

D:\PROJECTS\Support\Code>svn up .
Updating '.':
At revision 638.

D:\PROJECTS\Support\Code>svnversion .
638

D:\PROJECTS\Support\Code>svnversion . -c
235:635
}}}

> FWIW, all this should be documented in 'svnversion --help'.
> Is it clear there?

As I mentioned, the help text would lead me to expect a consistent style of results, hence the question. The only mention of `-c` is:-
{{{
  -c [--committed] : last changed rather than current revisions
}}}

Combined with the main text: "The version number will be a single number if the working copy is single revision, unmodified, not switched and with an URL that matches the TRAIL_URL argument." I would also expect a single number using `-c`.

However, I am exclusively on windoze so tsvn's SubWCRev app is ideal for what I want.

~ mark c

> > If you want the last changed revision, you could use:
> >
> > svn info | sed -n 's/^Last Changed Rev: //p'
Received on 2013-12-05 10:24:40 CET

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

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