You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Gal Aviel <ga...@yahoo.com> on 2006/11/12 13:33:50 UTC

Create new repos rev 1 from existing repos revision

Hi All,

I have a "golden" repository that I want to use when creating new repositories
for new projects.

The problem is that svnadmin dump and load cycle will start off the new repos
from the version in my "golden" repos, incl. the history, which I don't want.

I want my new repos to start from rev 1 (or zero), I don't want users to see all
the history (they don't care about it).

Any help would be greatly appreciated,

thnaks - Gal.



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

Re: Create new repos rev 1 from existing repos revision

Posted by Michael Haggerty <mh...@alum.mit.edu>.
Gal Aviel wrote:
> I have a "golden" repository that I want to use when creating new repositories
> for new projects.
> 
> The problem is that svnadmin dump and load cycle will start off the new repos
> from the version in my "golden" repos, incl. the history, which I don't want.
> 
> I want my new repos to start from rev 1 (or zero), I don't want users to see all
> the history (they don't care about it).
> 
> Any help would be greatly appreciated,

I think the following should work (untested):

$ svnadmin dump -r HEAD $OLDREPO >svn.dump
$ svnadmin create $NEWREPO
$ svnadmin load --ignore-uuid $NEWREPO <svn.dump

Michael

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

Re: Create new repos rev 1 from existing repos revision

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Nov 20, 2006, at 16:08, Mark Clements wrote:

> Ryan Schmidt wrote:
>
>> On Nov 16, 2006, at 11:58, Mark Clements wrote:
>>
>>> OK - I see how this works, but it's quite a bit of work to redo  
>>> whenever the
>>> default setup changes.  Not sure how often that will happen but  
>>> it could be
>>> an issue.  Is there maybe some way of doing this by playing with the
>>> relocate/switch statement?  The currently proposed solutions are not
>>> currently simple enough for my purpose - I want to be able to have a
>>> 'default_repo' that gets tweaked and modified as required, and  
>>> for my
>>> createrepo script to seed a new repository with revision 1 that  
>>> matches the
>>> head of default_repo, with no user intervention required.
>>>
>>> If that is not possible, then I will probably get my script to  
>>> manually
>>> construct the first revision in a temporary working copy, commit  
>>> that and
>>> delete it.  This would mean that any modifications would need to  
>>> be made
>>> directly in my setup script rather than in a versioned  
>>> repository, but this
>>> is probably the simplest solution if I can't automate the above.
>>
>> Have you tried the "dump head revision / load" strategy someone
>> mentioned? I think it works and it's easy:
>>
>>
>> svnadmin create /path/to/newrepo
>> svnadmin dump -rHEAD /path/to/oldrepo \
>> | svnadmin load /path/to/newrepo
>
> Hi - yes I tried that.  This successfully creates a new repo with  
> the same
> file contents/dir structure, but:
>
> 1) The properties I had set on the root folder did not survive  
> (although
> properties on other folders did).

I can't imagine why that would be the case. If the data is in the  
repository, it should be included in a dump. Can you demonstrate with  
a small example how this information is missing?

> 2) The author/date/log message were all taken from the old repo's head
> revision.  I would like Author:"Setup", Date:now, Msg:"Default  
> repository
> structure created."

No problem. After dumping & loading the repo as above, do this:


echo '#!/bin/sh' > \
/path/to/newrepo/hooks/pre-revprop-change

echo 'exit 0' >> \
/path/to/newrepo/hooks/pre-revprop-change

chmod 755 \
/path/to/newrepo/hooks/pre-revprop-change

svn propset --revprop -r1 \
svn:author "Setup" \
file:///path/to/newrepo

svn propset --revprop -r1 \
svn:date `date +%Y-%m-%dT%H:%M:%S.000000Z` \
file:///path/to/newrepo

svn propset --revprop -r1 \
svn:log "Default repository structure created." \
file:///path/to/newrepo

rm -f \
/path/to/newrepo/hooks/pre-revprop-change


(though I'm not sure if the time zone is correct on that date command  
above)


