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

Re: Create new repos rev 1 from existing repos revision

From: Ryan Schmidt <subversion-2006d_at_ryandesign.com>
Date: 2006-11-21 08:05:40 CET

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
Received on Tue Nov 21 08:06:22 2006

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.