Misc

Fossil README
Login

Fossil README

When in doubt, first refer to the official Fossil docs.
The information found here may be outdated.

Quick start

http://fossil-scm.org/index.html/doc/trunk/www/fiveminutes.wiki

Concepts

http://fossil-scm.org/xfer/doc/tip/www/concepts.wiki

Install Fossil executable on server (done once)

ssh <YOUR-SERVER>
cd src
wget https://fossil-scm.org/index.html/uv/fossil-src-2.8.tar.gz
tar xvfz fossil-src-2.8.tar.gz
cd fossil-src-2.8/
./configure --prefix=$HOME
make
make install
which fossil
<YOUR-SERVER-HOME>/bin/fossil

Install on local

For a first-time install, use package (BSD/Linux) or precompiled binary (Windows/Mac).
For consequent upgrades, clone source directly from Fossil's website...

fossil clone http://www.fossil-scm.org

... or clone repos on server, and then clone from server.
(Clone from server has the advantage to always have the same version on all local computers, as long as their repos are updated.)

fossil clone ssh://<YOUR-USERNAME>@<YOUR-SERVER>/<YOUR-SERVER-HOME>/fossil/repos/fossil.fossil /path/to/fossil.fossil

Build on local

UNIX

./configure
make
FOSS_DIR=`pwd`
cd $HOME/bin
ln -s $FOSS_DIR/fossil

MSYS2 (do not use win/Makefile.mingw!)

./configure --with-zlib=compat
make
cp fossil.exe /usr/bin/

MinGW (not tested)

make -f win/Make.mingw
cp fossil.exe /usr/bin/

Use repos on remote server as main repos

Create first local repos

mkdir -p /usr/home/kuuse/fossil/repos
mkdir -p /usr/home/kuuse/fossil/src
fossil new /usr/home/kuuse/fossil/repos/readme.fossil
  Initial fossil password: 0fc134
cd /usr/home/kuuse/fossil/src
fossil open /usr/home/kuuse/fossil/repos/readme.fossil
touch main.c
fossil add .
fossil commit -m "Initial commit"
2. copy repos to remote: 
local:
scp /usr/home/kuuse/fossil/repos/readme.fossil redantig@redantigua.com:repos/
remote:
cd $HOME/repos 
    fossil init project-name.fossil
        SQLITE_ERROR: table blob already exists
        fossil: table blob already exists
        If you have recently updated your fossil executable, you might
        need to run "fossil all rebuild" to bring the repository
        schemas up to date.
    fossil all rebuild
3. clone remote repos to local:
local:
mkdir -p /usr/home/kuuse/fossil/repos/

JustHost

    fossil clone ssh://redantig@redantigua.com://home1/redantig/repos/nest.fossil /home/kuuse/fossil/repos/nest.fossil

A2

    fossil clone ssh://redantig@a2ss29.a2hosting.com:7822//home/redantig/fossil/repos/nest.fossil /home/kuuse/fossil/repos/nest.fossil

In case of error:

Round-trips: 2   Artifacts sent: 0  received: 0
Error: database schema is out-of-date on the server.
Round-trips: 2   Artifacts sent: 0  received: 0
Clone finished with 582 bytes sent, 416 bytes received
server returned an error - clone aborted
remote:
cd /home/redantig/fossil/repos/
fossil rebuild -R nest.fossil
local:
    mkdir -p /usr/home/kuuse/fossil/nest
    cd /usr/home/kuuse/fossil/nest
    fossil open /home/kuuse/fossil/repos/nest.fossil
    ..      # add/edit some files
    fossil commit  # Will ask for password if autosync is on (default)

Clone repos from server (repeated from step 2. above)

fossil clone ssh://redantig@redantigua.com://home1/redantig/repos/nest.fossil /home/kuuse/fossil/repos/nest.fossil
mkdir -p /usr/home/kuuse/fossil/nest
cd /usr/home/kuuse/fossil/nest
fossil open /home/kuuse/fossil/repos/nest.fossil

Autosync - if autosync is ON (the default), push will be done automatically

fossil push                 # only needed if autosync OFF
# Set autosync to OFF
fossil setting autosync off -R /home/kuuse/fossil/repos/nest.fossil
# Check if autosync is ON or OFF
fossil setting autosync 
    autosync             (local)  1
fossil setting autosync off
fossil setting autosync
    autosync             (local)  off
fossil setting autosync on 
fossil setting autosync
    autosync             (local)  on

List unversioned files

touch kk
fossil extra
  kk

Delete added files not yet committed

fossil add kk
fossil changes
  ADDED      kk
fossil delete kk
  DELETED kk
fossil changes
  (no output)

Commit changes

fossil commit -m "Added stuff"

Commit changes when autosync is set to ON and main repos is on remote SSH server - (Password requested twice)

