Bazaar

Bazaar

 




Wiki Tools

  • Find Page
  • Recent Changes
  • Page History
  • Attachments

Revision specs and ranges

bzr has a very expressive way to specify a revision, or a range of revisions. We'll take the example of the log command.

To specify a range of revisions, use for example

$ bzr log -r 1..4

You can omit one bound like

$ bzr log -r 1..
$ bzr log -r ..4

Other commands, like bzr cat take only one revision, not a range, like

$ bzr cat -r 42 foo.c

Available revision specs

The revision, or the bounds of the range, can be one of:

  • number

    revision number

    more...

    revno:number

    positive revision number

    more...

    last:number

    negative revision number

    more...

    revid:guid

    globally unique revision id

    more...

    before:rev

    leftmost parent of rev

    more...

    date:value

    first entry after a given date

    more...

    ancestor:path

    last merged revision from a branch

    more...

    branch:path

    latest revision on another branch

    more...

    tag:tag_name

    tag name linked to a revision

    more...

Numbers

Positive numbers denote revision numbers in the current branch. Revision numbers are labelled as "revno" in the output of bzr log.

To display the log for the first ten revisions:

$ bzr log -r ..10

Negative numbers count from the latest revision, -1 is the last committed revision.

To display the log for the last ten revisions:

$ bzr log -r -10..

revno, last

revno:number is the same as number, except that negative numbers are not allowed. From bzr 0.9, you can also write revno:number:path to mean "revision number number in branch path". For example

$ bzr diff -r revno:1:http://bazaar-vcs.org/bzr/bzr.dev/..revno:2:http://bazaar-vcs.org/bzr/bzr.dev/

will give the diff between revision 1 and 2 of bzr's upstream branch.

last:number is the same as -number. last:1 means the last commited revision.

revid

revid allows specifying a an internal revision ID, as shown by bzr testament and some other commands.

For example:

$ bzr log -r revid:john@smith.org-20051026185030-93c7cad63ee570df

This should be useless in 99.9% of the cases.

before

before:rev specifies the leftmost parent of rev, that is the revision that appears before rev in the revision history, or the revision that was current when rev was committed.

rev can be any revision specifier.

For example:

$ bzr log -r before:before:4
...
revno: 2
...

date

date:value matches the first history entry after a given date, either at midnight or at a specified time.

Legal values are:

  • yesterday

  • today

  • tomorrow

  • A YYYY-MM-DD format date.

  • A YYYY-MM-DD,HH:MM:SS format date/time, seconds are optional (note the comma)

So the proper way of saying "give me all the log entries for today" is:

$ bzr log -r date:today..

... and the proper way of saying "give me all the log entries for yesterday" is:

$ bzr log -r date:yesterday..before:date:today

ancestor

ancestor:path specifies the common ancestor between the current branch, and a different branch. This is the same ancestor that would be used for merging purposes.

path may be the URL of a remote branch, or the file path to a local branch.

For example, to see what changes were made on a branch since it was forked off ../parent:

$ bzr diff -r ancestor:../parent

branch

branch:path specifies the latest revision in another branch.

path may be the URL of a remote branch, or the file path to a local branch.

For example, to get the differences between this and another branch:

$ bzr diff -r branch:http://example.com/bzr/foo.dev

See also revno:number:path to specify a revision in a remote branch which is not the latest revision.

tag

tag:tag_name matches the revision linked to this tag_name.

Tag support is new in Bazaar 0.15. The default branch format does not support tags at the moment, so you might need to run bzr upgrade --dirstate-tags.

A tag is a nickname for a particular revision. The typical use is to mark a release of the software so you can easily refer to it later.

Tags are placed using the tag command:

  bzr tag project-0.10

See tag page for more details.

Future functionality?