/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 __init__.py

  • Committer: John Arbash Meinel
  • Date: 2006-08-09 20:25:06 UTC
  • mto: (2022.1.1 version-info-55794)
  • mto: This revision was merged to the branch mainline in revision 2028.
  • Revision ID: john@arbash-meinel.com-20060809202506-dd9f277c93c6c977
Splitting up the version info code into a lazy factory style.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005 Canonical Ltd
2
 
 
 
1
# Copyright (C) 2005, 2006 Canonical Ltd
 
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
5
5
# the Free Software Foundation; either version 2 of the License, or
6
6
# (at your option) any later version.
7
 
 
 
7
#
8
8
# This program is distributed in the hope that it will be useful,
9
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
11
# GNU General Public License for more details.
12
 
 
 
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
 
"""\
18
 
Plugin for generating snapshot information about a bzr tree.
19
 
"""
 
17
"""Plugin for generating snapshot information about a bzr tree."""
20
18
 
21
19
import sys
22
20
import codecs
27
25
from bzrlib.option import Option
28
26
from bzrlib.workingtree import WorkingTree
29
27
 
30
 
from generate_version_info import version_formats
 
28
import version_info_formats
31
29
 
32
30
 
33
31
def _parse_version_info_format(format):
34
32
    try:
35
 
        return version_formats[format]
 
33
        return version_info_formats.get_builder(format)
36
34
    except KeyError:
37
 
        formats = version_formats.keys()
38
 
        formats.remove(None)
 
35
        formats = version_info_formats.get_builder_formats()
39
36
        raise BzrCommandError('No known version info format %s.'
40
 
                ' Supported types are: %s' 
41
 
                % (format, formats))
 
37
                              ' Supported types are: %s' 
 
38
                              % (format, formats))
42
39
 
43
40
 
44
41
class cmd_version_info(Command):
45
 
    """Generate version information about this tree.
46
 
    """
 
42
    """Generate version information about this tree."""
47
43
 
48
44
    takes_options = [Option('format', type=_parse_version_info_format,
49
45
                            help='Select the output format'),
50
46
                     Option('all', help='include all possible information'),
51
47
                     Option('check-clean', help='check if tree is clean'),
52
 
                     Option('include-history', 
 
48
                     Option('include-history',
53
49
                            help='Include the revision-history'),
54
50
                     Option('include-file-revisions',
55
51
                            help='Include the last revision for each file')