SmartGit – 6th Milestone

A new milestone build of SmartGit, a client for the distributed version control system (DVCS) Git, is available.

The most notable changes are:

  • basic submodule support
  • gravatar support in the log
  • basic GitHub integration

All changes can be found in the change log.

We would like to invite everyone to give this build a try and share your ideas with us. Join the SmartGit community!

Download SmartGit


SmartGit requires a Git installation on your system.

Start a Command Line Shell Window on Windows

When I right click a directory in our SVN client SmartSVN or Git client SmartGit on Windows — especially the latter, because it does not yet support all Git commands — I want to open a command line shell window.
Although it is easy to execute a command with cmd.exe, it seems not that obvious how to open a command line shell window.

Here is the solution:

  • open the Preferences and select the page to configure the directory command (in SmartSVN it is named Directory Command, in SmartGit Directory Tool)
  • in the Command input field specify the path to the cmd.exe, for my Windows XP system C:\Windows\system32\cmd.exe
  • in the Arguments input field enter
    /c "start pushd ""${directoryPath}"""

The arguments are the tricky part. Basically, the cmd.exe needs two arguments, /c and the command to execute. Because our command contains spaces, we need to wrap it in quotes. If the actual directory path contains spaces, we need to surround the placeholder with quotes by specifying double quotes. If, for example, the command would be executed for the path E:\my projects\foo, the second parameter will actually be
start pushd "E:\my projects\foo"

What does the switches and commands mean? The /c switch tells cmd.exe to execute the following command line parameter as command. The start command makes the command line window occur and the pushd seems to be some kind of hack to switch to the directory which is the next parameter.

Taking programmatic control over SmartSVN

While SmartSVN is running, it can receive commands to be executed, like opening a file compare for a versioned file. This is how the Windows Explorer Integration and the Mac OS X Finder Integration are working. This article will show how to use this socket-based command API for custom integrations of SmartSVN.

First of all, SmartSVN has to be started, either normally or by supplying the --server-mode command line parameter (requires Java 6) which prevents a project window to occur. On Windows you may execute: bin/smartsvn.exe --server-mode. On Unix you may use bin/ --server-mode. A platform-independent way to start SmartSVN is java --jar smartsvn.jar --server-mode which will work fine on Mac OS X.

Once SmartSVN has been started, it will create a port-file within its settings directory immediately. It contains the port number for client connections. To perform a SmartSVN command, a new socket should be created connecting to this port at host, then the communication can start.

The protocol is very simple: The client sends the command name, terminated by \n. Then it sends the absolute file paths to be used by the command, every path on a separate line, terminated by \n. Finally it sends one more empty line, i.e. just \n. For example:

(empty line)

Note, that the text has to be escaped like character and string literals have to be escaped in Java source code, e.g. on Windows the backslash \ has to be escaped \\.

Depending on the command, SmartSVN will return a response. In case of our get-states example, this could be:

d:\\working-copy\\a.txt <tab> unchanged
d:\\working-copy\\b.txt <tab> unchanged
d:\\working-copy\\c.txt <tab> modified
(empty line)

Here, file a.txt and b.txt are reported as unchanged while file c.txt is modified.

Actually, only the get-states command has a response. For all other commands the socket will be closed immediately after having received the final trailing empty line. Other available commands are:

  • add
  • annotate
  • cleanup
  • commit
  • compare
  • ignore
  • lock
  • unlock
  • log
  • rename
  • remove
  • resolve
  • revert
  • revision-graph
  • update

For example, to open SmartSVN’s File Compare for c.txt, following lines should be sent:

(empty line)

When implementing a communication with SmartSVN’s server it may be helpful to set the logging level for the smartsvn.server category to debug. For details refer to the Technical Articles.

The attached Java class contains a complete example implementation, which connects to a running SmartSVN instance, scans a working copy directory for a modified file and then opens the File Compare.

Tips for Migrating from CVS to SVN

I was asked by a couple of CVS users who want to start with SVN (using our SVN client SmartSVN) about some tips how to avoid common pitfalls. So, from my personal experience and from problems we have got reported by our users, I would consider following issues as notable:

With SVN you don’t have tags and branches as a built-in feature like in CVS. Instead, tags and branches are handled by using special paths and SVN’s cheap copy feature. Don’t try to reinvent the wheel but better stick with a default repository layout:

[-] project1
| [-] branches
| | [+] branch1
| | [+] branch2
| [-] tags
| | [+] tag1
| | [+] tag2
| [+] trunk
[-] project2
| [-] branches
| | [+] branch1
| | [+] branch2
| [-] tags
| | [+] tag1
| | [+] tag2
| [+] trunk

Quite often people check out the whole repository or project including all tags and branches. Don’t do that but only check out either the trunk or a specific tag or branch. It is quite easy to “switch” between them.

With CVS it often was common practice to add a certain tag to only a few files. Forget about tagging individual files in SVN.
SVN can tag (aka copy) large parts of the repository as effective as just a small part.
Another advantage of tagging always the full repository is that you are able to switch easily to that project state.
If you have used file-based (not (only) project-based) tags in CVS and history doesn’t really matter to you, better import fresh project states in the SVN repository and don’t convert the CVS repository to SVN.

A lot of projects consist of multiple parts. With CVS you might have used CVS modules or shell scripts to check out from different repository locations or different repositories.
SVN’s externals are a much better concept and should be used instead.