~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Gordon Tyler
  • Date: 2010-02-02 06:30:43 UTC
  • mto: (5037.3.1 integration)
  • mto: This revision was merged to the branch mainline in revision 5046.
  • Revision ID: gordon@doxxx.net-20100202063043-3ygr1114d25m3f7m
Added cmdline.split function, which replaces commands.shlex_split_unicode.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
import bzrlib
42
42
from bzrlib import (
43
43
    cleanup,
 
44
    cmdline,
44
45
    debug,
45
46
    errors,
46
47
    option,
895
896
    return ret
896
897
 
897
898
 
898
 
def shlex_split_unicode(unsplit):
899
 
    if sys.platform == "win32":
900
 
        from bzrlib.win32utils import command_line_to_argv
901
 
        return command_line_to_argv(unsplit, wildcard_expansion=False,
902
 
                                    single_quotes_allowed=True)
903
 
    else:
904
 
        import shlex
905
 
        return [u.decode('utf-8') for u in shlex.split(unsplit.encode('utf-8'))]
906
 
 
907
 
 
908
899
def get_alias(cmd, config=None):
909
900
    """Return an expanded alias, or None if no alias exists.
910
901
 
920
911
        config = bzrlib.config.GlobalConfig()
921
912
    alias = config.get_alias(cmd)
922
913
    if (alias):
923
 
        return shlex_split_unicode(alias)
 
914
        return cmdline.split(alias)
924
915
    return None
925
916
 
926
917