Harmonize RCS with Monotone - Page 2

 By Carla Schroder
Page 2 of 2   |  Back to Page 1
Print Article

Continued From Page 1

Now add some files to your project. This example adds a directory of files to the working directory:

$ monotone --branch=config_files --db=~/project1/project1.db add configs/
monotone: adding configs/apache-1.3-https to working copy add set
monotone: adding configs/postfix-sa to working copy add set

Then commit the additions:

$ monotone commit '1st commit of configs for branch office servers'
monotone: committing e85116a6c24df94037ae4ccd60645e0044da58a5
monotone: committing to branch config_files
enter passphrase for key ID [carla@mydomain.net]:
monotone: committed e85116a6c24df94037ae4ccd60645e0044da58a5

There are a couple of gotchas to look out for. Monotone does not allow absolute filepaths when you're listing files or directories to add to the repository. In this example, I made sure the Monotone binary was in my path, then ran the "add" and "commit" commands from the next directory above the "configs" directory. If Monotone is not in your path, you are doomed to specifying the entire path every time you run it, like ~/downloads/monotone-0.14/monotone.

Check the status of your nice new branch with this command:

$ monotone heads
monotone: fetching heads of branch 'config_files'
branch 'config_files' is currently merged:
e85116a6c24df94037ae4ccd60645e0044da58a5 carla@mydomain.net 2004-10-01T20:41:06

The "status" command reports any changes to the database:

$ monotone status
Old manifest: e85116a6c24df94037ae4ccd60645e0044da58a5
New manifest: e85116a6c24df94037ae4ccd60645e0044da58a5
Summary of changes:
  no changes

Suppose you want to edit a file. Just open and edit the file as you normally would, and save your changes. Then use the "commit" command to add the changed file to the repository:

$ monotone commit
monotone: committing b102fc029bde2d6b50c6e5bfd9d79ec2cba7cbc6
monotone: committing to branch config_files
enter passphrase for key ID [carla@mydomain.net]:
monotone: committed b102fc029bde2d6b50c6e5bfd9d79ec2cba7cbc6

Like any other RCS, your default editor will open to make the changelog entry.

Visualizing Confusion

Figure 1. With Monoton's xvcg dump, you can track the evolution of your Monotone tree.
(Click for a larger image)
Using these 40-bit hashes instead of nice, human-readable names can get confusing. Fear not, for Monotone comes with a built-in xvcg dump, so you can easily create a graph showing the relationships of the branches and trees in your repository with xvcg. First, generate the xvcg data:
$ monotone agraph
node: { title : "71edb60beae79dc350cee1050af7c37ac04ddc9a"
        label : "\fb71edb60beae79dc350cee1050af7c37ac04ddc9a\n\fnconfig_files"}
node: { title : "b102fc029bde2d6b50c6e5bfd9d79ec2cba7cbc6"
        label : "\fbb102fc029bde2d6b50c6e5bfd9d79ec2cba7cbc6\n\fnconfig_files"}
node: { title : "e85116a6c24df94037ae4ccd60645e0044da58a5"
        label : "\fbe85116a6c24df94037ae4ccd60645e0044da58a5\n\fnconfig_files"}
edge: { sourcename : "b102fc029bde2d6b50c6e5bfd9d79ec2cba7cbc6"
        targetname : "71edb60beae79dc350cee1050af7c37ac04ddc9a" }
edge: { sourcename : "e85116a6c24df94037ae4ccd60645e0044da58a5"
        targetname : "b102fc029bde2d6b50c6e5bfd9d79ec2cba7cbc6" }

Then copy the output to a file, and generate a nice graph showing the evolution of your Monotone tree:

$ xvcg graph -

This spits out a graph like the one in Figure 1. (Note that it shows three levels, while only two levels were created in this article.)

Checkouts And Netsync

Come back next week to find out how to manage checkouts, share over a network, and find things in your repository. Or haul yourself over to Monotone now and get a head start.


This article was originally published on Oct 6, 2004
Get the Latest Scoop with Networking Update Newsletter