In the second installation of my SVK article series, I'm taking my Subversion repository offline on my notebook, do some work, reconnect and merge my changes with the central Subversion repository.
To work with SVK, you don't need the Subversion service (svnserve) running. Another bonus is that SVK doesn't create the (dreaded, I might say) .svn folders, which (a) roughly double the disk size of your project, (b) get you into hot water with VS.NET, which is why there is a TortoiseSVN build that names the .svn folders differently. But I digress.
First, we have to create a local copy (the one created in the previous article is directly linked to the remote repository):
svk cp //SharpDevelop/trunk //SharpDevelop/local
This will also prompt you in Notepad for a commit message. Alternatively, you could have passed the commit message as part of the cmd line:
svk cp -m "initial import" //SharpDevelop/trunk //SharpDevelop/local
Now, check out the local branch to a directory on disk (note: this directory will be auto-created).
svk checkout //SharpDevelop/local c:\workingcopy
You will be positively surprised how fast this is. And there are no .svn directories in sight. So let's change a file and commit it back to our local repository:
svk commit -m "v2.06 note" readme.txt
This file is only changed in the local repository, not the remote one. But this is the intention of working offline (during travel, at home, you name it).
How do we get the changes back into the central repository? First, sync the trunk with the remote repository:
svk sync //SharpDevelop/trunk
If you have multiple repositories on your computer that you want to sync in one go, use:
svk sync -a
So, let's see if our changes conflict with changes in the central repository:
svk smerge -C //SharpDevelop/local //SharpDevelop/trunk
Auto-merging (0, 1900) /SharpDevelop/local to /SharpDevelop/trunk (base /SharpDevelop/trunk:1897).
Checking locally against mirror source svn://glumpatweri.emailgwiax.com/Fidalgo/trunk.
U SharpDevelop/setup/readme.txt
New merge ticket: 4c8874e7-0e9e-2041-95c6-598e77699a82:/SharpDevelop/local:1900
If there are no problems (as is the case here), go ahead and perform the merge:
svk smerge //SharpDevelop/local //SharpDevelop/trunk
You are again prompted for the commit message, however, this time remember this is for the total of your changes (unless you use -I). Depending on your Subversion setup, you will be prompted to provide a password:
Password for 'Administrator':
Well, most likely you are not known by this account in Subversion... simply press Enter, and you will be prompted for a different username. A tad counterintuitive at first, but it works. The change is now in the central repository.
There is one thing left to do - merge the changes from the trunk (which you synced previously) into the local copy:
svk smerge //SharpDevelop/trunk //SharpDevelop/local
And finally update your checked out working directory:
svk up c:\workingcopy
Now that wasn't too bad at all. Especially given the fact that you were working offline from a central repository. Oh, and the procedure is for real: revision 1909 in the #develop repository resulted from me writing this step list.