You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Roland Philippsen <ro...@gmx.net> on 2004/07/30 09:38:48 UTC

Repos reorganizing with --parent-dir ?

Hi,

I'm planning a reorganisation of various repositories -- private and public 
things got mixed up, hindering efficient access control and administration. 
Using version 1.1.x (which has better svndumpfilter it seems) I can do 
almost everything I need, but how do I move a project *down* the svn 
filesystem? (As opposed to adding a prefix as in the example given in 
section 5.3.5 of the book).

Let me illustrate. I want to change this kind of layout

svn/
  trunk/
    foo/
    bar/
  branches/
    foo/
    bar/

so that it becomes:

svn/
  foo/
    trunk/
    branches/
  bar/
    trunk/
    branches/

Any ideas? Thanks!
Rolo


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Repos reorganizing with --parent-dir ?

Posted by Michael W Thelen <th...@cs.utah.edu>.
* Roland Philippsen <ro...@gmx.net> [2004-07-30 03:39]:
> Let me illustrate. I want to change this kind of layout
> 
> svn/
>  trunk/
>    foo/
>    bar/
>  branches/
>    foo/
>    bar/
> 
> so that it becomes:
> 
> svn/
>  foo/
>    trunk/
>    branches/
>  bar/
>    trunk/
>    branches/

Here is a script I wrote a while back to do this very thing.  It works
directly on a URLs, so each change creates a new revision.  Change
$repos to the URL of your repository, and change $base to the "parent"
directory of the directories you want to move around (I can't tell if
that would be "/svn" or just "/" in your example).  By default the
script will just print the commands it will run... if they look okay,
then change $REALLY_DO_IT to 1 instead of 0.  Hope this is useful to
you!

#/usr/bin/perl

use warnings;
use strict;

my $REALLY_DO_IT = 0;
my $repos = 'http://path/to/repos';
my $base = '/parent/dir';
my %mkdir;

my %base = map {$_=>1} svn_ls($base);
for my $area (qw(trunk branches tags)) {
    my @tags = $area eq 'trunk' ? ('trunk') :
        map {"$area/$_"} svn_ls("$base/$area");
    for my $tag (@tags) {
        for my $project (svn_ls("$base/$tag")) {
            svn_mkdir("$base/$project") unless exists $base{$project} or
                exists $mkdir{"$base/$project"};
            svn_mkdir("$base/$project/$area") unless $area eq 'trunk' or
                exists $mkdir{"$base/$project/$area"};
            svn_mv("$base/$tag/$project", "$base/$project/$tag");
        }
    }
    svn_rm("$base/$area");
}

sub svn_ls {
    `svn ls $repos$_[0]` =~ /([^\/\s]+)/g
}

sub svn_mkdir {
    my ($dir) = @_;
    my $cmd = "svn mkdir $repos$dir -m 'create $dir'";
    if ($REALLY_DO_IT) { system $cmd; }
    else { print "$cmd\n"; }
    $mkdir{$dir} = 1;
}

sub svn_mv {
    my ($from, $to) = @_;
    my $cmd = "svn mv $repos$from $repos$to -m 'move $from to $to'";
    if ($REALLY_DO_IT) { system $cmd; }
    else { print "$cmd\n"; }
}

sub svn_rm {
    my ($dir) = @_;
    my $cmd = "svn rm $repos$dir -m 'delete $dir'";
    if ($REALLY_DO_IT) { system $cmd; }
    else { print "$cmd\n"; }
}


-- Mike

-- 
Michael W. Thelen
When everybody actually is out to get you, paranoia is just good thinking.
                -- Woody Allen

Re: Repos reorganizing with --parent-dir ?

Posted by Roland Philippsen <ro...@gmx.net>.
Hello again,

Found a workaround: Check out the repository, do the reorganisation in the 
working copy, check it in. Drawback: It would have been nice to correct the 
history as if the structure had been correctly created in the first place 
(which is what --parent-dir does I think).

Still looking for a better way...


--On Friday, July 30, 2004 11:38:48 AM +0200 Roland Philippsen 
<ro...@gmx.net> wrote:

> Hi,
>
> I'm planning a reorganisation of various repositories -- private and
> public things got mixed up, hindering efficient access control and
> administration. Using version 1.1.x (which has better svndumpfilter it
> seems) I can do almost everything I need, but how do I move a project
> *down* the svn filesystem? (As opposed to adding a prefix as in the
> example given in section 5.3.5 of the book).
>
> Let me illustrate. I want to change this kind of layout
>
> svn/
>   trunk/
>     foo/
>     bar/
>   branches/
>     foo/
>     bar/
>
> so that it becomes:
>
> svn/
>   foo/
>     trunk/
>     branches/
>   bar/
>     trunk/
>     branches/
>
> Any ideas? Thanks!
> Rolo
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Repos reorganizing with --parent-dir ?

