Alex Rivera | Logout

git & svn externals - a final solution yet?

Asked 2011-01-14T08:11:52.763
20

this is the workflow I currently use for my svn projects (I never use svn branches, and some projects are actively worked on by other people as well):

  • on the server, do the inital git svn fetch which might take hours. Also create a 'build' branch.
  • on a development machine cloning is now fast: git clone srv://project.git, git checkout build followed by git update-refs ..., git svn fetch to restore the link to the svn repository
  • work, commit, work commit, ...
  • to check if things are sane, git push build to the server and trigger a build in Hudson for that branch
  • to store work so that I can work on it from another machine, also push build branch
  • when satisfied, join commits together in logical steps (eg one for each bug), commit to svn and reset everything like git checkout master, git merge build, git svn dcommit, git push, git checkout build, git rebase master, git push build

Enter svn externals. I tried every script here already but all of them fail. My externals are setup like this:

/path/to/x x
/path/to/y/z y/z
/path/to/a/b.file a/b.file

and the scripts do things like trying to create /path/to/x in the root of the filesystem and git svn fetch /path/to/x. Also the single files seem to cause more problems. (subquestion 1: what is the svn:externals format these scripts were written for then?)

It doesn't seem to hard modifying one of the scripts to handle my situation and replicate the directory structure I'm after correctly, but then I'm left with a major problem: if I change a file in both x and y/z directories, I don't see a way to join this into a single svn commit and that is one of the reasons I started using git in the first place.

Hence

Edit
Report

2 Answers

14

Unfortunately, svn's externals are quite flexible. I've run across a number of scripts that treat them as <path> <url>, but <url> <path> is also allowed. So I think some of the scripts are just broken in that regard.

To answer your second subquestion: no. 'git svn fetch' needs to operate on a subtree of Subversion's repo, but it needs to be something it can treat like a branch. The only thing map well into that paradigm is a directory (trunk/, for example). FWIW, Bazaar and Mercurial suffer here too. At the end of the day, Subversion is just a versioned file system, whereas Git has a first class concept of a branch. This is one of those mismatches getting in the way. :-(

answered 2011-04-05T01:55:18.050
1

Just a another note on the second subquestion. As far as I know subversion as of today also does not support svn externals for files, only folders. So I guess such entries in the properties would be invalid. Don't know if there is any tooling which handles this case.

answered 2013-01-31T19:48:20.763

Your Answer