-
Notifications
You must be signed in to change notification settings - Fork 4
One way push to a restricted access svn repo for backup. Will overwrite commits made directly to svn.
License
martinlong1978/Git-Svn-push
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
**************************************************************************** IMPORTANT Version 2.0 is not backwards compatible with version 1.0. You will need to make configuration file changes, and possibly rebuild the map file manually. **************************************************************************** This is a simple one-way GIT to SVN sync. It will push up your GIT branches to a central SVN server. You should lock down the SVN server so that only a single user can commit - the one which is running GitSvnPush, otherwise any commits made by other people will be reverted (effectively overwritten) by the script. It will push up all of your branches, finding, where possible, the correct branch point. It does not write any mergeinfo - that should never be needed if the SVN repo remains read-only. Still needs tidying up. I'd like to try and figure out someday how to make this work without SVN working copies, and maybe ever with a bare GIT repo. # Usage svnExport.pl [GIT-SVN-push-root] GIT-SVN-push-root is a directory which should be created as per the "Installation" section below. This defaults to "/export/home/javadev/gitsync" for historical reasons. # Installation 1. Create a directory within which all the work will be done: $ mkdir -p /export/git-svn-push 2. Modify svnExport.pl to point at that directory by editing line 22 to say: $ my $SYNC_BASE="/export/git-svn-push"; 3. Create additional directories: $ mkdir -p /export/git-svn-push/workingdata; $ mkdir -p /export/git-svn-push/workingdata/messages; 4. Clone your git repo into `/export/git-svn-push/GIT/project-name` $ git clone git://example.com/project-name.git /export/git-svn-push/GIT/project-name 5. Create a configuration file for your project in `/export/git-svn-push/GIT/project-name.config` (see Configuration below) And you're good to go. # Configuration Per project configuration must be added: project.config Has the format: # Comments key=value Required fields: SVN_URL=https://example.com/example-repo Optional fields: BRANCH_ORDER=branch1,branch2,branch3 SVN_FETCH=trunk:refs/remotes/origin/master SVN_BRANCHES=branches/*:refs/remotes/origin/* In this case the SVN URL for trunk is https://example.com/example-repo/trunk and the branches are according to the glob https://example.com/example-repo/branches/* . This differs from the std-layout that git svn expects. SVN_FETCH defaults to trunk and SVN_BRANCHES to (the non-standard) "branches/*/trunk". This behaviour is preserved for backwards compatibility. project.lock # How it works A mapping between svn and git commits is kept in /export/git-svn-push/workingdata/$project.revcache It takes the form: [svn revision] [branch name] [git commit sha] Example: 1234 foo 0123456789ABCDEF0123456789ABCDEF01234567 1235 trunk ABCDEF012345670123456789ABCDEF0123456789 This allows us to map from svn revision to git commits A git tag is kept at refs/tags/svnbranch/[branch name] so we can tell when it has moved on and which commits have been made to git that are not yet in svn. When a new branch is discovered we look back in the history to find a git commit for which we have an svn commit and `svn cp` from there # TODO * Do things on a commit-by-commit basis rather than branch-by-branch * Commit to branch that first parent is on if we are still on that git branch, otherwise commit to new branch * Store full svn url in rev map * Sync tags * Use `mktemp -d` for creating temporary directories * Write automated tests
About
One way push to a restricted access svn repo for backup. Will overwrite commits made directly to svn.
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published