~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to contrib/bash/bzr.simple

  • Committer: Vincent Ladeuil
  • Date: 2009-09-16 10:37:29 UTC
  • mto: (4695.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4696.
  • Revision ID: v.ladeuil+lp@free.fr-20090916103729-m6h1pyvjprm6puvm
Respect items() protocol for registry objects.

* bzrlib/tests/test_registry.py:
(TestRegistryIter): Test some corner cases where object are
registered while the registry is iterated.

* bzrlib/registry.py:
(Registry): iteritems() and items() have different intents, don't
mix them under the covers or devs get tricked (see bug #277048
which seemed to have fixed the issue).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- shell-script -*-
 
2
 
 
3
# experimental bzr bash completion
 
4
 
 
5
# author: Martin Pool
 
6
 
 
7
_bzr_commands() 
 
8
{
 
9
     bzr help commands | sed -r 's/^([-[:alnum:]]*).*/\1/' | grep '^[[:alnum:]]' 
 
10
}
 
11
 
 
12
_bzr() 
 
13
{
 
14
    cur=${COMP_WORDS[COMP_CWORD]}
 
15
    prev=${COMP_WORDS[COMP_CWORD-1]}
 
16
    if [ $COMP_CWORD -eq 1 ]; then
 
17
        COMPREPLY=( $( compgen -W "$(_bzr_commands)" $cur ) )
 
18
    elif [ $COMP_CWORD -eq 2 ]; then
 
19
        case "$prev" in 
 
20
        help)
 
21
            COMPREPLY=( $( compgen -W "$(_bzr_commands) commands" $cur ) )
 
22
            ;;
 
23
        esac
 
24
    fi 
 
25
}
 
26
 
 
27
complete -F _bzr -o default bzr
 
28