~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/cmd_version_info.py

(gz) Never raise KnownFailure in tests,
 use knownFailure method instead (Martin [gz])

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
    version_info_formats,
26
26
    workingtree,
27
27
    )
28
 
from bzrlib.i18n import gettext
29
28
""")
30
29
 
31
30
from bzrlib.commands import Command
42
41
        return version_info_formats.get_builder(format)
43
42
    except KeyError:
44
43
        formats = version_info_formats.get_builder_formats()
45
 
        raise errors.BzrCommandError(gettext('No known version info format {0}.'
46
 
                                     ' Supported types are: {1}').format(
47
 
                                     format, formats))
 
44
        raise errors.BzrCommandError('No known version info format %s.'
 
45
                                     ' Supported types are: %s'
 
46
                                     % (format, formats))
48
47
 
49
48
 
50
49
class cmd_version_info(Command):
83
82
                     Option('include-file-revisions',
84
83
                            help='Include the last revision for each file.'),
85
84
                     Option('template', type=str, help='Template for the output.'),
86
 
                     'revision',
87
85
                     ]
88
86
    takes_args = ['location?']
89
87
 
91
89
 
92
90
    def run(self, location=None, format=None,
93
91
            all=False, check_clean=False, include_history=False,
94
 
            include_file_revisions=False, template=None,
95
 
            revision=None):
96
 
 
97
 
        if revision and len(revision) > 1:
98
 
            raise errors.BzrCommandError(
99
 
                gettext('bzr version-info --revision takes exactly'
100
 
                        ' one revision specifier'))
 
92
            include_file_revisions=False, template=None):
101
93
 
102
94
        if location is None:
103
95
            location = '.'
113
105
        else:
114
106
            b = wt.branch
115
107
 
116
 
        if all:
 
108
        if all or template:
117
109
            include_history = True
118
110
            check_clean = True
119
 
            include_file_revisions = True
120
 
        if template:
121
 
            include_history = True
122
 
            include_file_revisions = True
123
 
            if '{clean}' in template:
124
 
                check_clean = True
125
 
 
126
 
        if revision is not None:
127
 
            revision_id = revision[0].as_revision_id(b)
128
 
        else:
129
 
            revision_id = None
 
111
            include_file_revisions=True
130
112
 
131
113
        builder = format(b, working_tree=wt,
132
114
                check_for_clean=check_clean,
133
115
                include_revision_history=include_history,
134
116
                include_file_revisions=include_file_revisions,
135
 
                template=template, revision_id=revision_id)
 
117
                template=template)
136
118
        builder.generate(self.outf)