/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 breezy/cmd_version_info.py

  • Committer: Jelmer Vernooij
  • Date: 2018-02-18 21:42:57 UTC
  • mto: This revision was merged to the branch mainline in revision 6859.
  • Revision ID: jelmer@jelmer.uk-20180218214257-jpevutp1wa30tz3v
Update TODO to reference Breezy, not Bazaar.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Commands for generating snapshot information about a brz tree."""
18
18
 
 
19
from __future__ import absolute_import
 
20
 
19
21
from .lazy_import import lazy_import
20
22
 
21
23
lazy_import(globals(), """
22
24
from breezy import (
23
25
    branch,
 
26
    errors,
24
27
    version_info_formats,
25
28
    workingtree,
26
29
    )
27
30
from breezy.i18n import gettext
28
31
""")
29
32
 
30
 
from . import (
31
 
    errors,
32
 
    )
33
33
from .commands import Command
34
34
from .option import Option, RegistryOption
 
35
from .sixish import text_type
35
36
 
36
37
 
37
38
def _parse_version_info_format(format):
44
45
        return version_info_formats.get_builder(format)
45
46
    except KeyError:
46
47
        formats = version_info_formats.get_builder_formats()
47
 
        raise errors.CommandError(
48
 
            gettext('No known version info format {0}.'
49
 
                    ' Supported types are: {1}').format(format, formats))
 
48
        raise errors.BzrCommandError(gettext('No known version info format {0}.'
 
49
                                     ' Supported types are: {1}').format(
 
50
                                     format, formats))
50
51
 
51
52
 
52
53
class cmd_version_info(Command):
74
75
    """
75
76
 
76
77
    takes_options = [RegistryOption('format',
77
 
                                    'Select the output format.',
78
 
                                    value_switches=True,
79
 
                                    lazy_registry=('breezy.version_info_formats',
80
 
                                                   'format_registry')),
 
78
                            'Select the output format.',
 
79
                            value_switches=True,
 
80
                            lazy_registry=('breezy.version_info_formats',
 
81
                                           'format_registry')),
81
82
                     Option('all', help='Include all possible information.'),
82
83
                     Option('check-clean', help='Check if tree is clean.'),
83
84
                     Option('include-history',
84
85
                            help='Include the revision-history.'),
85
86
                     Option('include-file-revisions',
86
87
                            help='Include the last revision for each file.'),
87
 
                     Option('template', type=str,
88
 
                            help='Template for the output.'),
 
88
                     Option('template', type=text_type, help='Template for the output.'),
89
89
                     'revision',
90
90
                     ]
91
91
    takes_args = ['location?']
92
92
 
93
 
    encoding_type = 'replace'
 
93
    encoding_type = 'exact'
94
94
 
95
95
    def run(self, location=None, format=None,
96
96
            all=False, check_clean=False, include_history=False,
98
98
            revision=None):
99
99
 
100
100
        if revision and len(revision) > 1:
101
 
            raise errors.CommandError(
 
101
            raise errors.BzrCommandError(
102
102
                gettext('brz version-info --revision takes exactly'
103
103
                        ' one revision specifier'))
104
104
 
132
132
            revision_id = None
133
133
 
134
134
        builder = format(b, working_tree=wt,
135
 
                         check_for_clean=check_clean,
136
 
                         include_revision_history=include_history,
137
 
                         include_file_revisions=include_file_revisions,
138
 
                         template=template, revision_id=revision_id)
 
135
                check_for_clean=check_clean,
 
136
                include_revision_history=include_history,
 
137
                include_file_revisions=include_file_revisions,
 
138
                template=template, revision_id=revision_id)
139
139
        builder.generate(self.outf)