Posted by Bryan Donlan <bd...@gmail.com>.
On Fri, 30 Jul 2004 17:16:03 +0200, Roland Philippsen
<ro...@gmx.net> wrote:
> >> Let me illustrate. I want to change this kind of layout
> >
> >> so that it becomes:
> >
> >> svn/
> >>   foo/
> >>     trunk/
> >>     branches/
> >>   bar/
> >>     trunk/
> >>     branches/
> >
> > Shouldn't the following series of commands do the trick?
> >
> > svn mkdir http://server/svn/foo
> > svn move http://server/svn/trunk/foo http://server/svn/foo/trunk
> > svn move http://server/svn/branches/foo http://server/svn/foo/branches
> 
> 
> Yep, that seems to do the trick ... except that I chose an overly simple
> example :-)
> 
> I didn't mention how projects are spread out, renaming histories, and
> stuff. Just an example:
> svn_1/
>   trunk/
>     npm/
> 
> later became
> svn_1/
>   trunk/
>     nepumuk/
> 
> which should now be fused with
> svn_2/
>   trunk/
>     sunflower/
> 
> .... with svn_2 having undergone many temporary trees due to a cvs2svn for a
> subproject of sunflower. After loosing a few strands of hair over this I
> noticed it boiled down to the reverse structure I had chosen at the
> beginning, and that's what I based the example on.
> 
> The workaround I described in a previous post (moving things in a working
> copy) is doing the trick for the current head revision, but if we ever need
> to retrieve older things it will be complicated to take the layout changes
> into account. I wanted to get this *right*, see?
> 
> I'm almost at the point where I'll write a custom script to modify the dump
> files. That would be the cleanest solution. Does anyone have a dumpfile
> tweaking script (preferrably Python) they'd feel like sharing with me? I
> looked at the sources of svndumpfilter, but it seems like the effort needed
> for understanding that goes beyond the amount I'm currently willing to
> invest...

Take a look at http://svn.collab.net/repos/svn/trunk/notes/fs_dumprestore.txt
- the format is actually quite simple.

-- 
bd

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Repos reorganizing with --parent-dir ?

Posted by Roland Philippsen <ro...@gmx.net>.
>> Let me illustrate. I want to change this kind of layout
>
>> so that it becomes:
>
>> svn/
>>   foo/
>>     trunk/
>>     branches/
>>   bar/
>>     trunk/
>>     branches/
>
> Shouldn't the following series of commands do the trick?
>
> svn mkdir http://server/svn/foo
> svn move http://server/svn/trunk/foo http://server/svn/foo/trunk
> svn move http://server/svn/branches/foo http://server/svn/foo/branches


Yep, that seems to do the trick ... except that I chose an overly simple 
example :-)

I didn't mention how projects are spread out, renaming histories, and 
stuff. Just an example:
svn_1/
  trunk/
    npm/

later became
svn_1/
  trunk/
    nepumuk/

which should now be fused with
svn_2/
  trunk/
    sunflower/

... with svn_2 having undergone many temporary trees due to a cvs2svn for a 
subproject of sunflower. After loosing a few strands of hair over this I 
noticed it boiled down to the reverse structure I had chosen at the 
beginning, and that's what I based the example on.


The workaround I described in a previous post (moving things in a working 
copy) is doing the trick for the current head revision, but if we ever need 
to retrieve older things it will be complicated to take the layout changes 
into account. I wanted to get this *right*, see?

I'm almost at the point where I'll write a custom script to modify the dump 
files. That would be the cleanest solution. Does anyone have a dumpfile 
tweaking script (preferrably Python) they'd feel like sharing with me? I 
looked at the sources of svndumpfilter, but it seems like the effort needed 
for understanding that goes beyond the amount I'm currently willing to 
invest...

Thanks!
Rolo


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Repos reorganizing with --parent-dir ?

Posted by Thilo-Alexander Ginkel <ma...@tgbyte.com>.
Roland Philippsen wrote:

> Let me illustrate. I want to change this kind of layout

> svn/
>   trunk/
>     foo/
>     bar/
>   branches/
>     foo/
>     bar/

> so that it becomes:

> svn/
>   foo/
>     trunk/
>     branches/
>   bar/
>     trunk/
>     branches/

> Any ideas? Thanks!

Shouldn't the following series of commands do the trick?

svn mkdir http://server/svn/foo
svn move http://server/svn/trunk/foo http://server/svn/foo/trunk
svn move http://server/svn/branches/foo http://server/svn/foo/branches

svn mkdir http://server/svn/bar
svn move http://server/svn/trunk/bar http://server/svn/bar/trunk
svn move http://server/svn/branches/bar http://server/svn/bar/branches

svn delete http://server/svn/trunk
svn delete http://server/svn/branches

Regards,
Thilo


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org