~ubuntu-branches/ubuntu/natty/bzr/natty-proposed

« back to all changes in this revision

Viewing changes to contrib/bash/bzr

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij
  • Date: 2010-08-07 00:54:52 UTC
  • mfrom: (1.4.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20100807005452-g4zb99ezl3xn44r4
Tags: 2.2.0-1
* New upstream release.
 + Adds support for setting timestamps to originating revisions.
   Closes: #473450
 + Removes remaining string exception. Closes: #585193, LP: #586926
 + Add C extension to work around Python issue 1628205. LP: #583941,
   Closes: #577110
 + Avoids showing progress bars when --quiet is used. Closes: #542105,
   LP: #320035
 + No longer creates ~/.bazaar as root when run under sudo. LP: #376388
 + 'bzr commit' now supports -p as alternative for --show-diff. LP: #571467
 + 'bzr add' no longer adds .THIS/.BASE/.THEIRS files unless
   explicitly requested. LP: #322767
 + When parsing patch files, Bazaar now supports diff lines before each
   patch. LP: #502076
 + WorkingTrees now no longer requires using signal.signal, so can
   be used in a threaded environment. LP: #521989
 + An assertion error is no longer triggered when pushing to a pre-1.6
   Bazaar server. LP: #528041
* Bump standards version to 3.9.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Programmable completion for the Bazaar-NG bzr command under bash. Source
2
 
# this file (or on some systems add it to ~/.bash_completion and start a new
3
 
# shell) and bash's completion mechanism will know all about bzr's options!
4
 
 
5
 
# Known to work with bash 2.05a with programmable completion and extended
6
 
# pattern matching enabled (use 'shopt -s extglob progcomp' to enable
7
 
# these if they are not already enabled).
8
 
 
9
 
# Based originally on the svn bash completition script.
10
 
# Customized by Sven Wilhelm/Icecrash.com
11
 
 
12
 
_bzr ()
 
1
# Copyright (C) 2010 Canonical Ltd
 
2
#
 
3
# This program is free software; you can redistribute it and/or modify
 
4
# it under the terms of the GNU General Public License as published by
 
5
# the Free Software Foundation; either version 2 of the License, or
 
6
# (at your option) any later version.
 
7
#
 
8
# This program is distributed in the hope that it will be useful,
 
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
# GNU General Public License for more details.
 
12
#
 
13
# You should have received a copy of the GNU General Public License
 
14
# along with this program; if not, write to the Free Software
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
16
 
 
17
# Programmable completion for the Bazaar-NG bzr command under bash.
 
18
# Source this file (or add it to your ~/.bash_completion or ~/.bashrc
 
19
# file, depending on your system configuration, and start a new shell)
 
20
# and bash's completion mechanism will know all about bzr's options!
 
21
#
 
22
# This completion function assumes you have the bzr-bash-completion
 
23
# plugin installed as a bzr plugin. It will generate the full
 
24
# completion function at first invocation, thus avoiding long delays
 
25
# for every shell you start.
 
26
 
 
27
shopt -s progcomp
 
28
_bzr_lazy ()
13
29
{
14
 
        local cur cmds cmdOpts opt helpCmds optBase i
15
 
 
16
 
        COMPREPLY=()
17
 
        cur=${COMP_WORDS[COMP_CWORD]}
18
 
 
19
 
        cmds='status diff commit ci checkin move remove log info check ignored'
20
 
 
21
 
        if [[ $COMP_CWORD -eq 1 ]] ; then
22
 
                COMPREPLY=( $( compgen -W "$cmds" -- $cur ) )
23
 
                return 0
24
 
        fi
25
 
 
26
 
        # if not typing an option, or if the previous option required a
27
 
        # parameter, then fallback on ordinary filename expansion
28
 
        helpCmds='help|--help|h|\?'
29
 
        if [[ ${COMP_WORDS[1]} != @($helpCmds) ]] && \
30
 
           [[ "$cur" != -* ]] ; then
31
 
                return 0
32
 
        fi
33
 
 
34
 
        cmdOpts=
35
 
        case ${COMP_WORDS[1]} in
36
 
        status)
37
 
                cmdOpts="--all --show-ids"
38
 
                ;;
39
 
        diff)
40
 
                cmdOpts="-r --revision --diff-options"
41
 
                ;;
42
 
        commit|ci|checkin)
43
 
                cmdOpts="-r --message -F --file -v --verbose"
44
 
                ;;
45
 
        move)
46
 
                cmdOpts=""
47
 
                ;;
48
 
        remove)
49
 
                cmdOpts="-v --verbose"
50
 
                ;;
51
 
        log)
52
 
                cmdOpts="--forward --timezone -v --verbose --show-ids -r --revision"
53
 
                ;;
54
 
        info)
55
 
                cmdOpts=""
56
 
                ;;
57
 
        ignored)
58
 
                cmdOpts=""
59
 
                ;;
60
 
        check)
61
 
                cmdOpts=""
62
 
                ;;
63
 
        help|h|\?)
64
 
                cmdOpts="$cmds $qOpts"
65
 
                ;;
66
 
        *)
67
 
                ;;
68
 
        esac
69
 
 
70
 
        cmdOpts="$cmdOpts --help -h"
71
 
 
72
 
        # take out options already given
73
 
        for (( i=2; i<=$COMP_CWORD-1; ++i )) ; do
74
 
                opt=${COMP_WORDS[$i]}
75
 
 
76
 
                case $opt in
77
 
                --*)    optBase=${opt/=*/} ;;
78
 
                -*)     optBase=${opt:0:2} ;;
79
 
                esac
80
 
 
81
 
                cmdOpts=" $cmdOpts "
82
 
                cmdOpts=${cmdOpts/ ${optBase} / }
83
 
 
84
 
                # take out alternatives
85
 
                case $optBase in
86
 
                -v)              cmdOpts=${cmdOpts/ --verbose / } ;;
87
 
                --verbose)       cmdOpts=${cmdOpts/ -v / } ;;
88
 
                -h)              cmdOpts=${cmdOpts/ --help / } ;;
89
 
                --help)          cmdOpts=${cmdOpts/ -h / } ;;
90
 
                -r)              cmdOpts=${cmdOpts/ --revision / } ;;
91
 
                --revision)      cmdOpts=${cmdOpts/ -r / } ;;
92
 
                esac
93
 
 
94
 
                # skip next option if this one requires a parameter
95
 
                if [[ $opt == @($optsParam) ]] ; then
96
 
                        ((++i))
97
 
                fi
98
 
        done
99
 
 
100
 
        COMPREPLY=( $( compgen -W "$cmdOpts" -- $cur ) )
101
 
 
102
 
        return 0
 
30
        unset _bzr
 
31
        eval "$(bzr bash-completion)"
 
32
        if [[ $(type -t _bzr) == function ]]; then
 
33
                unset _bzr_lazy
 
34
                _bzr
 
35
                return $?
 
36
        else
 
37
                return 1
 
38
        fi
103
39
}
104
 
complete -F _bzr -o default bzr
 
40
complete -F _bzr_lazy -o default bzr