Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: stahta01 on August 11, 2014, 10:22:28 pm

Title: Development How to use a Code::Blocks Git Repo
Post by: stahta01 on August 11, 2014, 10:22:28 pm
Edit: I am now using new methods for setting up a git clone so "git svn info" works.
Edit2: Link to how I fix "git svn info" in an existing repo https://github.com/stahta01/git_notes_and_scripts/blob/master/notes/GitHowTo/Fix%20Git%20SVN%20information%20steps.txt (https://github.com/stahta01/git_notes_and_scripts/blob/master/notes/GitHowTo/Fix%20Git%20SVN%20information%20steps.txt)

https://github.com/stahta01/cb_misc/blob/master/Notes/Git%20svn%20setup%20under%20Debian%208.0.txt (https://github.com/stahta01/cb_misc/blob/master/Notes/Git%20svn%20setup%20under%20Debian%208.0.txt)

Despite the file name; I am using these steps on both Debian 8.0 Linux and on windows 7.

Tim S.


OLD INFO BELOW:

I have spent many hours of this past week trying to get "git svn info" to work with a copy of obfuscated/codeblocks_sf git repo.
I got it to work with obfuscated Git Repo, I had to replace "http:" with "https:" in my step 2.

For updates, Please see these two file on github.com/stahta01
https://github.com/stahta01/cb_misc/blob/master/Notes/Clone%20CodeBlocks%20Git%20Repo%20steps.txt (https://github.com/stahta01/cb_misc/blob/master/Notes/Clone%20CodeBlocks%20Git%20Repo%20steps.txt)
https://github.com/stahta01/cb_misc/blob/master/Notes/git%20svn%20rebase%20test%201.txt (https://github.com/stahta01/cb_misc/blob/master/Notes/git%20svn%20rebase%20test%201.txt)

I have decided my script had no more errors I could find in it; but, it did NOT work.
So, decided to try it with biplab codeblocks git repo.

It worked with biplab codeblocks git repo.
I will try Jens Git Repo, next. Failed Twice on it; trying a third time.

Based on the idea from  http://trac.parrot.org/parrot/wiki/git-svn-tutorial

Warning: I am a Git Newbie; these steps created via trial and error.

I am using Windows 7 32-bit; Git info in quote below.
Quote
Welcome to Git (version 1.8.5.2-preview20131230)
$ git --version
git version 1.8.5.2.msysgit.0


Step 1: Git clone, change directory, and move head back one commit
Code
git clone --origin upstream --branch master git://cb.biplab.in/codeblocks.git  cb_biplab_test
cd cb_biplab_test
git reset --hard HEAD~1


Step 2: Create svn-remote "svn" in git config file
Code
git config --add svn-remote.svn.url http://svn.code.sf.net/p/codeblocks/code
git config --add svn-remote.svn.fetch trunk:refs/remotes/svnstuff/trunk
git config --add svn-remote.svn.branches branches/*:refs/remotes/svnstuff/*
git config --add svn-remote.svn.tags tags/*:refs/remotes/svnstuff/tags/*

Step 3:
Code
 
git show heads/master | head -n 1
commit 6ac780d332a35cce6e6e4b6c666376eaf3ad1f55

Step 4:
Code
mkdir .git/refs/remotes/svnstuff
Replace hash with value returned by the above command
Code
echo 6ac780d332a35cce6e6e4b6c666376eaf3ad1f55 > .git/refs/remotes/svnstuff/trunk

Step 5:
Code
git show remotes/svnstuff/trunk | head -n 1

Step 6: svn find-rev
Code
git svn find-rev HEAD

Step 7: svn reset and fetch
Use number plus 1 returned by svn find-rev step
Code
git svn fetch svn -r 9855

Step 8: Test git svn info
Takes about a minute to return results.
Note: If it does NOT work no results are ever returned in some cases.
Code
git svn info


Step 9: Force branch master to use rebase.
SVN does not like git merge so set to use git rebase.
Code
git config upstream.master.rebase true 

Step 10: Test fetch and pull
Note: I am guessing that the svn fetch should be done before all "git pull" commands.
Code
git svn fetch svn
git pull


Tim S.
Title: Re: Development How to use a Code::Blocks Git Repo
Post by: ollydbg on September 17, 2014, 07:47:30 am
I add this page to the wiki: 3 Developing C::B with Git (http://wiki.codeblocks.org/index.php?title=Developer_documentation#Developing_C::B_with_Git), thanks for sharing.