Bazaar for Darcs users

How Bazaar feels the same

Bazaar and Darcs are both distributed version control systems, and so both provide each user with their own version of the code that is standalone, allowing them to work independently of anyone else, and then merge the changes at a later date.

How Bazaar feels different

The fundamental unit in Bazaar is the branch, as opposed to the repository in Darcs. What is called a repository in Bazaar is the storage for revisions, and can be shared between branches, but most command operate at the branch level.

There are two differences with merging. Firstly bzr pull will only succeed if you have no local patches, you need bzr merge otherwise.

The second difference with merges is that Bazaar requires a commit to be done after every merge, regardless of whether there were conflicts. Darcs on the other hand will create a patch only in case there were conflicts.

Core tasks

Checking out a project

To get the source of a project located at URL:

darcs get URL
====>
bzr branch URL

Adding new files

To put file1 and file2 under version control:

darcs add file1 file2
====>
bzr add file1 file2

Note that bzr add will automatically add all unversioned, non-ignored files under the current directory.

Checking the status

To check the status of the current directory:

darcs what -s .
====>
bzr st -S .

Committing changes

To commit the current state of the working tree:

darcs record -a -m 'this is a commit message'
====>
bzr ci -m 'this is a commit message'

You can specify certain files to commit in the same way as in Darcs: bzr ci -m 'dont save all things' file1 file2.

To commit a subset of hunks within a file, use shelve to store away the changes you don’t want to commit yet, then commit, then unshelve.

Viewing history

To see the history of the current project:

darcs changes
====>
bzr log --short

To view all of the files changed by each revision:

darcs changes -s
====>
bzr log --short -v

To see the log for the last N revisions:

darcs changes --last N
====>
bzr log --limit N

Updating to the latest version

When other people have made a change to the project, your local branch may be out of date. To update your local branch:

darcs pull -a
====>
bzr pull

This update may result in conflicts which need to be manually resolved.

Changing to a previous revision

To go back to a previous revision, for example forget the last two patches:

darcs unpull -a --last 2
====>
bzr uncommit -r -3

Network protocols

Darcs accesses network resources using URLs, as does Bazaar. The later has a native server program that runs remotely, Darcs does not. This is the bzr:// URL. Both of these native protocols can be tunnelled over SSH to avoid the need to run a persistent program on the remote system on a separate port. This is machine:path for Darcs, and bzr+ssh://machine/path for Bazaar.

Both Darcs and Bazaar can be accessed over HTTP, both access the repository using the ordinary HTTP protocol and both accesses over HTTP are read-only.

Revisions

Both Bazaar and Darcs have unique identifiers to revisions / patches.

For example to change to a previous revision while not using local identifiers:

darcs unpull --to-match "hash 20091020192654-3b154-d1798f670a926a4d36ba46a9395cbab6bf6022b8.gz"
====>
bzr revert -r revid:vmiklos@frugalware.org-20091020195856-n00rpclqg0ybb5xg

To see the patch hashes / revision ids:

darcs chan --xml
====>
bzr log --show-ids

Both Bazaar and Darcs have user-friendly identifiers to avoid typing those long strings. Both Bazaar and Darcs uses this as a local identifier, so they may mean different patch hashes / revision identifiers in different repositories / branches!

Bazaar refers to revisions mainly by way of the -r option to commands. Darcs has numerous options to refer to a patch or a set of patches, like --patches, --from-patch and --to-patch.

Other commands

“How are the more advanced darcs commands done in Bazaar?”

To be completed ...

Notes

“What else is worth knowing to get up to speed?”

To be completed ...

Feedback and edits

See Improving these documents.