bzrtools - Collection of various useful commands

Version 2.3.0
Branch lp:bzrtools
Home page https://launchpad.net/bzrtools
Owner abentley
GNU/Linux Yes
Windows Yes
Mac OS X Yes

Various useful commands for working with bzr.

branch-history

Purpose

Display the development history of a branch.

Usage

bzr branch-history [BRANCH]

Options

--usage Show usage message and options.
-v, --verbose Display more information.
-q, --quiet Only display errors and warnings.
-h, --help Show help message.

Description

Each different committer or branch nick is considered a different line of development. Committers are treated as the same if they have the same name, or if they have the same email address.

branches

Purpose

Scan a location for branches

Usage

bzr branches [LOCATION]

Options

--usage Show usage message and options.
-v, --verbose Display more information.
-q, --quiet Only display errors and warnings.
-h, --help Show help message.

cbranch

Purpose

Create a new checkout, associated with a new repository branch.

Usage

bzr cbranch SOURCE [TARGET]

Options

-v, --verbose Display more information.
--files-from=ARG
 Accelerate checkout using files from this tree.
-h, --help Show help message.
-q, --quiet Only display errors and warnings.
--hardlink Hard-link files from source/files-from tree where posible.
--lightweight Create a lightweight checkout.
--usage Show usage message and options.
-r ARG, --revision=ARG
 See “help revisionspec” for details.

Description

When you cbranch, bzr looks up a target location in locations.conf, and creates the branch there.

In your locations.conf, add the following lines: [/working_directory_root] cbranch_target = /branch_root cbranch_target:policy = appendpath

This will mean that if you run “bzr cbranch foo/bar foo/baz” in the working directory root, the branch will be created in “/branch_root/foo/baz”

NOTE: cbranch also supports “cbranch_root”, but that behaviour is deprecated.

cdiff

Purpose

A color version of bzr’s diff

Usage

bzr cdiff [FILE...]

Options

--check-style Warn if trailing whitespace or spurious changes have been added.
--old=ARG Branch/tree to compare from.
-v, --verbose Display more information.
-F ARG, --format=ARG
 Diff format to use.
--color=ARG Color mode to use. “always”: Always colorize output (default). “auto”: Only colorize output if terminal supports it and STDOUT is a TTY. “never”: Never colorize output.
-q, --quiet Only display errors and warnings.
-p ARG, --prefix=ARG
 Set prefixes added to old and new filenames, as two values separated by a colon. (eg “old/:new/”).
--using=ARG Use this command to compare files.
--usage Show usage message and options.
--new=ARG Branch/tree to compare to.
-r ARG, --revision=ARG
 See “help revisionspec” for details.
--diff-options=ARG
 Pass these options to the external diff program.
-c ARG, --change=ARG
 Select changes introduced by the specified revision. See also “help revisionspec”.
-h, --help Show help message.

conflict-diff

Purpose

Compare a conflicted file against BASE.

Usage

bzr conflict-diff [FILE...]

Options

--usage Show usage message and options.
-v, --verbose Display more information.
-q, --quiet Only display errors and warnings.
-h, --help Show help message.
direction:
--other Compare OTHER against common base.
--this Compare THIS against common base.

create-mirror

Purpose

Create a mirror of another branch.

Usage

bzr create-mirror SOURCE TARGET

Options

--usage Show usage message and options.
-v, --verbose Display more information.
-q, --quiet Only display errors and warnings.
-h, --help Show help message.

Description

This is similar to bzr branch, but copies more settings, including the submit branch and nickname.

It sets the public branch and parent of the target to the source location.

fetch-ghosts

Purpose

Attempt to retrieve ghosts from another branch.

Usage

bzr fetch-ghosts [BRANCH]

Options

--usage Show usage message and options.
--no-fix Skip additional synchonization.
-v, --verbose Display more information.
-q, --quiet Only display errors and warnings.
-h, --help Show help message.

Description

If the other branch is not supplied, the last-pulled branch is used.

Aliases

fetch-missing

graph-ancestry

Purpose

Produce ancestry graphs using dot.

