By now, you should have a solid understanding of Bazaar's philosophy and must be able to perform all the most important version control operations with ease. This chapter will show additional practical tips that are not essential to using Bazaar, but can be very useful and make you more productive.
The following topics will be covered in this chapter:
Aliases are helpful to shorten long commands that you use often. Take for example the log
command. Running bzr log
without parameters in large projects would produce an awful lot of an output, so it is compulsory to add the --limit
parameter. Furthermore, the default output format is long. This may be too much detail for everyday use, and the single-line format may be informative enough for most purposes. Thus, we end up with, for example, the following:
$ bzr log --limit 5 --line
This is rather long to type if you use it often. Luckily, we can shorten it with an alias; let's call it l5
, as follows:
$ bzr alias l5='log --limit 5 --line'
You can use aliases as if they were Bazaar commands. For example:
$ bzr l5 lp:bzr 6573: Patch Queue Manager 2013-02-07 [merge] (jameinel) Fix bug #1107464, 6572: Patch Queue Manager 2012-12-10 [merge] (vila) Fix LC_ALL=C test failur... 6571: Patch Queue Manager 2012-10-25 [merge] (gz) Set approved revision and ... 6570: Patch Queue Manager 2012-10-14 [merge] (jelmer) Fix trivial syntax err... 6569: Patch Queue Manager 2012-10-11 [merge] (vila) Clarify how `mergetool` ...
To view the definition of an alias, run bzr alias
with the name of the alias as a parameter. For example:
$ bzr alias l5 bzr alias l5="log --limit 5 --line"
To see all your currently defined aliases, run bzr alias
without any parameters. For example:
$ bzr alias bzr alias l="log --line -l10 -n0" bzr alias l5="log --limit 5 --line" bzr alias ll="log --line -l10" bzr alias s="status"
To remove an
alias, use the --remove
flag:
$ bzr alias --remove ll
Aliases are stored in the [ALIASES]
section in the user configuration file ~/.bazaar/bazaar.conf
:
[ALIASES] l = log --line -l10 -n0 s = status l5 = log --limit 5 --line
You can either use the bzr alias
command or edit the configuration directly; the end result will be the same.
You can even override a standard Bazaar command with an alias if you prefer:
$ bzr alias log='log --short'
This example effectively overrides the default output format of bzr log
, using the short format instead of the default long format.
To temporarily disable an alias, for example, to fall back on the default Bazaar command, you can use the --no-aliases
flag.
3.12.123.2