This is a quick walk-through of working with a
Google Code project, using
{{{svk}}} instead of
svn on the client-side.
Why
{{tt{svk}}}?
- svn requires you to have a network connection to Google Code in order to commit any changes.
- svk allows you work fully disconnected, only reconnecting to push back your changesets, or to pull updates from others.
- svk features a much nicer merge algorithm that eliminates the need to manually track revisions that have been merged (as svn requires you to do).
- On a personal note, the only version control systems I've used up to this point have been darcs and mercurial, which are both distributed systems. The "svk" way of working seems much more natural to me than svn does.
Getting started
- The first thing I did was to create a new project. I named the project boodebr.
- Once this was done, my new project was immediately available at http://boodebr.googlecode.com
Lets look at how to do "guest" (read-only) access as well as author/contributor (read-write) access below.
Guests access (read-only) via svk
First, create a mirror of the
svn repository:
svk mirror //mirror/boodebr http://boodebr.googlecode.com/svn/trunk/
Lets create a working copy:
svk sync -a
svk co //mirror/boodebr
Since we're only doing read-only access, I'm checking out directly from the mirror instead of creating a local copy of the repository like I would for read-write access. See the notes on disconnected operation in next section.
You'll want to grab the latest updates periodically:
svk sync -a
svk update boodebr
To completely wipe out our mirror and working copy:
svk co -d boodebr
svk mirror -d //mirror/boodebr
Author/contributor access (read-write) via svk
Make sure you know your googlecode login and password (you can find them here).The first step is to create a mirror of the
svn repository:
svk mirror //mirror/boodebr https://boodebr.googlecode.com/svn/trunk/
This uses https instead of http since we're logging in!
This will prompt you for a few things:
- When it shows you the certificate information, select (p)ermanently so it won't ask you every time.
At this point I received the following error: RA layer request failed: PROPFIND request failed on '/svn/trunk': PROPFIND of '/svn/trunk': Could not read status line: Secure connection truncated (https://boodebr.googlecode.com)
Simply re-running the command fixed it. - It will then say Password for 'YourLogin'. If 'YourLogin' is not the same as your google-code login, simply press ENTER and it will let you enter your correct username and password.
Its probably a good idea to go ahead and
sync first:
svk sync //mirror/boodebr
To use
svk for "disconnected" operation, you need to create a local copy of the repository:
svk cp -p -m "Make local repo" //mirror/boodebr //local/boodebr
Now checkout your working copy from
//local/boodebr,
not //mirror/boodebr:
svk co //local/boodebr
Go about your work, editing files, commiting changes (
svk ci), etc.
To pull updates from google-code, merging with your working copy (if needed):
svk sync -a
svk smerge -lt .
When you are ready to push back to google-code:
svk smerge -Ilf .
You might want to add -C to preview what will happen before you do it.
When smerge -Ilf fails ...
svk has what
appears to me to be a bug in that it will try to make you merge conflicts twice - once when pulling from svn and once when pushing back. Whenever you do a merge with conflicts, I recommend doing:
svk smerge -Ilf . -C
If this tells you there are conflicts, then you cannot use
smerge -Ilf (
unless you really want to redo the merge, that is!). Instead, use
smerge -lf .. This is not great, since it pushes your changes in one large chunk instead of incrementally, but this is the only solution I've found so far!
push & pull
The above bug (or feature?) is why I recommend against using svk push and svk pull. Using smerge gives you access to more features and makes it easier to control what is happening. push and pull are fairly 'opaque' and if they fail you don't have much recourse.
This has just been a quick introduction to Google-Code-via-svk. If you have any suggestions or corrections, please let me know below!