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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
<avarab@xxxxxxxxx> wrote:
> On Fri, Jun 18, 2010 at 20:59, Joshua Shrader <jshrader83@xxxxxxxxx> 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.
>
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]