Step by Step: Version Control with Fossil Part 2

PART 2 of 4

This session will cover the basic use case on fossil-fuel tools.
Alice and Bob have to develop a “timer” program together. Alice will focus on timer logic, while Bob will focus on GUI logic.
Download timer project here.



Creating A Repository

First of all, let create a repository in the local computer. Open the command prompt. CD to the target folder and run the command as follows.

C:\Tutorial\AliceDocument>fossil init --admin-user Alice timer
project-id: 9d1c631ddafdecd97984be744c0db97a01618122
server-id:  50f5cb0b39b834aca227cf44e7f1cb02f3bb4fbd
admin-user: Alice (initial password is "4c5281")

Fossil “init” command option
Description
--admin-user Alice
First user for the repository named Alice
timer
The name of project

Then, run the open command to open the repository.

C:\Tutorial\AliceDocument>fossil open timer
project-name: <unnamed>
repository:   C:/Tutorial/AliceDocument/timer
local-root:   C:/Tutorial/AliceDocument/
config-db:    C:/Users/Apivan/AppData/Local/_fossil
project-code: 9d1c631ddafdecd97984be744c0db97a01618122
checkout:     9c0ad66ac7f584a2b03b80a6c2097db22292781b 2015-05-30 05:50:21 UTC
leaf:         open
tags:         trunk
comment:      initial empty check-in (user: Alice)
check-ins:    1




Add files to repository

Copy the all files in Iteration/Iteration0 to the AliceDocument folder, and add all files with the add command as follows. The * means all files


C:\Tutorial\AliceDocument>fossil add *
ADDED  build.xml
ADDED  manifest.mf
ADDED  nbproject/build-impl.xml
ADDED  nbproject/configs/Run_as_WebStart.properties
ADDED  nbproject/configs/Run_in_Browser.properties
ADDED  nbproject/genfiles.properties
ADDED  nbproject/jfx-impl.xml
ADDED  nbproject/project.properties
ADDED  nbproject/project.xml
ADDED  src/timer/FXMLDocument.fxml
ADDED  src/timer/FXMLDocumentController.java
ADDED  src/timer/Timer.java
ADDED  test/CountDownTimerTest.java

Then, identify yourself. By default, fossil will use your computer name as username. Thus, if your system is consistent with the computer name, this step can be skipped.


D:\LearnFossil\learnfossil\AliceDocument>fossil user default Alice 

 And, commit.


C:\Tutorial\AliceDocument>fossil commit
C:\Windows\notepad.exe "./ci-comment-312670071824.txt"
contains CR/NL line endings. Use --no-warnings or the "crnl-glob" setting to disable this warning.
Commit anyhow (a=all/c=convert/y/N)? a
New_Version: 87f6910d9820518888c0d45a553a6d7bd939a252

On windows, the notepad should appear. Add the commit message, then save (Ctrl-S), and then close (Alt-F4). You may be received message about inconsistent line ending, for this tutorial please ignore it by pushing the “a” key.



Making changes

We are going to make some changes in our source-code. To know which files is change, we need to use a GUI tools. Fossil has a built-in Web UI. However, Web UI cannot display the changing in our local directory. Perhaps, this is due to the security of web browser. This is where Fuel, a fossil GUI application, plays it role.

1. Open the Fuel. On Fuel’s GUI click File>Open. Navigate to the “AliceDocument” folder and choose _Fossil_ file.

2. Making changes to the repository by copy the files from \Iteration\Iteration1\ and pasted it to AliceDocument.

3. Now, at the Fuel’s GUI, clicks refresh button. You will see the edited status as follows.

Configure the view

File list view. The added file has unknown status. The edited file has edited status.

4. Click on the file name to view the change.
If the gdiff (graphical diff) was setup correctly, you will see the following window. At this point, please play around with this tool. And, try manually making change on your source file from either on IDE or text editor. Observe and learn the how to read this graphical diff tool. Note that you must click the refresh button each time that the source code is changed.
Graphical diff tool



Undo the changes

In case that you have messed the code, you can revert all the change back to the last committed state by simply right click on the file and choose revert. You can also use the command prompt to revert the changes. Type “fossil revert Filename” to revert a certain file. To revert all files, simply type “fossil revert”.
Reverting back to the last commit



 Committing changes

For this tutorial, please again copy and replace the file from \Iteration\Iteration1\.
1. As you can notice, there are new file added to the project (src\timer\CountDownTimer.java). You must tell fossil to add this file by right clicking at the file and select “Add”.


Add file

2. To commit the change, simple click the commit button and, add some commit message.
Commit

Commit message

3. Now, clicks at Timeline button. You will see the rendered timeline as follows. At this point, please play around on this timeline view.

Timeline view button

Timeline view
Continue to part 3

No comments:

Post a Comment