Archive:Xbmc-git-svn: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
>Ceros
(add instructions for libswscale)
>Ceros
(→‎libswscale: update instructions to pin ourselves to a particular revision)
Line 125: Line 125:
$ git svn clone svn://svn.ffmpeg.org/mplayer/trunk/libswscale
$ git svn clone svn://svn.ffmpeg.org/mplayer/trunk/libswscale
$ cd libswscale
$ cd libswscale
</source>
We pin ourselves to a particular revision, namely r29464. XBMC svn repo has it as we pinned ourselves to r29476, but the last change made to libswscale was actually r29464.
<source lang="bash">
$ git reset --hard 1e352e2131331e2f5207384702b3f2b57738dcff
</source>
Afterwards we create our "current" branch, then push the master, current, and git-svn branch to reside in refs/heads on our remote branch in sourceforge.
<source lang="bash">
$ git branch current
$ git branch current
$ git remote add sf ssh://[email protected]/gitroot/xbmc/libswscale
$ git remote add sf ssh://[email protected]/gitroot/xbmc/libswscale
$ git push sf master
$ git push sf master
$ git push sf current
$ git push sf current
$ git push sf refs/remotes/git-svn:refs/heads/git-svn
</source>
</source>

Revision as of 16:28, 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

# 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

Vendor Branches

All vendor branches are being recloned from their respective upstream VCS repositories.

libswscale

Cloning and pushing libswscale is relatively easy. There's no branches or tags to worry about.

$ git svn clone svn://svn.ffmpeg.org/mplayer/trunk/libswscale
$ cd libswscale

We pin ourselves to a particular revision, namely r29464. XBMC svn repo has it as we pinned ourselves to r29476, but the last change made to libswscale was actually r29464.

$ git reset --hard 1e352e2131331e2f5207384702b3f2b57738dcff

Afterwards we create our "current" branch, then push the master, current, and git-svn branch to reside in refs/heads on our remote branch in sourceforge.

$ git branch current
$ git remote add sf ssh://[email protected]/gitroot/xbmc/libswscale
$ git push sf master
$ git push sf current
$ git push sf refs/remotes/git-svn:refs/heads/git-svn