Usage

bzr graph-ancestry FILE [MERGE_BRANCH]

Options

-v, --verbose Display more information.
--no-collapse Do not skip simple nodes.
-d ARG, --directory=ARG
 Source branch to use (default is current directory).
-q, --quiet Only display errors and warnings.
--cluster Use clustered output.
--merge-branch=ARG
 Use this branch to calcuate a merge base.
--no-antialias Do not use rsvg to produce antialiased output.
--usage Show usage message and options.
--max-distance=ARG
 Show no nodes farther than this.
-h, --help Show help message.

Description

Output format is detected according to file extension. Some of the more common output formats are html, png, gif, svg, ps. An extension of ‘.dot’ will cause a dot graph file to be produced. HTML output has mouseovers that show the commit message.

Branches are labeled r?, where ? is the revno. If they have no revno, with the last 5 characters of their revision identifier are used instead.

The value starting with d is “(maximum) distance from the null revision”.

If –merge-branch is specified, the two branches are compared and a merge base is selected.

Legend: white normal revision yellow THIS history red OTHER history orange COMMON history blue COMMON non-history ancestor green Merge base (COMMON ancestor farthest from the null revision) dotted Ghost revision (missing from branch storage)

Ancestry is usually collapsed by skipping revisions with a single parent and descendant. The number of skipped revisions is shown on the arrow. This feature can be disabled with –no-collapse.

By default, revisions are ordered by distance from root, but they can be clustered instead using –cluster.

If available, rsvg is used to antialias PNG and JPEG output, but this can be disabled with –no-antialias.

heads

Purpose

Show all revisions in a repository not having descendants.

Usage

bzr heads [LOCATION]

Options

--all Show all heads (dead and alive).
-v, --verbose Display more information.
--debug-time Enable debug print of operations times.
--dead-only Show only dead heads.
--by-date Sort heads by date (descending).
-q, --quiet Only display errors and warnings.
--usage Show usage message and options.
--tips Show tips of all branches.
-h, --help Show help message.

import

Purpose

Import sources from a directory, tarball or zip file

Usage

bzr import SOURCE [TREE]

Options

--usage Show usage message and options.
-v, --verbose Display more information.
-q, --quiet Only display errors and warnings.
-h, --help Show help message.

Description

This command will import a directory, tarball or zip file into a bzr tree, replacing any versioned files already present. If a directory is specified, it is used as the target. If the directory does not exist, or is not versioned, it is created.

Tarballs may be gzip or bzip2 compressed. This is autodetected.

If the tarball or zip has a single root directory, that directory is stripped when extracting the tarball. This is not done for directories.

multi-pull

Purpose

Pull all the branches under a location, e.g. a repository.

Usage

bzr multi-pull [LOCATION]

Options

--usage Show usage message and options.
-v, --verbose Display more information.
-q, --quiet Only display errors and warnings.
-h, --help Show help message.

Description

Both branches present in the directory and the branches of checkouts are pulled.

patch

Purpose

Apply a named patch to the current tree.

Usage

bzr patch [FILENAME]

Options

-v, --verbose Display more information.
-h, --help Show help message.
-q, --quiet Only display errors and warnings.
-p ARG, --strip=ARG
 Strip the smallest prefix containing num leading slashes from each file name found in the patch file.
--usage Show usage message and options.
--silent Suppress chatter.

rspush

Purpose

Upload this branch to another location using rsync.

Usage

bzr rspush [LOCATION]

Options

-v, --verbose Display more information.
-q, --quiet Only display errors and warnings.
--usage Show usage message and options.
--no-tree Do not push the working tree, just the .bzr.
--overwrite Ignore differences between branches and overwrite unconditionally.
-h, --help Show help message.

Description

If no location is specified, the last-used location will be used. To prevent dirty trees from being uploaded, rspush will error out if there are unknown files or local changes. It will also error out if the upstream directory is non-empty and not an earlier version of the branch.

shelf1

Purpose

Perform various operations on your shelved patches. See also shelve1.

Usage