> My current solution seems to work.  I have two folders in my svn  
> root (which
> has sub-directories contains various svn related things, and is not in
> itself a repository), 'default_repo' and 'default_props'.   
> default_repo is a
> directory structure containing the default files/folders for a new
> repository.  My createrepo script, after creating the repo, checks  
> it out
> copies that folder into the root and svn adds it.  It then recurses  
> through
> each file in default_props and creates a new property on the root  
> folder
> where the propname is the file name and the propvalue is the file's
> contents.  Finally it commits the changes as rev1 with an  
> appropriate log
> message.
>
> This works fine for my current setup (e.g. no file/folder  
> properties) but if
> those requirements change I may need to use the dump/load technique  
> with a
> subsequent modification of the revision properties to reflect the  
> correct
> details (which also requires modifying my pre-revprop-change  
> script), and
> then use my default_props folder to populate the root folder  
> properties.  A
> bit more work, but would probably do the job.
>
> Ah well - thanks (everyone!) for all your help.  I'll let you know  
> if I come
> back to this problem any time in the future.



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

Re: Create new repos rev 1 from existing repos revision

Posted by Mark Clements <gm...@kennel17.co.uk>.
"Ryan Schmidt" <su...@ryandesign.com> wrote in message
news:4332746C-345C-4BD9-9457-84A354B692BA@ryandesign.com...
> On Nov 16, 2006, at 11:58, Mark Clements wrote:
>
> > OK - I see how this works, but it's quite a bit of work to redo
> > whenever the
> > default setup changes.  Not sure how often that will happen but it
> > could be
> > an issue.  Is there maybe some way of doing this by playing with the
> > relocate/switch statement?  The currently proposed solutions are not
> > currently simple enough for my purpose - I want to be able to have a
> > 'default_repo' that gets tweaked and modified as required, and for my
> > createrepo script to seed a new repository with revision 1 that
> > matches the
> > head of default_repo, with no user intervention required.
> >
> > If that is not possible, then I will probably get my script to
> > manually
> > construct the first revision in a temporary working copy, commit
> > that and
> > delete it.  This would mean that any modifications would need to be
> > made
> > directly in my setup script rather than in a versioned repository,
> > but this
> > is probably the simplest solution if I can't automate the above.
>
> Have you tried the "dump head revision / load" strategy someone
> mentioned? I think it works and it's easy:
>
> svnadmin create /path/to/newrepo
> svnadmin dump -rHEAD /path/to/oldrepo \
> | svnadmin load /path/to/newrepo

Hi - yes I tried that.  This successfully creates a new repo with the same
file contents/dir structure, but:

1) The properties I had set on the root folder did not survive (although
properties on other folders did).
2) The author/date/log message were all taken from the old repo's head
revision.  I would like Author:"Setup", Date:now, Msg:"Default repository
structure created."

My current solution seems to work.  I have two folders in my svn root (which
has sub-directories contains various svn related things, and is not in
itself a repository), 'default_repo' and 'default_props'.  default_repo is a
directory structure containing the default files/folders for a new
repository.  My createrepo script, after creating the repo, checks it out
copies that folder into the root and svn adds it.  It then recurses through
each file in default_props and creates a new property on the root folder
where the propname is the file name and the propvalue is the file's
contents.  Finally it commits the changes as rev1 with an appropriate log
message.

This works fine for my current setup (e.g. no file/folder properties) but if
those requirements change I may need to use the dump/load technique with a
subsequent modification of the revision properties to reflect the correct
details (which also requires modifying my pre-revprop-change script), and
then use my default_props folder to populate the root folder properties.  A
bit more work, but would probably do the job.

Ah well - thanks (everyone!) for all your help.  I'll let you know if I come
back to this problem any time in the future.

- Mark Clements (HappyDog)




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

Re: Create new repos rev 1 from existing repos revision

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Nov 16, 2006, at 11:58, Mark Clements wrote:

> OK - I see how this works, but it's quite a bit of work to redo  
> whenever the
> default setup changes.  Not sure how often that will happen but it  
> could be
> an issue.  Is there maybe some way of doing this by playing with the
> relocate/switch statement?  The currently proposed solutions are not
> currently simple enough for my purpose - I want to be able to have a
> 'default_repo' that gets tweaked and modified as required, and for my
> createrepo script to seed a new repository with revision 1 that  
> matches the
> head of default_repo, with no user intervention required.
>
> If that is not possible, then I will probably get my script to  
> manually
> construct the first revision in a temporary working copy, commit  
> that and
> delete it.  This would mean that any modifications would need to be  
> made
> directly in my setup script rather than in a versioned repository,  
> but this
> is probably the simplest solution if I can't automate the above.

