site  contact  subhomenews

Fossil version control

November 11, 2009 — BarryK
I was recently evaluating Dim version control, see my blog report:

http://bkhome.org/archive/blog2/200911/dim-version-control.html

Dim is a Bash/Ash shell script, and a PHP script for the web site. Very small, but at this stage there is a lot on the to-do list.

Then technosaurus informed me about Fossil, a "small and simple" version control system. So, I have now started to evaluate Fossil.

Fossil homepage: http://www.fossil-scm.org/

...read that, and it sure does seem impressive!

Fossil has a single binary executable, named 'fossil'. I compiled it and it is 652KB. That's the whole thing, all you need to install Fossil, and the executable even has the Sqlite database compiled statically into the executable -- which is good for uploading to a website that might not have shared Sqlite library (or wrong version).
However, technosaurus has figured out how to compile Fossil against shared Sqlite library if you want.

Install on website
Having had just about zero experience with installing and setting up a version control system (only a limited play with Dim), I was scratching my head. But forged ahead, and it turned out to be a simple procedure, very simple. It will be useful to others I reckon, for me to document it here...

My first problem was where to upload the 'fossil' executable, as I only have a shared hosting website (with hostgator.com). I can't just bung it into the system /bin directory! Well, I took a punt, and created a 'bin' directory: /home/<username>/bin.
/home/<username> is where I am when I do an ftp or ssh login.
I then uploaded 'fossil' to the 'bin' directory. I set permission of 'bin' to 755 and 'fossil' to 755.

I then created directories <path to bkhome.org root>/fossil/woof, set permissions at 755.
Inside 'woof' I created a script 'woof.cgi' (755) with this in it:

#!/home/<username>/bin/fossil

repository: <path to bkhome.org root>/fossil/woof/woof.fossil


...of course, if you want to do this yourself, you will have to substitute the appropriate text into "< ... >".

I also created a '.htaccess' file (644) in fossil/woof directory with this in it:

AddHandler cgi-script .cgi

Options ExecCGI FollowSymLinks
RewriteEngine On
RewriteBase /fossil/woof/
RewriteRule ^$ woof.cgi


...I wanted to completely hide the 'woof.cgi' script from the URL that users would see, but I couldn't figure out how to do that. Instead, the above just allows a URL "http://bkhome.org/fossil/woof/" which will run the 'woof.cgi' script -- but then the user still sees the full URL with "woof.cgi" in it. If anyone is an expert on Apache mod_rewrite, advice welcome!

Almost there. I needed an empty "repository" to get going. I created it like this (locally, on my own computer):

> fossil new woof.fossil

I then uploaded 'woof.fossil' to fossil/woof by sftp and set permissions to 744.

Finally, I pointed my web browser here:

http://bkhome.org/fossil/woof/

...hey man, it works! A very pleasant experience, I must say. I just followed my nose, doing logical things to set it up, not many steps required, and it works as advertised.

Install on local computer
Just copy the 'fossil' executable to the execute-path, such as /usr/bin.

As far as usage goes, well, I'm just getting started. As I commented above, I have zero experience. Yeah, I have had occasion to checkout from various CVS/SVN/GIT hosted projects, and always followed whatever instructions they provided. Beyond that, I know nothing.

I haven't yet put any files into my 'woof.fossil' repository. It is important to note that the entire project resides in that one file. It has its own internal Sqlite database, and all files, all revisions, will be inside 'woof.fossil'. So, the file may grow quite large!

An obvious first thing to do is, how to download my online 'woof.fossil' repository to my local computer?

A good place to look for basic usage instructions is the Fossil Quick Start Guide:
http://www.fossil-scm.org/index.html/doc/tip/www/quickstart.wiki

Alright, this seems to be what is needed:

> fossil clone http://bkhome.org/fossil/woof/ woof.fossil

...amazing, it works! Be sure to write down the username and password it reports.

I notice though, it did not download the configuration I had done to the online woof.fossil -- title and logo -- the downloaded woof.fossil is empty, no default title and logo -- so, is something wrong?

To use the web interface for looking inside the repository, run:

> fossil ui woof.fossil

...at the time of writing I have not yet configured 'woof.fossil' to auto-launch the web browser, so manually start your web browser and look at:

http://127.0.0.1:8080/

When finished, CTRL-C in the terminal window to kill the fossil web server.

The logical next thing to do is checkout a project-tree. That is, extract the latest version of the project from the repository:

> mkdir woof-tree
> cd woof-tree
> fossil open ../woof.fossil


Now I want to create a file in my project, and add it to the repository:

> echo "test file number one" > NewFile1
> fossil add NewFile1
> fossil commit -m "first test commit NewFile1" --nosign
> fossil close
> cd ..


Problems

1.
The downloaded repository does not have stuff in it that I had put into the online 'woof.fossil'.

2.
"Autosync" is by default turned on, and when I ran the above commit, it reported that it was also uploading to my online repository. However, when I point my browser at the online Woof repository, there is nothing, zilch.

3.
Unfortunately, it gets worse. When I attempted to reopen my local 'woof.fossil':

> cd woof-tree
> fossil open ../woof.fossil

<some stuff>
Segmentation fault

...but it was then open.

So, the current situation for me is that it does not "just work". Probably I'm doing something wrong, as there are obviously other happy Fossil users. Anyway, I'll keep experimenting.

I looked at my website error log, and see this:

File does not exist: <path to bkhome.org root>/fossil/woof/xfer

I did try various ways of uploading. For example, these two:
> fossil push http://bkhome.org/fossil/woof/woof.cgi --repository woof.fossil
> fossil push http://bkhome.org/fossil/woof/woof.cgi/xfer --repository woof.fossil
...in both cases got a "bad command".

Comments

Fossil progress
Username: BarryK
My attempt to get Fossil working continues in the next blog post: http://bkhome.org/archive/blog2/200911/fossil-progress.html


Tags: woof