/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to contrib/bash/bzr

  • Committer: v.ladeuil+lp at free
  • Date: 2006-10-12 14:29:32 UTC
  • mto: (2145.1.1 keepalive)
  • mto: This revision was merged to the branch mainline in revision 2146.
  • Revision ID: v.ladeuil+lp@free.fr-20061012142932-7221fe16d2b48fa3
Shuffle http related test code. Hopefully it ends up at the right place :)

* bzrlib/tests/HttpServer.py: 
New file. bzrlib.tests.ChrootedTestCase use HttpServer. So the
class can't be defined in bzrlib.tests.HTTPUtils because it
creates a circular dependency (bzrlib.tests.HTTPUtils needs to
import bzrlib.tests).

* bzrlib/transport/http/_urllib.py: 
Transfer test server definition to bzrlib.tests.HttpServer. Clean
up imports.

* bzrlib/transport/http/_pycurl.py: 
Transfer test server definition to bzrlib.tests.HttpServer. Clean
up imports.

* bzrlib/transport/http/__init__.py: 
Transfer all test related code to either bzrlib.tests.HttpServer
and bzrlib.tests.HTTPUtils.
Fix all use of TransportNotPossible and InvalidURL by prefixing it
by 'errors.' (this seems to be the preferred way in the rest of
bzr).
Get rid of unused imports.

* bzrlib/tests/test_transport.py:
(ReadonlyDecoratorTransportTest.test_local_parameters,
FakeNFSDecoratorTests.test_http_parameters): Use HttpServer from
bzrlib.tests.HttpServer instead of bzrlib.transport.http.

* bzrlib/tests/test_sftp_transport.py:
(set_test_transport_to_sftp): Use HttpServer from
bzrlib.tests.HttpServer instead of bzrlib.transport.http.

* bzrlib/tests/test_selftest.py:
(TestTestCaseWithTransport.test_get_readonly_url_http): Use
HttpServer from bzrlib.tests.HttpServer instead of
bzrlib.transport.http.

* bzrlib/tests/test_repository.py: 
Does *not* use HttpServer.

* bzrlib/tests/test_http.py: 
Build on top of bzrlib.tests.HttpServer and bzrlib.tests.HTTPUtils
instead of bzrlib.transport.http.

* bzrlib/tests/test_bzrdir.py:
(ChrootedTests.setUp): Use HttpServer from bzrlib.tests.HttpServer
instead of bzrlib.transport.http.

* bzrlib/tests/branch_implementations/test_http.py:
(HTTPBranchTests.setUp): Use HttpServer from bzrlib.tests.HttpServer
instead of bzrlib.transport.http.

* bzrlib/tests/branch_implementations/test_branch.py:
(ChrootedTests.setUp): Use HttpServer from bzrlib.tests.HttpServer
instead of bzrlib.transport.http.

* bzrlib/tests/__init__.py:
(ChrootedTestCase.setUp): Use HttpServer from
bzrlib.tests.HttpServer instead of bzrlib.transport.http.

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 ()
 
13
{
 
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
 
103
}
 
104
complete -F _bzr -o default bzr