Have you tried the "dump head revision / load" strategy someone  
mentioned? I think it works and it's easy:

svnadmin create /path/to/newrepo
svnadmin dump -rHEAD /path/to/oldrepo \
| svnadmin load /path/to/newrepo


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

Re: Create new repos rev 1 from existing repos revision

Posted by Mark Clements <gm...@kennel17.co.uk>.
"Ryan Schmidt" <su...@ryandesign.com> wrote in message
news:DB6A59A6-4775-4F47-A121-125BE8944F4F@ryandesign.com...
> On Nov 12, 2006, at 23:40, Mark wrote:
> > On 11/12/06, Mark Clements wrote:
> >>
> >> I would like to be able to make my repo creation script install
> >> the current
> >> 'default repository' as revision 1 of any new repository it
> >> creates.  Can
> >> anyone think of a way to do this?
> >
> > I haven't tried this out, but can't you just do an export of the
> > golden, setit aside.  Then have your repos creation script create a
> > repository, do a checkout, copy the golden into the working copy, svn
> > add everything, do all the prop setting you want, svn commit.
> > Am I missing something?
>
> Yes -- the properties.
>
> The only way I can think of to do that would be:
>
> $ svnadmin create newrepo
> $ svn co $NEWREPO wc
> $ svn export $OLDREPO wc
> $ cd wc
> $ svn add .
>
> Then run "svn proplist -R -v $OLDREPO", and then create a script to
> parse that output and set those properties again on the items in the
> in-progress working copy. Then you can commit everything as the first
> revision. Then you can "svnadmin dump" the new repo to create a
> dumpfile that anyone can use to "svnadmin load" into a new repository.
>
> Note that you should be distributing a dumpfile of this template
> repository, and not copies of the repository itself, as the
> repository contains a unique ID, which no two repositories should
> share. True, that ID gets written to the dumpfile too, but it can
> (and should be) ignored when loading: "svnadmin load --ignore-uuid".
> I'm not sure though how you would go about enforcing that the --
> ignore-uuid option always be used.

OK - I see how this works, but it's quite a bit of work to redo whenever the
default setup changes.  Not sure how often that will happen but it could be
an issue.  Is there maybe some way of doing this by playing with the
relocate/switch statement?  The currently proposed solutions are not
currently simple enough for my purpose - I want to be able to have a
'default_repo' that gets tweaked and modified as required, and for my
createrepo script to seed a new repository with revision 1 that matches the
head of default_repo, with no user intervention required.

If that is not possible, then I will probably get my script to manually
construct the first revision in a temporary working copy, commit that and
delete it.  This would mean that any modifications would need to be made
directly in my setup script rather than in a versioned repository, but this
is probably the simplest solution if I can't automate the above.

- Mark Clements



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

Re: Create new repos rev 1 from existing repos revision

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Nov 12, 2006, at 23:40, Mark wrote:

> On 11/12/06, Mark Clements wrote:
>
>> "Gal Aviel" wrote:
>>
>> > forgot one small but important fact : I want the property  
>> information on
>> > files/dirs ...  (ignores, etc - takes allot of time to re- 
>> implement this
>> > on the new repos) otherwise (for pure tree structure and file  
>> content)
>> > I would follow your suggestion ..
>>
>> I've been wondering about this too.  I want to setup a 'default'  
>> repository
>> with a full directory structure, various properties set, and  
>> possibly some
>> standard files/externals.  This repository will obviously be  
>> modified from
>> time to time as our working processes change.
>>
>> I would like to be able to make my repo creation script install  
>> the current
>> 'default repository' as revision 1 of any new repository it  
>> creates.  Can
>> anyone think of a way to do this?
>
> I haven't tried this out, but can't you just do an export of the
> golden, setit aside.  Then have your repos creation script create a
> repository, do a checkout, copy the golden into the working copy, svn
> add everything, do all the prop setting you want, svn commit.
> Am I missing something?

Yes -- the properties.

The only way I can think of to do that would be:

