News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Development How to use a Code::Blocks Git Repo

Started by stahta01, August 11, 2014, 10:22:28 PM

Previous topic - Next topic

stahta01

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/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/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

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

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:

git show heads/master | head -n 1

commit 6ac780d332a35cce6e6e4b6c666376eaf3ad1f55

Step 4:

mkdir .git/refs/remotes/svnstuff

Replace hash with value returned by the above command

echo 6ac780d332a35cce6e6e4b6c666376eaf3ad1f55 > .git/refs/remotes/svnstuff/trunk


Step 5:

git show remotes/svnstuff/trunk | head -n 1


Step 6: svn find-rev

git svn find-rev HEAD


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

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.

git svn info



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

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.

git svn fetch svn
git pull



Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

ollydbg

If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.