~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Martin Packman
  • Date: 2011-12-08 19:00:14 UTC
  • mto: This revision was merged to the branch mainline in revision 6359.
  • Revision ID: martin.packman@canonical.com-20111208190014-mi8jm6v7jygmhb0r
Use --include-duplicates for make update-pot which already combines multiple msgid strings prettily

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
from __future__ import absolute_import
18
17
 
19
18
# TODO: Define arguments by objects, rather than just using names.
20
19
# Those objects can specify the expected type of the argument, which
33
32
 
34
33
import bzrlib
35
34
from bzrlib import (
36
 
    config,
37
35
    cleanup,
38
36
    cmdline,
39
37
    debug,
52
50
from bzrlib.option import Option
53
51
from bzrlib.plugin import disable_plugins, load_plugins
54
52
from bzrlib import registry
 
53
from bzrlib.symbol_versioning import (
 
54
    deprecated_function,
 
55
    deprecated_in,
 
56
    deprecated_method,
 
57
    )
55
58
 
56
59
 
57
60
class CommandInfo(object):
690
693
        """
691
694
        class_run = self.run
692
695
        def run(*args, **kwargs):
693
 
            for hook in Command.hooks['pre_command']:
694
 
                hook(self)
695
696
            self._operation = cleanup.OperationWithCleanups(class_run)
696
697
            try:
697
698
                return self._operation.run_simple(*args, **kwargs)
698
699
            finally:
699
700
                del self._operation
700
 
                for hook in Command.hooks['post_command']:
701
 
                    hook(self)
702
701
        self.run = run
703
702
 
704
703
    def run(self):
792
791
            " is safe to mutate - e.g. to remove a command. "
793
792
            "list_commands should return the updated set of command names.",
794
793
            (1, 17))
795
 
        self.add_hook('pre_command',
796
 
            "Called prior to executing a command. Called with the command "
797
 
            "object.", (2, 6))
798
 
        self.add_hook('post_command',
799
 
            "Called after executing a command. Called with the command "
800
 
            "object.", (2, 6))
801
794
 
802
795
Command.hooks = CommandHooks()
803
796
 
1082
1075
            argv_copy.append(a)
1083
1076
        i += 1
1084
1077
 
1085
 
    if bzrlib.global_state is None:
1086
 
        # FIXME: Workaround for users that imported bzrlib but didn't call
1087
 
        # bzrlib.initialize -- vila 2012-01-19
1088
 
        cmdline_overrides = config.CommandLineStore()
1089
 
    else:
1090
 
        cmdline_overrides = bzrlib.global_state.cmdline_overrides
1091
 
    cmdline_overrides._from_cmdline(override_config)
 
1078
    bzrlib.global_state.cmdline_overrides._from_cmdline(override_config)
1092
1079
 
1093
1080
    debug.set_debug_flags_from_config()
1094
1081
 
1148
1135
            trace.debug_memory('Process status after command:', short=False)
1149
1136
        option._verbosity_level = saved_verbosity_level
1150
1137
        # Reset the overrides 
1151
 
        cmdline_overrides._reset()
 
1138
        bzrlib.global_state.cmdline_overrides._reset()
1152
1139
 
1153
1140
 
1154
1141
def display_command(func):