Re: Fixing branches from a (really messed up) subversion repository

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: Fixing branches from a (really messed up) subversion repository

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:48:59

On Fri, Jun 18, 2010 at 20:59, Joshua Shrader [off-list ref] wrote:
Thanks.  It took a couple days to get everything straightened out, but
this seems to have worked very well.
Mind sharing the details or code for what you did?

I've only proved to myself that this approach will work, I haven't
actually done it.

Re: Fixing branches from a (really messed up) subversion repository

From: Joshua Shrader <hidden>
Date: 2016-06-15 22:48:59

I started with svnadmin dump /path/to/repo > svn.dump.  Then I had to
manually edit svn.dump (I'm sure someone smarter then me could roll
this into the Perl script I used in the next step) to create a "trunk"
and "branches" directory in the first commit.  I found the commits
that added "trunk" and "branches" when we re-organized our repo to
follow this convention, and deleted them.  Then I had to locate where
all of the branches were created - looked like

Node-path: branchname
Node-kind: dir
Node-action: add
Node-copyfrom-rev: 23
Node-copyfrom-path:

and change that blank "Node-copyfrom-path: " to "Node-copyfrom-path:
trunk".  The blank path is what really caused issues because everytime
a branch was created, it would contain copies of branches which
contained copies of branches, etc...  So branch2 had a subfolder
branch1, and branch3 contained branch2 and branch 1, where branch 2
contained branch 1...

Then, I removed all of the contents of the commits (not the commits
themselves) where we re-organized the repo.  i.e.

Node-path: trunk/src
Node-action: add
Node-copyfrom-ref: 23
Node-copyfrom-path: src

and the ones where we deleted nested branches and moved the individual
branches into a "branches" directory.

I made these edits and saved them.  Then I ran that file through a
perl filter, tried to svnadmin load newrepo < filteredDumpFile, and if
I got errors, I iterated - changed the pre-filtered file, blow away
the svn repo that gave me an error during load, re-create it, and
re-load.  I iterated this over several days, as I discovered more and
more inconsistencies with my edited dump file.  I think I have all of
the steps above, but I may be missing one or two, and if I am, I
apologize.  I'd imagine everyone's situation would be a bit different,
so adjust accordingly.

Now, I'm quite the Perl hack so I doubt you want to look at the
script.  It essentially did the following:

Read each line of the dump file.
If the line doesn't start with "Node-path:" or "Node-copyfrom-path:",
then just print it un-altered.
If it does,
  does what follows the ':' start with "trunk", "branches", or "tags"?
 If so, then just print un-altered.
Otherwise,
  for each $branchname(@branchnames) if what follows the ':' begins
with $branchname, replace it with "branches/$branchname", and print.
If none of the branch names match,
  prepend "trunk" to the beginning of the path, and print.

This essentially re-writes all of the paths so that everything not in
a branch, or already under "branches", "tags", or "trunk", is put
under trunk.  It also moves all of the /branchenames to
/branches/branchnames.

After this, we did
svnadmin hotcopy repo repo-backup
rm -rf repo
svnadmin create repo
svnadmin load repo <filteredDumpFile

Changed the ownership to match the ownership of the original
repository, copied over the contents of the repo-backup/hooks
directory into the new repo/hooks, and we were all set.

git svn clone --stdlayout... then worked fine.  Now I just need to
work on a workflow for my co-workers how want to also use git (i.e.
create a bare git repo, and keep that in sync with the git-svn repo).
Ideally, all of us git users can clone the bare repo and push to it,
then every once in a while, I can pull from the bare into the git-svn
repo, and do a dcommit, but I've ran into a couple yet-unresolved
problems.  If you have an references or ideas, I'd appreciate them,
but I suppose that's another thread.



On Fri, Jun 18, 2010 at 5:01 PM, Ævar Arnfjörð Bjarmason
[off-list ref] wrote:
On Fri, Jun 18, 2010 at 20:59, Joshua Shrader [off-list ref] wrote:
quoted
Thanks.  It took a couple days to get everything straightened out, but
this seems to have worked very well.
Mind sharing the details or code for what you did?

I've only proved to myself that this approach will work, I haven't
actually done it.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help