bzr shelf1 SUBCOMMAND [ARGS...]

Options

--usage Show usage message and options.
-v, --verbose Display more information.
-q, --quiet Only display errors and warnings.
-h, --help Show help message.

Subcommands

list
List the patches on the current shelf.
delete PATCH
Delete the patch from the current shelf.
switch OTHERSHELF
Switch to the other shelf, create it if necessary.
show [PATCH]
Show the contents of the specified or topmost patch.
upgrade
Upgrade old format shelves.

shell

Purpose

Begin an interactive shell tailored for bzr.

Usage

bzr shell

Options

--usage Show usage message and options.
-d ARG, --directory=ARG
 Branch in which to start the shell, rather than the one containing the working directory.
-v, --verbose Display more information.
-q, --quiet Only display errors and warnings.
-h, --help Show help message.

Description

Bzr commands can be used without typing bzr first, and will be run natively when possible. Tab completion is tailored for bzr. The shell prompt shows the branch nick, revno, and path.

If it encounters any moderately complicated shell command, it will punt to the system shell.

Example:

$ bzr shell
bzr bzrtools:287/> status
modified:
  __init__.py
bzr bzrtools:287/> status --[TAB][TAB]
--all        --help       --revision   --show-ids
bzr bzrtools:287/> status --

shelve1

Purpose

Temporarily set aside some changes from the current tree.

Usage

bzr shelve1 [FILE...]

Options

--all Shelve all changes without prompting.
-v, --verbose Display more information.
-h, --help Show help message.
-q, --quiet Only display errors and warnings.
--usage Show usage message and options.
-m ARG, --message=ARG
 A message to associate with the shelved changes.
--no-color Never display changes in color.
-r ARG, --revision=ARG
 See “help revisionspec” for details.

Description

Shelve allows you to temporarily put changes you’ve made “on the shelf”, ie. out of the way, until a later time when you can bring them back from the shelf with the ‘unshelve1’ command.

Shelve is intended to help separate several sets of text changes that have been inappropriately mingled. If you just want to get rid of all changes (text and otherwise) and you don’t need to restore them later, use revert. If you want to shelve all text changes at once, use shelve1 –all.

By default shelve1 asks you what you want to shelve, press ‘?’ at the prompt to get help. To shelve everything run shelve1 –all.

If filenames are specified, only the changes to those files will be shelved, other files will be left untouched.

If a revision is specified, changes since that revision will be shelved.

You can put multiple items on the shelf. Normally each time you run unshelve1 the most recently shelved changes will be reinstated. However, you can also unshelve changes in a different order by explicitly specifiying which changes to unshelve1. This works best when the changes don’t depend on each other.

While you have patches on the shelf you can view and manipulate them with the ‘shelf1’ command. Run ‘bzr shelf1 -h’ for more info.

trees

Purpose

Scan a location for trees

Usage

bzr trees [LOCATION]

Options

--usage Show usage message and options.
-v, --verbose Display more information.
-q, --quiet Only display errors and warnings.
-h, --help Show help message.

unshelve1

Purpose

Restore shelved changes.

Usage

bzr unshelve1 [PATCH]

Options

--all Unshelve all changes without prompting.
--force Force unshelving even if errors occur.
-v, --verbose Display more information.
-q, --quiet Only display errors and warnings.
--usage Show usage message and options.
--no-color Never display changes in color.
-h, --help Show help message.

Description

By default the most recently shelved changes are restored. However if you specify a patch by name those changes will be restored instead.

See ‘shelve1’ for more information.

zap

Purpose

Remove a lightweight checkout, if it can be done safely.

Usage

bzr zap CHECKOUT

Options

--force Delete tree even if contents are modified.
-v, --verbose Display more information.
-q, --quiet Only display errors and warnings.
--branch Remove associated branch from repository.
--usage Show usage message and options.
-h, --help Show help message.

Description

This command will remove a lightweight checkout without losing data. That means it only removes lightweight checkouts, and only if they have no uncommitted changes.

If –branch is specified, the branch will be deleted too, but only if the the branch has no new commits (relative to its parent).