- Notifications
You must be signed in to change notification settings - Fork4
One way push to a restricted access svn repo for backup. Will overwrite commits made directly to svn.
License
NotificationsYou must be signed in to change notification settings
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 willneed to make configuration file changes, and possibly rebuild the mapfile manually. ****************************************************************************This is a simple one-way GIT to SVN sync. It will push up your GIT branches toa central SVN server. You should lock down the SVN server so that only a singleuser can commit - the one which is running GitSvnPush, otherwise any commitsmade by other people will be reverted (effectively overwritten) by the script.It will push up all of your branches, finding, where possible, the correctbranch point. It does not write any mergeinfo - that should never be needed ifthe SVN repo remains read-only.Still needs tidying up. I'd like to try and figure out someday how to make thiswork 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.# Installation1. Create a directory within which all the work will be done: $ mkdir -p /export/git-svn-push2. 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-name5. 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.# ConfigurationPer project configuration must be added:project.configHas the format:# Commentskey=valueRequired fields:SVN_URL=https://example.com/example-repoOptional fields:BRANCH_ORDER=branch1,branch2,branch3SVN_FETCH=trunk:refs/remotes/origin/masterSVN_BRANCHES=branches/*:refs/remotes/origin/*In this case the SVN URL for trunk ishttps://example.com/example-repo/trunk and the branches are accordingto the globhttps://example.com/example-repo/branches/* . Thisdiffers from the std-layout that git svn expects. SVN_FETCH defaultsto trunk and SVN_BRANCHES to (the non-standard) "branches/*/trunk".This behaviour is preserved for backwards compatibility.project.lock# How it worksA 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 ABCDEF012345670123456789ABCDEF0123456789This allows us to map from svn revision to git commitsA git tag is kept at refs/tags/svnbranch/[branch name] so we can tell when ithas 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 commitfor 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
Packages0
No packages published