$ svnadmin create newrepo
$ svn co $NEWREPO wc
$ svn export $OLDREPO wc
$ cd wc
$ svn add .

Then run "svn proplist -R -v $OLDREPO", and then create a script to  
parse that output and set those properties again on the items in the  
in-progress working copy. Then you can commit everything as the first  
revision. Then you can "svnadmin dump" the new repo to create a  
dumpfile that anyone can use to "svnadmin load" into a new repository.

Note that you should be distributing a dumpfile of this template  
repository, and not copies of the repository itself, as the  
repository contains a unique ID, which no two repositories should  
share. True, that ID gets written to the dumpfile too, but it can  
(and should be) ignored when loading: "svnadmin load --ignore-uuid".  
I'm not sure though how you would go about enforcing that the -- 
ignore-uuid option always be used.


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

Re: Create new repos rev 1 from existing repos revision

Posted by Mark <ma...@mitsein.net>.
I haven't tried this out, but can't you just do an export of the
golden, setit aside.  Then have your repos creation script create a
repository, do a checkout, copy the golden into the working copy, svn
add everything, do all the prop setting you want, svn commit.
Am I missing something?

On 11/12/06, Mark Clements <gm...@kennel17.co.uk> wrote:
> "Gal Aviel" <ga...@yahoo.com> wrote in message
> news:loom.20061112T165330-54@post.gmane.org...
> > forgot one small but important fact : I want the property information on
> > files/dirs ...  (ignores, etc - takes allot of time to re-implement this
> > on the new repos) otherwise (for pure tree structure and file content)
> > I would follow your suggestion ..
>
> I've been wondering about this too.  I want to setup a 'default' repository
> with a full directory structure, various properties set, and possibly some
> standard files/externals.  This repository will obviously be modified from
> time to time as our working processes change.
>
> I would like to be able to make my repo creation script install the current
> 'default repository' as revision 1 of any new repository it creates.  Can
> anyone think of a way to do this?
>
> - Mark Clements (HappyDog)
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>
>


-- 
Mark
"Blessed is he who finds happiness in his own foolishness, for he will
always be happy."

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

Re: Create new repos rev 1 from existing repos revision

Posted by Mark Clements <gm...@kennel17.co.uk>.
"Gal Aviel" <ga...@yahoo.com> wrote in message
news:loom.20061112T165330-54@post.gmane.org...
> forgot one small but important fact : I want the property information on
> files/dirs ...  (ignores, etc - takes allot of time to re-implement this
> on the new repos) otherwise (for pure tree structure and file content)
> I would follow your suggestion ..

I've been wondering about this too.  I want to setup a 'default' repository
with a full directory structure, various properties set, and possibly some
standard files/externals.  This repository will obviously be modified from
time to time as our working processes change.

I would like to be able to make my repo creation script install the current
'default repository' as revision 1 of any new repository it creates.  Can
anyone think of a way to do this?

- Mark Clements (HappyDog)



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

Re: Create new repos rev 1 from existing repos revision

Posted by Gal Aviel <ga...@yahoo.com>.


forgot one small but important fact : I want the property information on
files/dirs ...  (ignores, etc - takes allot of time to re-implement this 
on the new repos) otherwise (for pure tree structure and file content) 
I would follow your suggestion ..

thanks - Gal.

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

Re: Create new repos rev 1 from existing repos revision

Posted by Phyrefly <ph...@gmail.com>.
I don't know if there's a better way to do it, but I'd suggest doing a
complete export of the "golden" repo, and then importing it to a new
repo from there.

I've needed to do the same to smaller chunks of code for various
reasons, and it does take some time with larger chunks of code.  If
your repo is large, this could be a long process...

Richard

On 12/11/06, Gal Aviel <ga...@yahoo.com> wrote:
> Hi All,
>
> I have a "golden" repository that I want to use when creating new repositories
> for new projects.
>
> The problem is that svnadmin dump and load cycle will start off the new repos
> from the version in my "golden" repos, incl. the history, which I don't want.
>
> I want my new repos to start from rev 1 (or zero), I don't want users to see all
> the history (they don't care about it).
>
> Any help would be greatly appreciated,
>
> thnaks - Gal.
>
>
>
> ---------------------------------------------------------------------
> 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