The Tcl developers have now switched from CVS to and new and shiny distributed version control system. There are an number of these to select from with various advantages and disadvantages. Git is perhaps the most famous and possibly the most powerful although it can be unintuitive for Windows users. Mercurial is getting extremely popular as it works fairly smoothly on Windows as well as unix platforms. Bazaar appears to be another contender.

Tcl has chosen fossil. This is a rather less well known DVCS written by the guy who did sqlite. It seems to do what all the others do. So we are going to be using fossil.

Fossil holds the repository files in an sqlite file so we create a clone database and then 'open' a working tree from this repository file.

fossil clone http://mirror1.tcl.tk/tcl /opt/repos/tcl.fossil
mkdir /opt/src/tcl
cd /opt/src/tcl
fossil open /opt/repos/tcl.fossil

Following this procedure we now have a local repository that we can share and a working tree that we can build. To pull in more changes from the remote we can to fossil pull and then use fossil update when we want to update the working tree or switch to another branch (eg: fossil update core-8-5-branch).

% fossil update
Autosync:  http://core.tcl.tk/tk
                Bytes      Cards  Artifacts     Deltas
Sent:             130          1          0          0

Huh? I was only trying to update from the local repository. Why is it talking to the network? This might not be a problem but at the time I was offline with no WiFi link. It turns out that fossil has per-repository settings (fossil settings) and one of these (autosync) makes it work like CVS. We need to disable this using fossil settings autosync 0. And I'll need to do that each time I make a clone. At least it now works like a typical DVCS.

Now to setup on the Windows machine. To save bandwidth I'll use a copy of the repo I obtained earlier on the linux machine and update it. This is partly because cloning the tcl core repository is really damn slow - apparently because the Tcl core machine is bandwidth limited.

C:\opt\tcl\src\tk>fossil open /opt/repos/tk.fossil
c:\opt\bin\fossil.exe: incorrect repository schema version
c:\opt\bin\fossil.exe: you have version "2011-02-25 14:52" but you need version
"2011-01-28"
c:\opt\bin\fossil.exe: run "fossil rebuild" to fix this problem

Hmm. We seem to be exposing our guts a bit here. So a given repository would only seem to work with a given version of fossil? A sign of an immature system I think. At least it told me how to fix this.

C:\opt\tcl\src\tk>fossil rebuild -R /opt/repos/tk.fossil
  100.0% complete...

C:\opt\tcl\src\tk>fossil open /opt/repos/tk.fossil
c:\opt\bin\fossil.exe: already within an open tree rooted at C:/opt/tcl/src/tk/

Huh!

C:\opt\tcl\src\tk>dir
 Volume in drive C has no label.
 Volume Serial Number is 56FF-5C9C

 Directory of C:\opt\tcl\src\tk

10/03/2011  12:15    <DIR>          .
10/03/2011  12:15    <DIR>          ..
10/03/2011  12:15             7,168 _FOSSIL_
               1 File(s)          7,168 bytes
               2 Dir(s)  163,961,884,672 bytes free

Delete and repeat.

C:\opt\tcl\src\tk>fossil open /opt/repos/tk.fossil

C:\opt\tcl\src\tk>fossil pull
Server:    http://core.tcl.tk/tk/
via proxy: http://uknml1869:3129/
                Bytes      Cards  Artifacts     Deltas
Sent:             146          2          0          0
Received:        2854         62          0          0
Sent:             741         15          0          0
Received:        6766         74          5          8
Total network traffic: 876 bytes sent, 2983 bytes received

C:\opt\tcl\src\tk>fossil update
UPDATE ChangeLog
REMOVE doc/.cvsignore
REMOVE unix/.cvsignore
UPDATE unix/configure.in
REMOVE win/.cvsignore
--------------
updated-to:   53d9debe536c57e0f54b7ab88dc941e57cf21edb 2011-03-09 17:03:34 UTC
tags:         trunk
comment:      Fix libXft check (user: rmax)
"fossil undo" is available to undo changes to the working checkout.

C:\opt\tcl\src\tk>fossil branch
  core-8-4-branch
  core-8-5-branch
* trunk

Great. We now have a current checkout of Tk and I can go and commit a patch I've been nursing in my git repository.