git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bruno Harbulot <Bruno.Harbulot@manchester.ac.uk>
To: git@vger.kernel.org
Subject: git svn and multiple cloned repositories
Date: Tue, 30 Jun 2009 14:23:30 +0200	[thread overview]
Message-ID: <h2d043$4tm$1@ger.gmane.org> (raw)

Hello,


I participate in a few open-source projects for which I provide patches 
sometimes, but most of these projects use Subversion. git-svn is very 
convenient for trying out patches without interfering with the main 
branch (so as to submit them when they're ready). I presume many 'git 
svn' users do something like this too.

However, I'd like to keep multiple copies of this repository (on a few 
machines, including one on a backup server) with the appropriate SVN 
metadata. I'd also like to be able to do 'git svn fetch' on only one of 
these cloned repositories (perhaps via crontab on the server) and to be 
able to push/pull this SVN metadata along with the commits between the 
cloned git repositories.


Is there a recommended way to do this?


I have found 3 ways of achieving this, but none of them seem ideal:

1. Copying the entire cloned repository as regular files and doing 'git 
svn fetch' regularly on each copy.

    - Doing the initial "git svn clone" on one machine (machine1).
    - Copying the cloned repository onto the backup machine 
(backup-server), using tar for example.
    - Adding the repository on 'backup-server' as a remote repository on 
'machine1' (so that I can push my own branches).
    - Doing 'git svn fetch' regularly on both 'machine1' and 
'backup-server'.

This works, but this duplicates the interactions with the SVN server 
(for as many clones I have locally). This is what I'd like to avoid.


2. Transferring the SVN references by hand.

    - On 'backup-server':
      - git --bare init
      - git --bare svn init -s --prefix=svn/ https://project.example.com/svn
      - git --bare svn fetch
    - On 'machineX':
      - git clone ssh://backup-server/~/Project.git/
      - ssh backup-server "cd Project.git ; tar czf - svn refs/remotes 
info/refs packed-refs" | tar xvzf - -C .git/
      - Edit packed-refs to change "refs/heads/master" into 
"refs/remotes/origin/master".
      - git svn init -s --prefix=svn/ https://project.example.com/svn
      - git svn fetch


3. Using 'git clone --mirror' (only works with --bare option).

(same as 2. on backup-server)
    - git clone --mirror ssh://backup-server/~/Project.git
    - mv Project.git .git
    - Edit .git/config by hand to remove the bare repository option
    - git svn init -s --prefix=svn/ https://project.example.com/svn
    - git svn fetch
(I sill have to use 'git svn fetch' regularly with this).




Best wishes,

Bruno.

             reply	other threads:[~2009-06-30 12:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-30 12:23 Bruno Harbulot [this message]
2009-06-30 13:44 ` git svn and multiple cloned repositories Peter Harris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='h2d043$4tm$1@ger.gmane.org' \
    --to=bruno.harbulot@manchester.ac.uk \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).