Moving from Subversion to Git

Posted: December 20th, 2009 | Author: | Filed under: Test Lab | Tags: , , , | 1 Comment »

Yep, that day have come. I’m really sick of all Centralized Source Control (or Code) Managements (SCM). I have troubles earlier with Subversion (SVN) but I also have high tolerance and even in the beginning of my recent project have been dropping revisions to recreate the repository from confusing errors.

But few days ago I just got no new added files, after Commit in VisualSVN Server! Modified and deleted were good and committed properly. It was “sort of” my mistake but somehow TortoiseSVN started to mark added files as non-versioned, but why? I haven’t got this issue before, and now when I browse at VisualSVN Server trunk of my project through Web, there were no newly added and now modified files from my latest commits?!!

But this is not what awake my anger and despair, and make me to loose faith in SVN and go to look for Git. Today, when I was trying to commit a Revision, in first try it complained about some newly added directory, but then on new commit, I got error “No such revision 188”, WTF?

last_svn_prompt

OK, I went to browse (like most would do on Google) to find solution. First one, was something like export your repository to new one, then, blah, blah.. No way!

Second one was, go to its Repository and find current file, found it, but it was 187 revision. I start digging and found 188 files somewhere along the files in Repository. Delete it, no help, “No such revision 188”!. And I’m pissed.

I’m going for Git, final, no excuses (maybe one day I’ll try Mercurial), but first, give it a chance to Git. After all it is Source Version by Linus Torvalds, and I even watched on YouTube his talk in Google about Git, it was interesting, many would be offended, but this is his way, and I like the guy!

But get on the dirty job. I would really, really like to migrate all revisions and importe them to Git. After all I commented them well, and TortoiseSVN “Show Log” is one great application for searching past revisions.

So there is a git-svn which confused me a lot because once (I think) it was used as git-svn, but now git svn. But I was impressed by it. It really take all my revisions from SVN to Git, and it so easy!!!

First you have to create a file users.txt. In it write all users that have committed to a project in format:

xajler = Kornelije Sajler <xajler@gmail.com>
VisualSVN Server = VisualSVN Server  <visual@visualsvn.com>

Note: I was using VisualSVN Server, and its default user is “VisualSVN Server”. This user made initial (or first) commit. BTW, this is a imaginary email for VisualSVN user!

mkdir project_tmp
cd project_tmp
git svn init http://code.yoursite.net/svn/project/trunk/ --no-metadata
git config svn.authorsfile ../users.txt
git svn fetch

That’s it, three Git commands. And after a couple of minutes all 187 revisions have been migrated, but not last one, 188 which was giving me error. First, I want only these files (not-able-to-commit ones) to overwrite the existing in Git repository, but then I saw that SVN failed to do last two commits.

So, I just copy all the files to new location remove all .svn folders and just replaced migrated files in Git Repository. I was at start of these project also using Git and SVN, so I copied from past .gitignore file. It purpose is to discard all files, directories, extensions, that are written in it.

At my job we use Visual SourceSafe 2005 and it is a painful to work with, SVN was a little relief but after 187 revisions, I gave up. Hope that Git would be better, and I’ll have no more idiotic problems like I was having with both SVN and SourceSafe.

If you have more insights about this error, and have you (and better why you) cope with Centralized SCMs, please do, write a comment!


Subversion resolve for Tree Conflict

Posted: October 4th, 2009 | Author: | Filed under: Learnaholism | Tags: , , , | 8 Comments »

A little  while ago I started using Subversion or SVN for short as my centralized SCM. I have installed the VisualSVN Sever because it is easy to use and has MMC integrated easy configuration management. I have many problems with conflicts because this was a startup project and there was a many editing/deleting/moving of files. First three times I was desperate I just couldn’t commit to the SVN repository so in my wave of frustration I just delete the repository, create new one, and go on.

Now I have about 60 revisions (without 20 revisions early deleted repositories), and didn’t want to delete all my history and start again. To day I was making a major project refactoring, and at the end I just couldn’t commit. SVN was complaining about “tree conflict”, so I just have to find the solution.

Here is the SVN definition of  a “tree conflict”:

tree conflicts

A tree conflict occurs when a developer moved/renamed/deleted a file or folder, which another developer either also has moved/renamed/deleted or just modified.

And while I was digging information about “tree conflict” I found my solution, and it is very easy, executing resolve command. You have to use Command Prompt and have to be inside the directory of project and better directory where tree conflict emerged. Command looks like this:

svn resolve --accept working -R .