/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-06-22 21:40:22 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-20060622214022-009a731bee5dce1c
Updated version-info to the latest bzr.dev codebase. Changed to using VersionInfoBuilder, and made tests pass.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
from bzrlib.commands import Command, register_command
26
26
from bzrlib.errors import BzrCommandError
27
27
from bzrlib.option import Option
 
28
from bzrlib.workingtree import WorkingTree
28
29
 
29
30
from generate_version_info import version_formats
30
31
 
55
56
                     ]
56
57
    takes_args = ['location?']
57
58
 
 
59
    encoding_type = 'exact'
 
60
 
58
61
    def run(self, location=None, format=None,
59
62
            all=False, check_clean=False, include_history=False,
60
63
            include_file_revisions=False):
65
68
        if format is None:
66
69
            format = version_formats[None]
67
70
 
68
 
        b = Branch.open_containing(location)[0]
69
 
 
70
 
        outf = codecs.getwriter('utf-8')(sys.stdout)
 
71
        wt = None
 
72
        try:
 
73
            wt = WorkingTree.open_containing(location)[0]
 
74
        except NoWorkingTree:
 
75
            b = Branch.open(location)
 
76
        else:
 
77
            b = wt.branch
71
78
 
72
79
        if all:
73
80
            include_history = True
74
81
            check_clean = True
75
82
            include_file_revisions=True
76
83
 
77
 
        format(b, to_file=outf,
 
84
        builder = format(b, working_tree=wt,
78
85
                check_for_clean=check_clean,
79
86
                include_revision_history=include_history,
80
87
                include_file_revisions=include_file_revisions)
 
88
        builder.generate(self.outf)
81
89
 
82
90
 
83
91
register_command(cmd_version_info)