Fossil Beginer Tutorial

0
(ツ) admin
Last edited: 02.03.2023 by admin
4340
19.11.2022

Fossil is a single-EXE, cross-platform, distributed source control management program written by SQLite author Dr. Richard Hipp. Unsurprisingly, data is saved in an SQLite database file, making it very easy to back up. The repository can live anywhere on your filesystem.

Some useful Fossil tutorial:

https://fossil-scm.org/home/doc/trunk/www/quickstart.wiki

http://www.fredshack.com/docs/fossil.html

To commit only some selected file, use this command:

fossil commit source/accounts.asm source/commands.asm -m "fix sendemail in differ language"

Open web UI:

fossil ui

To see which files had changes:

fossil changes

To see more about changes in file:

fossil diff
Attached files:
FileSizeUploadedDownloadsMD5 hash
tutorial2.png18581 bytes02.03.2023509fbf5149394ae02dec27ee1d659b52ad5
4332
20.11.2022

Original Tutorial: https://opensource.com/article/20/11/fossil

Install Fossil

Fossil is a single, self-contained C program, so you can probably just download Fossil from its website and place it anywhere in your system PATH. For example, assuming /usr/local/bin is in your path, as it usually is by default:

$ wget https://fossil-scm.org/home/uv/fossil-linux-x64-2.20.tar.gz
$ sudo tar xvf fossil-linux-x64-X.Y.tar.gz --directory /usr/local/bin

Create a Fossil repository

$ fossil init myproject.fossil
project-id: 010836ac6112fefb0b015702152d447c8c1d8604
server-id:  54d837e9dc938ba1caa56d31b99c35a4c9627f44
admin-user: klaatu (initial password is "14b605")

Creating a Fossil repo returns three items: a unique project ID, a unique server ID, and an admin ID and password. The project and server IDs are version numbers. The admin credentials establish your ownership of this repository and can be used if you decide to run Fossil as a server for other users to access.

Work in a Fossil repository

To start working in a Fossil repo, you must create a working location for its data. You might think of this process as creating a virtual environment in Python or unzipping a ZIP file that you intend to zip back up again later.

Create a working directory and change into it:

$ mkdir myprojectdir
$ cd myprojectdir

Open your Fossil repository into the directory you created:

$ fossil open ../myproject
project-name: <unnamed>
repository:   /home/klaatu/myprojectdir/../myproject
local-root:   /home/klaatu/myprojectdir/
config-db:    /home/klaatu/.fossil
project-code: 010836ac6112fefb0b015702152d447c8c1d8604
checkout:     9e6cd96dd675544c58a246520ad58cdd460d1559 2020-11-09 04:09:35 UTC
tags:         trunk
comment:      initial empty check-in (user: klaatu)
check-ins:    1

You might notice that Fossil created a hidden file called .fossil in your home directory to track your global Fossil preferences. This is not specific to your project; it's just an artifact of the first time you use Fossil.

Add files

To add files to your repository, use the add and commit subcommands. For example, create a simple README file and add it to the repository:

$ echo "My first Fossil project" > README
$ fossil add README
ADDED  README
$ fossil commit -m 'My first commit'
New_Version: 2472a43acd11c93d08314e852dedfc6a476403695e44f47061607e4e90ad01aa

Use branches

By default, a Fossile repository starts with a main branch called trunk. You can branch off the trunk when you want to work on code without affecting your primary codebase. Creating a new branch requires the branch subcommand, along with a new branch name and the branch you want to use as the basis for your new one. In this example, the only branch is trunk, so try creating a new branch called dev:

$ fossil branch --help
Usage: fossil branch new BRANCH-NAME BASIS ?OPTIONS?
$ fossil branch new dev trunk
New branch: cb90e9c6f23a9c98e0c3656d7e18d320fa52e666700b12b5ebbc4674a0703695

You've created a new branch, but your current branch is still trunk:

$ fossil branch current
trunk

