Long time ago, I started working on DBI. I just learned what I had to
know about git - for perl5 - to do what a VCS should do for you: track
changes and find changes back in time. So I started with

 $ git svn clone   hhttp://svn.perl.org/modules/dbi/trunk DBI-svn

Wait a few minutes and off I go. Full history and the right tools,
which include the graphical frontends I really like in git: gitk and
git-gui.

 $ cd DBI-svn
 $ git branch -a
 * master
   remotes/git-svn

The entry in .git/config now looks like

[svn-remote "svn"]
        url = http://svn.perl.org/modules/dbi/trunk
        fetch = :refs/remotes/git-svn


Then a new branch was created in the DBI svn repo. The more I see how
branches work in svn compared to how they work in git, the less I like
svn and the more I love the speed and workability of git. Fro *ME*, svn
just does it so incredibly wrong that it misses all logic.

So, after hours of fighting svn quirks, I'll show you how to include
the new branches into an existing DBI clone of git.

If you want to start fresh (you do not have any git clone of DBI's svn
yet), you might be better off with

 $ git svn clone http://svn.perl.org/modules/dbi -T trunk -b branches
 -t tags DBI-svn

Which will show all tags as branches.

But I already had a git repo that I already was happy with. In that
repo, I already added all the tags, so I had no need for the tags that
a new clone offered. In /my/ experience, the way git clones svn tags
are no tags at all.

It proved to be a no-go to just add a new entry for another remote svn
origin. So after a lot of experimenting, I came up with manual
editing .git/config to look like this:
--8<---
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[svn-remote "svn"]
        url = http://svn.perl.org/modules
        fetch = dbi/trunk:refs/remotes/git-svn
        branches = dbi/branches/*:refs/remotes/*
#       tags = dbi/tags/*:refs/remotes/tags/*
[gui]
        geometry = 1352x672+116+0 207 211
        wmstate = normal
[user]
        email = hmbr...@cpan.org
        name = H.Merijn Brand (Tux)
-->8---

Note that I disabled the tags.

Then I pulled again (update in svn terms)

 $ git dpull

(See below for my definition of git-dpull)

After that I created two branches instead of te single master I
started with before

 $ git co -b DBI remotes/git-svn
 $ git co -b sqlengine remotes/sqlengine
 $ git co DBI
 $ git branch -a
 * DBI
   master
   sqlengine
   remotes/git-svn
   remotes/sqlengine

To sync up with svn, I do
 $ git co DBI
 $ git dpull

$ cat ~/bin/git-dpull
#!/bin/sh

git stash && git svn fetch && git svn rebase && git stash pop
$ cat ~/bin/git-dpush
#!/bin/sh

git stash && git svn dcommit --username hmbrand && git stash pop
$

HTH

-- 
H.Merijn Brand  http://tux.nl      Perl Monger  http://amsterdam.pm.org/
using 5.00307 through 5.12 and porting perl5.13.x on HP-UX 10.20, 11.00,
11.11, 11.23 and 11.31, OpenSuSE 10.1, 11.0 .. 11.3 and AIX 5.2 and 5.3.
http://mirrors.develooper.com/hpux/           http://www.test-smoke.org/
http://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/

Reply via email to