~bzr-pqm/bzr/bzr.dev

2977.1.1 by Ian Clatworthy
First cut at new look User Guide including chapters 1 and 2
1
Using aliases
2
=============
3
4
What are aliases?
5
-----------------
1821.1.1 by Alexander Belchenko
win32 installer for bzr.dev.0.9
6
2977.1.18 by Ian Clatworthy
chapter 2 tweaks
7
Aliases are an easy way to create shortcuts for commonly-typed commands, or to set
1610.2.1 by James Blackwell
Copied in docs for wiki & First round cleanup
8
defaults for commands.
9
2977.1.1 by Ian Clatworthy
First cut at new look User Guide including chapters 1 and 2
10
Defining aliases
11
----------------
12
2293.1.3 by Brad Crittenden
Updated version_info.txt for grammar changes
13
Command aliases can be defined in the ``[ALIASES]`` section of your
2977.1.13 by Ian Clatworthy
more cleanups and creation of tutorials directory
14
``bazaar.conf`` file. Aliases start with the alias name, then an
2977.1.1 by Ian Clatworthy
First cut at new look User Guide including chapters 1 and 2
15
equal sign, then a command fragment.  Here's an example ALIASES section::
1610.2.2 by James Blackwell
Now they look good in rst2html
16
1610.2.1 by James Blackwell
Copied in docs for wiki & First round cleanup
17
    [ALIASES]
18
    recentlog=log -r-3..-1
19
    ll=log --line -r-10..-1
20
    commit=commit --strict
21
    diff=diff --diff-options -p
22
2977.1.1 by Ian Clatworthy
First cut at new look User Guide including chapters 1 and 2
23
Here are the explanations of the examples above:
1610.2.1 by James Blackwell
Copied in docs for wiki & First round cleanup
24
2293.1.3 by Brad Crittenden
Updated version_info.txt for grammar changes
25
 * The first alias makes a new ``recentlog`` command that shows the logs for the
1610.2.2 by James Blackwell
Now they look good in rst2html
26
   last three revisions
2293.1.3 by Brad Crittenden
Updated version_info.txt for grammar changes
27
 * The ``ll`` alias shows the last 10 log entries in line format.
28
 * the ``commit`` alias sets the default for commit to refuse to commit if new
1610.2.2 by James Blackwell
Now they look good in rst2html
29
   files in the tree are not recognized.
2293.1.3 by Brad Crittenden
Updated version_info.txt for grammar changes
30
 * the ``diff`` alias adds the coveted -p option to diff
31
2977.1.1 by Ian Clatworthy
First cut at new look User Guide including chapters 1 and 2
32
Using the aliases
33
-----------------
34
2293.1.3 by Brad Crittenden
Updated version_info.txt for grammar changes
35
The aliases defined above would be used like so: ::
36
37
   % bzr recentlog
38
   % bzr ll
39
   % bzr commit
40
   % bzr diff
1610.2.1 by James Blackwell
Copied in docs for wiki & First round cleanup
41
2977.1.1 by Ian Clatworthy
First cut at new look User Guide including chapters 1 and 2
42
Rules for aliases
43
-----------------
1610.2.1 by James Blackwell
Copied in docs for wiki & First round cleanup
44
2293.1.6 by Brad Crittenden
post review changes
45
 * You can override a portion of the options given in an alias by
46
   specifying the new part on the command-line.  For example, if
47
   you run ``lastlog -r-5..``, you will only get five line-based log
48
   entries instead of 10.  Note that all boolean options have an
49
   implicit inverse, so you can override the commit alias with
50
   ``commit --no-strict``.
51
1610.2.1 by James Blackwell
Copied in docs for wiki & First round cleanup
52
 * Aliases can override the standard behaviour of existing commands by giving
4011.6.1 by Frank Aspell
Fixed typos.
53
   an alias name that is the same as the original command. For example, default
2293.1.3 by Brad Crittenden
Updated version_info.txt for grammar changes
54
   commit is changed with ``commit=commit --strict``.
2977.1.18 by Ian Clatworthy
chapter 2 tweaks
55
2293.1.3 by Brad Crittenden
Updated version_info.txt for grammar changes
56
 * Aliases cannot refer to other aliases. In other words making a
57
   ``lastlog`` alias and referring to it with a ``ll`` alias will not work.
2977.1.18 by Ian Clatworthy
chapter 2 tweaks
58
   This includes aliases that override standard commands.
59
60
 * Giving the ``--no-aliases`` option to the bzr command will tell it to ignore aliases
2293.1.3 by Brad Crittenden
Updated version_info.txt for grammar changes
61
   for that run. For example, running ``bzr --no-aliases commit`` will perform a
2977.1.18 by Ian Clatworthy
chapter 2 tweaks
62
   standard commit instead, not do a ``commit --strict``.
1610.2.2 by James Blackwell
Now they look good in rst2html
63