You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by do...@americas.bnpparibas.com on 2011/04/05 16:59:32 UTC

programmatic access to svn

Hello,

I am trying to write a couple of quick scripts to help migrate us to svn 
from cvs and to help display statistics about our new svn codebase.

We're running on a Red Hat enterprise 5 Linux, with all the usual 
utilities, and svn 1.6.15

First, if we simply migrate to cvs we will lose the history of what we 
currently have in cvs.  I was hoping to retrieve each diff from cvs, apply 
it, and check it into cvs.
Before even attempting to write something, I wondered whether anyone here 
already has such a thing.  This seems like a wonderful utility to have, 
since it would naturally encourage people to make the switch.

For cvs, I can use the command:

cvs history  -a -c

to generate me a list of all changes to the archive, the date, the user 
who applied it, the file, and the directory it was in.
1. I don't have access to the svn machine itself, and svnadmin does not 
accept a URL.  I'm not looking for write access, just to be able to read 
and gather statistics.
Is there any way out?  Can I copy the svn archive locally and then do the 
work, or do I need access to the machine?

2. What is the analogous command to get me a list of svn modifications?

I'm looking for the ability to extract all changes sequentially from a svn 
archive for analysis

On page 299 of the manual I can see the command
svnadmin dump /var/svn/repos -r 21 --incremental > incr.dump

This seems like what I would need to pull out each change, and I could 
increment from rev 1 to the maximum number.  Is this the best way, or is 
there some other approach?

Last, since presumably advanced svn users might know cvs from before, what 
would the equivalent command in cvs?  Is it:

cvs diff -r rev1 -r rev2 file


Last, if I wanted to programmatically take each change in cvs and enter it 
in svn going back 6 months, the script would need to be able to insert as 
the individual user.  Is there any way of bypassing security in svn 
itself, or do I have to su each user and run the given commit?  I can see 
doing that as root, but if there's a cleaner way....


This message and any attachments (the "message") is intended solely for 
the addressees and is confidential. If you receive this message in error, 
please delete it and immediately notify the sender. Any use not in accord 
with its purpose, any dissemination or disclosure, either whole or partial, 
is prohibited except formal approval. The internet can not guarantee the 
integrity of this message. BNP PARIBAS (and its subsidiaries) shall (will) 
not therefore be liable for the message if modified. Please note that certain 
functions and services for BNP Paribas may be performed by BNP Paribas RCC, Inc.

Re: programmatic access to svn

Posted by Andy Levy <an...@gmail.com>.
On Tue, Apr 5, 2011 at 10:59,  <do...@americas.bnpparibas.com> wrote:
>
> Hello,
>
> I am trying to write a couple of quick scripts to help migrate us to svn
> from cvs and to help display statistics about our new svn codebase.
>
> We're running on a Red Hat enterprise 5 Linux, with all the usual utilities,
> and svn 1.6.15
>
> First, if we simply migrate to cvs we will lose the history of what we
> currently have in cvs.  I was hoping to retrieve each diff from cvs, apply
> it, and check it into cvs.
> Before even attempting to write something, I wondered whether anyone here
> already has such a thing.  This seems like a wonderful utility to have,
> since it would naturally encourage people to make the switch.

Google cvs2svn

> For cvs, I can use the command:
>
> cvs history  -a -c
>
> to generate me a list of all changes to the archive, the date, the user who
> applied it, the file, and the directory it was in.
> 1. I don't have access to the svn machine itself, and svnadmin does not
> accept a URL.  I'm not looking for write access, just to be able to read and
> gather statistics.
> Is there any way out?  Can I copy the svn archive locally and then do the
> work, or do I need access to the machine?

History is not usually accessed via svnadmin at all, it's done via a
Subversion client. Start with svn log --verbose. It even can produce
XML output (--xml) if you find processing XML easier.

> 2. What is the analogous command to get me a list of svn modifications?
>
> I'm looking for the ability to extract all changes sequentially from a svn
> archive for analysis
>
> On page 299 of the manual I can see the command
> svnadmin dump /var/svn/repos -r 21 --incremental > incr.dump
>
> This seems like what I would need to pull out each change, and I could
> increment from rev 1 to the maximum number.  Is this the best way, or is
> there some other approach?

Again, you shouldn't need anything more than a Subversion client to
look at each change. I'm not sure what exactly you're attempting to do
here, but svn diff should be able to handle it, perhaps with some
scripting around it.

> Last, since presumably advanced svn users might know cvs from before, what
> would the equivalent command in cvs?  Is it:
>
> cvs diff -r rev1 -r rev2 file
>
>
> Last, if I wanted to programmatically take each change in cvs and enter it
> in svn going back 6 months, the script would need to be able to insert as
> the individual user.  Is there any way of bypassing security in svn itself,
> or do I have to su each user and run the given commit?  I can see doing that
> as root, but if there's a cleaner way....

Again, cvs2svn, then apply the result of that to your repository. But
really, you should only need to do this once - when you cut off write
access to cvs, then convert the repository & load it into Subversion.