svnsync

I have decided to try svnsync instead of using git directly as I posted here and here.  Since I am a single developer, I was hoping it would be easier this way.  I found another article with tips here.

First, let me just check my installation:

skp@pecan:~$ svnsync --version
svnsync, version 1.5.4 (r33841)
 compiled Aug  7 2009, 01:44:11

Copyright (C) 2000-2008 CollabNet.
Subversion is open source software, see http://subversion.tigris.org/
This product includes software developed by CollabNet (http://www.Collab.Net/).

The following repository access (RA) modules are available:

* ra_neon : Module for accessing a repository via WebDAV protocol using Neon.
 - handles 'http' scheme
 - handles 'https' scheme
* ra_svn : Module for accessing a repository using the svn network protocol.
 - with Cyrus SASL authentication
 - handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
 - handles 'file' scheme

Here are some other quick discoveries that I found:

You can get help by typing

svnsync help

This will give the list of commands supported: init, sync, and copy-revprops.  Then, you can get help on a specific command, such as init, with:

svnsync help init

One of the things I noticed was this warning which has me worried because I have already started committing to the repository with git:

You should not commit to, or make revision property changes in,
the destination repository by any method other than 'svnsync'.
In other words, the destination repository should be a read-only
mirror of the source repository.

So, lets go for it.

First, I am going to make my local repository:

mkdir project-sarah
git svn clone --username myusername https://project-sarah.googlecode.com/svn/trunk

Now, I am going to try to initialize the syncing:

svnsync init --username myusername --password mypassword  https://project-sarah.googlecode.com/svn file://home/skp/app/git-workspace/project-sarah

Here is the message I got back:

svnsync: Cannot initialize a repository with content in it

So, I guess unless I want to try to get Google Code to delete the repository and start over, I am out of luck here.  Maybe this will help someone else though.

Resources

How I moved my code repository to Google Code

Adding Eclipse Project to Git

I did an earlier post where I did this, but I felt like it was sloppy.  Also, I did not add files to be ignored.  So, here is how to add an existing Eclipse project to Git:

Step 1:  In a terminal, change directories to your Eclipse workspace and project (assuming it is called my-project)

cd ~/workspace/my-project

Step 2: intialize the repository

git init

Step 3: add any files you want to ignore — consider any test data that might contain real production data and also consider connection information

vi .git/info/exclude

Assuming you have an Apache Derby database called db, you would exclude all of the database and the log with the following two lines:

db
derby.log

If you want to exclude Eclipse specific files, you may choose to add the following two lines:

.classpath
.project

Step 4: Add your files to your new Git repository

git add .

Step 5: Commit your files to the repository

git commit -m "My-Project inital code"

Step 6: Tag your code with a version

git tag v1.0

Update: You may want to tag this way so other developers see your tag (thanks Dominic):

git tag -a -m "GIT v1.0" v1.0

Now, your git repository is created and contains the code from your Eclipse project.

Resources

Adding a Project to Git and Google Code

This started because I wanted to share a program I had been working on through Google Code.

First, I created the git repository by:

skp@pecan:~/app/workspaces/pscompare$ cd ProjectSarah/
skp@pecan:~/app/workspaces/pscompare/ProjectSarah$ ls
bin  derby.log  export.xml  lib  src  timedb
skp@pecan:~/app/workspaces/pscompare/ProjectSarah$ git init
Initialized empty Git repository in /home/skp/app/workspaces/pscompare/ProjectSarah/.git/
skp@pecan:~/app/workspaces/pscompare/ProjectSarah$ git add .
skp@pecan:~/app/workspaces/pscompare/ProjectSarah$

Then, I did a commit:

skp@pecan:~/app/workspaces/pscompare/ProjectSarah$ git commit -m “First Release”Created initial commit 87fa855: First Release
196 files changed, 3456 insertions(+), 0 deletions(-)
create mode 100644 .classpath
create mode 100644 .project
create mode 100644 bin/com/skp/ProjectSarah/ChangeClientButton.class
create mode 100644 bin/com/skp/ProjectSarah/ClientListener.class
create mode 100644 bin/com/skp/ProjectSarah/CreateTimeViewExcel.class
create mode 100644 bin/com/skp/ProjectSarah/CreateTimesheetsButton.class
create mode 100644 bin/com/skp/ProjectSarah/DateField.class

Now, I created a new directory and started following these directions.  One of the problems I had was logging in.  I had to use the “My Profile” link on the upper right hand corner of Google Code.  That showed what my username was, and then, the password was on the Settings tab.

mkdir ~/app/git-workspace
cd ~/app/git-workspace
git svn clone –username <username> https://project-sarah.googlecode.com/svn/trunk
cd trunk
git fetch ~/app/workspaces/pscompare/ProjectSarah/
git branch tmp $(cut -b-40 .git/FETCH_HEAD)
git tag -a -m “Last fetch” last tmp
INIT_COMMIT=$(git log tmp –pretty=format:%H | tail -1)
git checkout $INIT_COMMIT .
git commit -C $INIT_COMMIT
git rebase master tmp
git branch -M tmp master
git svn dcommit

Now, I was able to browse the source of my program online!

Resources

git branch tmp $(cut -b-40 .git/FETCH_HEAD)

Links about Git

Reading Rich Manalang’s blog, I came across some links relating to git. I am mainly blogging these as a reminder to go back and spend some more time on them at some point.

Source: