Archive:Xbmc-git-svn: Difference between revisions
Jump to navigation
Jump to search
>Ceros mNo edit summary |
>Ceros (add table of contents) |
||
Line 1: | Line 1: | ||
__TOC__ | |||
This page has notes on what is done for the migration from svn to git. | This page has notes on what is done for the migration from svn to git. | ||
= XBMC Main Repo = | |||
This is the script used to sync the xbmc git repository from the svn repository. | This is the script used to sync the xbmc git repository from the svn repository. | ||
Revision as of 04:29, 23 September 2009
This page has notes on what is done for the migration from svn to git.
XBMC Main Repo
This is the script used to sync the xbmc git repository from the svn repository.
#!/bin/sh set -e # The xbmc svn repo to pull from. XBMC_SVN_REPO="https://xbmc.svn.sourceforge.net/svnroot/xbmc" # local git shared repo for xbmc we clone to. LOCAL_GIT_REPO="$HOME/git-repos/xbmc" # The xbmc sourceforge git repo to push to. XBMC_GIT_SF_REPO="ssh://[email protected]/gitroot/xbmc/xbmc" # The xbmc github repo to push to. XBMC_GITHUB_REPO="[email protected]:ceros/xbmc.git" # The xbmc gitorious repo to push to. XBMC_GITORIOUS_REPO="[email protected]:xbmc/mainline.git" USAGE="\n\ This script is used to setup a git shared repo to clone an XBMC svn repo.\n\ Once setup, this script can also be used to continually fetch new revisions\n\ and can be used to push to another shared git repo. Usage: xbmc-git-svn [OPTION]\n\ \n\ -h, --help Display this help message.\n\ --initial-setup Only setup the git repo and exit.\n\ --perform-push Performs a git push after fetching new svn revs.\n\ --local-git-repo GIT_REPO Override the default local git repo used, which\n\ is $LOCAL_GIT_REPO\n" while [ "$#" -gt "0" ] do case "$1" in --initial-setup) INITIAL_SETUP=1 shift ;; --perform-push) PERFORM_PUSH=1 shift ;; --local-git-repo) LOCAL_GIT_REPO="$2" shift; shift ;; -h|--help|*) printf "${USAGE}" exit 1 ;; esac done # This sets up the local git repo to pull from svn and push into the git repo. initialize_repo () { # Setup the repo with standard layout and prefix of svn/ git svn init "$XBMC_SVN_REPO" --stdlayout --prefix=svn/ # Make tags go into refs/remotes/svn-tags instead of refs/remotes/svn git config svn-remote.svn.tags tags/*:refs/remotes/svn-tags/* # Settings we apply/unset in case we want to make this repo shared. # Doing a 'git config core.bare true' will make this repo bare. git config --unset core.logallrefupdates git config --unset core.autocrlf git config core.sharedrepository 1 git config receive.denyNonFastForwards true # Settings we apply to keep memory usage sane on the xbmc.org servers git config core.packedGitWindowSize 32m git config core.packedGitLimit 64m git config pack.threads 2 git config pack.windowMemory 64m # The remote repositories to push to git remote add xbmc-git-sf "$XBMC_GIT_SF_REPO" git remote add xbmc-github "$XBMC_GITHUB_REPO" git remote add xbmc-gitorious "$XBMC_GITORIOUS_REPO" # Immediately exit after initialization exit 0 } # Do all git commands in git repo test -d "$LOCAL_GIT_REPO" || mkdir -p "$LOCAL_GIT_REPO" cd "$LOCAL_GIT_REPO" if [ "$INITIAL_SETUP" ]; then initialize_repo fi # This fetches new changes from svn and always reset the master branch to # linuxport git svn fetch git reset --hard remotes/svn/linuxport # This pushes to the remote git repos. master and all svn branches end up in # refs/heads. All svn tags end up in refs/tags. This will make it possible to # simply do 'git clone $URL xbmc' to grab all branches and tags if [ "$PERFORM_PUSH" ]; then git push xbmc-git-sf master git push xbmc-git-sf refs/remotes/svn/*:refs/heads/* git push xbmc-git-sf refs/remotes/svn-tags/*:refs/tags/* # git push xbmc-github master # git push xbmc-github refs/remotes/svn/*:refs/heads/* # git push xbmc-github refs/remotes/svn-tags/*:refs/tags/* # git push xbmc-gitorious master # git push xbmc-gitorious refs/remotes/svn/*:refs/heads/* # git push xbmc-gitorious refs/remotes/svn-tags/*:refs/tags/* fi