~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: John Arbash Meinel
  • Date: 2010-09-25 20:08:01 UTC
  • mfrom: (5444 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5445.
  • Revision ID: john@arbash-meinel.com-20100925200801-7uf0ux3uwxo9i3x0
Merge bzr.dev 5444 to resolve some small text conflicts.

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,
1354
1354
    If you want to discard your local changes, you can just do a
1355
1355
    'bzr revert' instead of 'bzr commit' after the update.
1356
1356
 
 
1357
    If you want to restore a file that has been removed locally, use
 
1358
    'bzr revert' instead of 'bzr update'.
 
1359
 
1357
1360
    If the tree's branch is bound to a master branch, it will also update
1358
1361
    the branch from the master.
1359
1362
    """
3322
3325
                try:
3323
3326
                    c = Branch.open_containing(u'.')[0].get_config()
3324
3327
                except errors.NotBranchError:
3325
 
                    c = config.GlobalConfig()
 
3328
                    c = _mod_config.GlobalConfig()
3326
3329
            else:
3327
3330
                c = Branch.open(directory).get_config()
3328
3331
            if email:
3333
3336
 
3334
3337
        # display a warning if an email address isn't included in the given name.
3335
3338
        try:
3336
 
            config.extract_email_address(name)
 
3339
            _mod_config.extract_email_address(name)
3337
3340
        except errors.NoEmailInUsername, e:
3338
3341
            warning('"%s" does not seem to contain an email address.  '
3339
3342
                    'This is allowed, but not recommended.', name)
3345
3348
            else:
3346
3349
                c = Branch.open(directory).get_config()
3347
3350
        else:
3348
 
            c = config.GlobalConfig()
 
3351
            c = _mod_config.GlobalConfig()
3349
3352
        c.set_user_option('email', name)
3350
3353
 
3351
3354
 
3418
3421
                'bzr alias --remove expects an alias to remove.')
3419
3422
        # If alias is not found, print something like:
3420
3423
        # unalias: foo: not found
3421
 
        c = config.GlobalConfig()
 
3424
        c = _mod_config.GlobalConfig()
3422
3425
        c.unset_alias(alias_name)
3423
3426
 
3424
3427
    @display_command
3425
3428
    def print_aliases(self):
3426
3429
        """Print out the defined aliases in a similar format to bash."""
3427
 
        aliases = config.GlobalConfig().get_aliases()
 
3430
        aliases = _mod_config.GlobalConfig().get_aliases()
3428
3431
        for key, value in sorted(aliases.iteritems()):
3429
3432
            self.outf.write('bzr alias %s="%s"\n' % (key, value))
3430
3433
 
3440
3443
 
3441
3444
    def set_alias(self, alias_name, alias_command):
3442
3445
        """Save the alias in the global config."""
3443
 
        c = config.GlobalConfig()
 
3446
        c = _mod_config.GlobalConfig()
3444
3447
        c.set_alias(alias_name, alias_command)
3445
3448
 
3446
3449
 
3481
3484
    If you set BZR_TEST_PDB=1 when running selftest, failing tests will drop
3482
3485
    into a pdb postmortem session.
3483
3486
 
 
3487
    The --coverage=DIRNAME global option produces a report with covered code
 
3488
    indicated.
 
3489
 
3484
3490
    :Examples:
3485
3491
        Run only tests relating to 'ignore'::
3486
3492
 
3570
3576
            randomize=None, exclude=None, strict=False,
3571
3577
            load_list=None, debugflag=None, starting_with=None, subunit=False,
3572
3578
            parallel=None, lsprof_tests=False):
3573
 
        from bzrlib.tests import selftest
3574
 
 
3575
 
        # Make deprecation warnings visible, unless -Werror is set
3576
 
        symbol_versioning.activate_deprecation_warnings(override=False)
 
3579
        from bzrlib import tests
3577
3580
 
3578
3581
        if testspecs_list is not None:
3579
3582
            pattern = '|'.join(testspecs_list)
3620
3623
                          "starting_with": starting_with
3621
3624
                          }
3622
3625
        selftest_kwargs.update(self.additional_selftest_args)
3623
 
        result = selftest(**selftest_kwargs)
 
3626
 
 
3627
        # Make deprecation warnings visible, unless -Werror is set
 
3628
        cleanup = symbol_versioning.activate_deprecation_warnings(
 
3629
            override=False)
 
3630
        try:
 
3631
            result = tests.selftest(**selftest_kwargs)
 
3632
        finally:
 
3633
            cleanup()
3624
3634
        return int(not result)
3625
3635
 
3626
3636
 
4794
4804
            self.outf.write('The above revision(s) will be removed.\n')
4795
4805
 
4796
4806
        if not force:
4797
 
            if not ui.ui_factory.get_boolean('Are you sure'):
4798
 
                self.outf.write('Canceled')
 
4807
            if not ui.ui_factory.confirm_action(
 
4808
                    'Uncommit these revisions',
 
4809
                    'bzrlib.builtins.uncommit',
 
4810
                    {}):
 
4811
                self.outf.write('Canceled\n')
4799
4812
                return 0
4800
4813
 
4801
4814
        mutter('Uncommitting from {%s} to {%s}',
4807
4820
 
4808
4821
 
4809
4822
class cmd_break_lock(Command):
4810
 
    __doc__ = """Break a dead lock on a repository, branch or working directory.
 
4823
    __doc__ = """Break a dead lock.
 
4824
 
 
4825
    This command breaks a lock on a repository, branch, working directory or
 
4826
    config file.
4811
4827
 
4812
4828
    CAUTION: Locks should only be broken when you are sure that the process
4813
4829
    holding the lock has been stopped.
4818
4834
    :Examples:
4819
4835
        bzr break-lock
4820
4836
        bzr break-lock bzr+ssh://example.com/bzr/foo
 
4837
        bzr break-lock --conf ~/.bazaar
4821
4838
    """
 
4839
 
4822
4840
    takes_args = ['location?']
 
4841
    takes_options = [
 
4842
        Option('config',
 
4843
               help='LOCATION is the directory where the config lock is.'),
 
4844
        ]
4823
4845
 
4824
 
    def run(self, location=None, show=False):
 
4846
    def run(self, location=None, config=False):
4825
4847
        if location is None:
4826
4848
            location = u'.'
4827
 
        control, relpath = bzrdir.BzrDir.open_containing(location)
4828
 
        try:
4829
 
            control.break_lock()
4830
 
        except NotImplementedError:
4831
 
            pass
 
4849
        if config:
 
4850
            conf = _mod_config.LockableConfig(file_name=location)
 
4851
            conf.break_lock()
 
4852
        else:
 
4853
            control, relpath = bzrdir.BzrDir.open_containing(location)
 
4854
            try:
 
4855
                control.break_lock()
 
4856
            except NotImplementedError:
 
4857
                pass
4832
4858
 
4833
4859
 
4834
4860
class cmd_wait_until_signalled(Command):
4919
4945
    not part of it.  (Such trees can be produced by "bzr split", but also by
4920
4946
    running "bzr branch" with the target inside a tree.)
4921
4947
 
4922
 
    The result is a combined tree, with the subtree no longer an independant
 
4948
    The result is a combined tree, with the subtree no longer an independent
4923
4949
    part.  This is marked as a merge of the subtree into the containing tree,
4924
4950
    and all history is preserved.
4925
4951
    """