~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Vincent Ladeuil
  • Date: 2010-08-31 08:25:15 UTC
  • mfrom: (5247.7.1 catch-them-all)
  • mto: This revision was merged to the branch mainline in revision 5400.
  • Revision ID: v.ladeuil+lp@free.fr-20100831082515-an9mtdmhalo7xaq0
Merge catch-them-all into more-ignored-exceptions

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
    bzrdir,
33
33
    directory_service,
34
34
    delta,
35
 
    config,
 
35
    config as _mod_config,
36
36
    errors,
37
37
    globbing,
38
38
    hooks,
3322
3322
                try:
3323
3323
                    c = Branch.open_containing(u'.')[0].get_config()
3324
3324
                except errors.NotBranchError:
3325
 
                    c = config.GlobalConfig()
 
3325
                    c = _mod_config.GlobalConfig()
3326
3326
            else:
3327
3327
                c = Branch.open(directory).get_config()
3328
3328
            if email:
3333
3333
 
3334
3334
        # display a warning if an email address isn't included in the given name.
3335
3335
        try:
3336
 
            config.extract_email_address(name)
 
3336
            _mod_config.extract_email_address(name)
3337
3337
        except errors.NoEmailInUsername, e:
3338
3338
            warning('"%s" does not seem to contain an email address.  '
3339
3339
                    'This is allowed, but not recommended.', name)
3345
3345
            else:
3346
3346
                c = Branch.open(directory).get_config()
3347
3347
        else:
3348
 
            c = config.GlobalConfig()
 
3348
            c = _mod_config.GlobalConfig()
3349
3349
        c.set_user_option('email', name)
3350
3350
 
3351
3351
 
3418
3418
                'bzr alias --remove expects an alias to remove.')
3419
3419
        # If alias is not found, print something like:
3420
3420
        # unalias: foo: not found
3421
 
        c = config.GlobalConfig()
 
3421
        c = _mod_config.GlobalConfig()
3422
3422
        c.unset_alias(alias_name)
3423
3423
 
3424
3424
    @display_command
3425
3425
    def print_aliases(self):
3426
3426
        """Print out the defined aliases in a similar format to bash."""
3427
 
        aliases = config.GlobalConfig().get_aliases()
 
3427
        aliases = _mod_config.GlobalConfig().get_aliases()
3428
3428
        for key, value in sorted(aliases.iteritems()):
3429
3429
            self.outf.write('bzr alias %s="%s"\n' % (key, value))
3430
3430
 
3440
3440
 
3441
3441
    def set_alias(self, alias_name, alias_command):
3442
3442
        """Save the alias in the global config."""
3443
 
        c = config.GlobalConfig()
 
3443
        c = _mod_config.GlobalConfig()
3444
3444
        c.set_alias(alias_name, alias_command)
3445
3445
 
3446
3446
 
4807
4807
 
4808
4808
 
4809
4809
class cmd_break_lock(Command):
4810
 
    __doc__ = """Break a dead lock on a repository, branch or working directory.
 
4810
    __doc__ = """Break a dead lock.
 
4811
 
 
4812
    This command breaks a lock on a repository, branch, working directory or
 
4813
    config file.
4811
4814
 
4812
4815
    CAUTION: Locks should only be broken when you are sure that the process
4813
4816
    holding the lock has been stopped.
4818
4821
    :Examples:
4819
4822
        bzr break-lock
4820
4823
        bzr break-lock bzr+ssh://example.com/bzr/foo
 
4824
        bzr break-lock --conf ~/.bazaar
4821
4825
    """
 
4826
 
4822
4827
    takes_args = ['location?']
 
4828
    takes_options = [
 
4829
        Option('config',
 
4830
               help='LOCATION is the directory where the config lock is.'),
 
4831
        ]
4823
4832
 
4824
 
    def run(self, location=None, show=False):
 
4833
    def run(self, location=None, config=False):
4825
4834
        if location is None:
4826
4835
            location = u'.'
4827
 
        control, relpath = bzrdir.BzrDir.open_containing(location)
4828
 
        try:
4829
 
            control.break_lock()
4830
 
        except NotImplementedError:
4831
 
            pass
 
4836
        if config:
 
4837
            conf = _mod_config.LockableConfig(file_name=location)
 
4838
            conf.break_lock()
 
4839
        else:
 
4840
            control, relpath = bzrdir.BzrDir.open_containing(location)
 
4841
            try:
 
4842
                control.break_lock()
 
4843
            except NotImplementedError:
 
4844
                pass
4832
4845
 
4833
4846
 
4834
4847
class cmd_wait_until_signalled(Command):