fossil commit -m "Added more text to README.fossil.txt"
Autosync:  ssh://redantig@redantigua.com:0//home1/redantig/repos/nest.fossil
redantig@redantigua.com's password: 
Round-trips: 1   Artifacts sent: 0  received: 0
Pull finished with 343 bytes sent, 1092 bytes received
New_Version: 7372b3b3cd29e16e2cef399015bf6b447ca5fabd
Autosync:  ssh://redantig@redantigua.com:0//home1/redantig/repos/nest.fossil
redantig@redantigua.com's password: 
Round-trips: 1   Artifacts sent: 4  received: 0
Sync finished with 2717 bytes sent, 1188 bytes received

Setup a passwordless SSH connection using SSH keys

REMOTE_SERVER=redantig@redantigua.com
if [ ! -f ~/.ssh/id_rsa.pub ];then
    ssh-keygen -q -t rsa -N "" -f ~/.ssh/id_rsa
    cat ~/.ssh/id_rsa.pub | ssh ${REMOTE_SERVER} "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
fi

Get file info (commit history) of a file, useful for diffs

fossil finfo main.c
    2014-10-07 [63e4f2417a] Added more stuff (user: kuuse, artifact: [bb22857c72],
        branch: trunk)
    2014-10-07 [52cb824701] Added stuff (user: kuuse, artifact: [a035ec101a],
        branch: trunk)

Diff

fossil gdiff main.c
  (no output)
fossil gdiff --from 52cb824701 --to 63e4f2417a main.c
or
fossil gdiff --from 63e4f2417a --to 52cb824701 main.c
  --- main.c
  +++ main.c
  @@ -3,9 +3,8 @@
   int
   main(int argc, char *argv[])
   {
       printf("Hello, world!\n");
       printf("Hello, world2!\n");
  -    printf("Hello, world3!\n");

       return 0;
   }

External graphical diff tool

fossil setting gdiff-command meld
fossil gdiff --from 52cb824701 --to 63e4f2417a main.c

Meld: MS Windows

fossil setting --global gdiff-command \"/c/Program\ Files\ \(x86\)/Meld/Meld.exe\"

Export/Import Git <--> Fossil

Import from Git

cd git-repo
git fast-export --all | fossil import --git new-repo.fossil

Example:

cd /home/kuuse/mysrc/nest
git fast-export --all | fossil import --git /home/kuuse/fossil/repos/nest.fossil
admin-user: kuuse (password is "2e6c6d")

Keep local check-out up to date:

fossil update <trunk> # Optionally, switch to another branch

Clone a repos (to another database file, not a source code tree)

fossil clone file:///home/kuuse/fossil/repos/somerepos.fossil somerepos-copy.fossil
admin-user: kuuse (password is "c897f9")

Export to Git

git init new-repo
cd new-repo
fossil export --git ../repo.fossil | git fast-import

Bug tracking

http://fossil-scm.org/index.html/doc/tip/www/bugtheory.wiki
http://www.fossil-scm.org/fossil/doc/trunk/www/tickets.wiki
http://www.fossil-scm.org/fossil/doc/trunk/www/custom_ticket.wiki

Useful commands

fossil info
fossil timeline

Get login/password from command line using sqlite3

Query the DB:

sqlite3 -line /home/redantig/fossil/repos/nest.fossil 'select login,pw from user where login="redantig";'

Merge a branch into trunk

https://www.fossil-scm.org/xfer/doc/tip/www/quickstart.wiki

fossil update trunk
fossil merge featureX
# make sure the merge didn't break anything...
fossil commit -m "Merged feautureX into trunk"

Mark a branch as closed

From the Web UI:

Timeline:
http://kuu.se/fossil/md-docbook.cgi/timeline

Click the last commit in branch (before the merge, if it was merged).

http://kuu.se/fossil/md-docbook.cgi/info/37b4e56340e8507499f5f830d4a961921e05439f

Click edit:
http://kuu.se/fossil/md-docbook.cgi/ci_edit?r=37b4e56340e8507499f5f830d4a961921e05439f

Check the checkbox "Tags:", and type the word "closed" (without quotes). (Optionally, add a comment.)

Sync tickets between remote and local

First create tickets on remote, using the UI.
Then pull tickets to local:

fossil pull

Custom ticket reports are not included by the fossil pull command. The reports are saved in the config area:

fossil config pull ticket

Skin changes are also saved in the config area:

Modify skin locally, push to remote server:

fossil config pull skin

Copy skin from remote server:

fossil config pull skin

Copy all configuration areas from remote server:

fossil config push all

Problem with fossil clone when using non-standard SSH port

The SSH URL syntax when including a port number is ambigous.
This example, using SSH port 7822, works on FreeBSD, but not on MSYS2:

# FAILS ON MSYS2
fossil clone ssh://redantig@kuu.se:7822//home/redantig/fossil/repos/navbar.fossil navbar.fossil

A workaround is to changed Fossil's ssh-command and then forget about the SSH port completely:

# WORKS ON BOTH FREEBSD AND MSYS2
fossil settings --global ssh-command "ssh -p 7822"
fossil clone ssh://redantig@kuu.se//home/redantig/fossil/repos/navbar.fossil navbar.fossil

Change remote repos URL

cd fossil/nest/objcopy
fossil remote ssh://redantig@kuu.se//home/redantig/fossil/repos/objcopy.fossil