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

Re: determining which revision a file was added

From: Christopher Ness <chris_at_nesser.org>
Date: 2004-11-01 14:46:35 CET

On Mon, 2004-11-01 at 01:53, Christopher Baus wrote:
> I am going through the API docs, but I can't figure
> how to determine when a file was added to the
> repository. Basically I want to know the date when a
> file was added.

The date a file was added will be the first revision of the file. The
first revision of the file can be found like so:

svn log <filename> | grep ^r[0-9] | tail -n 1

Notice the regular expression to get only lines that start with "r#" of
course there could be comments that have "r#" in them as well so this is
not fail proof. As long as they do not appear in the first comment of
the file we should be ok.

Not sure if SVN has a property you could try to get (svn propget) or not
for this, you'd want that if you are in windows. Or you could download
the GNU tools for windows so you can grep and tail. There should be a
link on this list somewhere.

Here is the output of the command above for one of my repos.

[nesscg@woman latex-src]$ svn log srs.tex | grep ^r[0-9] | tail -n 1
r739 | nesscg | 2004-10-29 14:45:20 -0400 (Fri, 29 Oct 2004) | 3 lines

Cheers,
Chris

-- 
Software Engineering IV,
McMaster University
PGP Public Key: http://www.nesser.org/pgp-key/
08:27:18 up 17:07, 2 users, load average: 0.16, 0.06, 0.26 
http://www.fsf.org/philosophy/no-word-attachments.html

Received on Mon Nov 1 14:46:56 2004

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.