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

Re: getting repository last change revisionfor a file

From: Erwan Lacoste <erwan.lacoste_at_rhapso.fr>
Date: 2004-07-30 17:28:37 CEST

> On Fri, 2004-07-30 at 03:04, Erwan Lacoste wrote:
>> Hi all,
>> I'm migrating a repository from CVS to SVN. I want to (re)write a PHP
>> script which can list the files from a local copy that need to be
>> updated
>> ( a simple ' svn st -uv | grep '*' ') and print them on a web page. I
>> would also need for each file the last revision in which the item has
>> last
>> changed on the local repository (the second revision column with svn st
>> -v), and the last revision in which the item has last changed on the
>> global repository. If i could get the number of commits per file between
>> local repository and the global one, it would be great.
>> I couldn't find a way to get such info with the svn client commands. I
>> thought of a way, wich is adding a property to the file each time I run
>> a
>> commit (with the hooks). Every time I run 'svn ci', I could edit a
>> "last-changed" property to the current revision, for each file wich is
>> commited. I could also edit a "number-of-changes" property.
>> I hope there is a more simple way, I'd be glad to find about it.
>
> You're talking about a script that compares two repositories... is that
> really what you mean? Or when you say "local repository" do you really
> mean "local working copy"?
>
>
>

Yes, I was using the wrong words, what I call a 'local repository' is
actually a 'working copy'. Let me detail the architecture.
I have some directories in /home/ (eg: /home/intranet) which contain the
sources for a web site. I made /home/intranet a working copy, so I can
update sources easily. To update the copy, I want to use a web based
interface. It should be able to print a list of all files which are
out-of-date in /home/intranet/. This first step is quite easy (see first
message). But I also want to print, for each file, the last revision where
it changed in the working copy and in the repository, and if possible the
number of changes between this 2 revisions.

I actually found a way to do so, but it's not very convinient.
I'm using PHP4. First, I get the name of all files wich need to upgrade.
Then, I 'svn info $reposdir | grep URL' to get the repository's url. Then
for each file, I run 'svn log $file_url_to_repos -q -r
HEAD:$working_copy_revision+1 | grep r' wich gives me a list of all
revisions where the file has changed. I can now count the number of lines,
and get first revision number, and last one.
This is basicly the steps I follow. I first thought that passing an URL to
'svn info' would have work, but it didn't. I think It would help if we
could do so.

I kind of answered to myself, but I'd be glad if someone had a more simple
way to do the stuff.

-- 
Erwan Lacoste
Stagiaire
RHAPSO
1, rue Galvani
91300 Massy
Tel +33 (0)1 60 13 79 50
Fax +33 (0)1 69 32 19 61
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri Jul 30 17:36:29 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.