To make your new dev branch active, use the checkout command:

$ fossil checkout dev
dev

Merge changes

Suppose you add an exciting new file to your dev branch, and having tested it, you're satisfied that it's ready to take its place in trunk. This is called a merge.

First, change your branch back to your target branch (in this example, that's trunk):

$ fossil checkout trunk
trunk
$ ls
README

Your new file (or any changes you made to an existing file) doesn't exist there yet, but that's what performing the merge will take care of:

$ fossil merge dev
 "fossil undo" is available to undo changes to the working checkout.
$ ls
myfile.lua  README

View the Fossil timeline

To see the history of your repository, use the timeline option. This shows a detailed list of all activity in your repository, including a hash representing the change, the commit message you provided when committing code, and who made the change:


$ fossil timeline
=== 2020-11-09 ===
06:24:16 [5ef06e668b] added exciting new file (user: klaatu tags: dev)
06:11:19 [cb90e9c6f2] Create new branch named "dev" (user: klaatu tags: dev)
06:08:09 [a2bb73e4a3] *CURRENT* some additions were made (user: klaatu tags: trunk)
06:00:47 [2472a43acd] This is my first commit. (user: klaatu tags: trunk)
04:09:35 [9e6cd96dd6] initial empty check-in (user: klaatu tags: trunk)
+++ no more data (5) +++

Make your Fossil repository public

Because Fossil features a built-in web interface, Fossil doesn't need a hosting service like GitLab or Gitea do. Fossil is its own hosting service, as long as you have a server to put it on. Before making your Fossil project public, though, you must configure some attributes through the web user interface (UI).

Launch a local instance with the ui subcommand:

$ pwd
/home/klaatu/myprojectdir/
$ fossil ui

Specifically, look at Users and Settings for security, and Configuration for project properties (including a proper title). The web interface isn't just a convenience function. It's intended for actual use and is indeed used as the host for the Fossil project. There are several surprisingly advanced options, from user management (or self-management, if you please) to single-sign-on (SSO) with other Fossil repositories on the same server.

Once you're satisfied with your changes, close the web interface and press Ctrl+C to stop the UI engine from running. Commit your web changes just as you would any other update:

$ fossil commit -m 'web ui updates'
New_Version: 11fe7f2855a3246c303df00ec725d0fca526fa0b83fa67c95db92283e8273c60

Now you're ready to set up your Fossil server.

1. Copy your Fossil repository (in this example, myproject.fossil ) to your server. You only need the single file. 2. Install Fossil on your server, if it's not already installed. The process for installing Fossil to your server is the same as it was for your local computer. 3. In your cgi-bin directory (or the equivalent of that directory, depending upon which HTTP daemon you're running), create a file called repo_myproject.cgi:

#!/usr/local/bin/fossil
repository: /home/klaatu/public_html/myproject.fossil

Make the script executable:

$ chmod +x repo_myproject.cgi

That's all there is to it. Your project is now live on the internet.

You can visit the web UI by navigating to your CGI script, such as https://example.com/cgi-bin/repo_myproject.cgi.

Or you can interact with your repository from a terminal through the same URL:

$ fossil clone https://[email protected]/cgi-bin/repo_myproject.cgi

Working with a local clone requires you to use the push subcommand to send local changes back to your remote repository and the pull subcommand to get remotely made changes into your local copy:

$ fossil push https://[email protected]/cgi-bin/repo_myproject.cgi
(ツ) admin
Last edited: 09.01.2024 by admin
3562
21.09.2023

To commit and create new branch:

fossil commit -m "support new feature" --branch YOURNEWBRANCH

Check out no sync:

fossil open ../dev_asmbb.fossil --nosync

Turn off autosync in setting:

fossil settings autosync off

List all branches:

fossil branch ls

Change branches:

fossil co yourbranchname

To discard ALL changes to current checkout:

fossil revert 

Fossil Beginer Tutorial

0