Sunday, May 16, 2010

Updating Source Code

I think I was a little too cryptic in my blog entitled Posting Source Code. I referred back to it when I needed to update the source code on my project site, and found it fell short of being helpful.

I shall try to be a bit more explicit in describing how I checked out what was in the repository, and after making some changes, updated it.

When first using CollabNet Subversion I made the mistake of cluttering my home computer with the server. I am on a new machine now, and I took care to get the command-line client from the CollabNet Download page.

After installing the client, I was pleasantly surprised to observe that it ran happily from my Windows home directory. That is in stark contrast to Java, which requires paths to be set up by the user.

The command I needed to download my code into a working directory was

svn checkout URL [PATH] --USERNAME

where URL is location of my repository and PATH is the path to the local directory. My URL is:

https://java.net/projects/rasch-itembank/svn/rasch-itembank/trunk

and my local path for the day is:

"my documents\code\100515"

To edit the source code I use jEdit, and because this is an exercise in downloading from and uploading to a remote repository, I just add a few comments to each source file.

I was fiddling about with this overnight, so I used the update command to check for any other activity. This was an academic exercise, because I am currently the only user, but I wanted to work through the proper procedure. The syntax of the command is:

svn update [PATH]

In my case this translates as:

svn update "my documents\code\100515"

The response came back:

At revision 5

The absence of any user listing confirms that no one else has worked on the code in the repository.

Again following on with the procedure recommended in the book, I used the status command as follows:

svn status "my documents\code\100515"

And got the following list of modified files.

M My Documents\Code\100515\QDiv.java
M My Documents\Code\100515\QTrack.java
M My Documents\Code\100515\AMJApp.java
M My Documents\Code\100515\QAdd.java
M My Documents\Code\100515\QSub.java
M My Documents\Code\100515\QMul.java

I used the status command, with identical syntax, to display a full list of the changes I had made.

As there are currently no other users I could skip the conflict resolution steps, because the were no conflicts to resolve. I could therefore jump straight to the commit command as follows:

svn commit "my documents\code\100515" -m "Just added
a few comments to test the update procedure"

And got the following list of actions carried out.

Sending My Documents\Code\100515\AMJApp.java
Sending My Documents\Code\100515\QAdd.java
Sending My Documents\Code\100515\QDiv.java
Sending My Documents\Code\100515\QMul.java
Sending My Documents\Code\100515\QSub.java
Sending My Documents\Code\100515\QTrack.java
Transmitting file data ......
Committed revision 6.

Hopefully this is a clearer set of instructions than my last effort, so if I come back here in six months time, I'll actually understand what I've written.