~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bundle/commands.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-03-16 16:58:03 UTC
  • mfrom: (3224.3.1 news-typo)
  • Revision ID: pqm@pqm.ubuntu.com-20080316165803-tisoc9mpob9z544o
(Matt Nordhoff) Trivial NEWS typo fix

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2011 Canonical Ltd
 
1
# Copyright (C) 2006 Canonical Ltd
2
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
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
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
"""\
17
17
This is an attempt to take the internal delta object, and represent
18
18
it as a single-file text-only changeset.
20
20
and for applying a changeset.
21
21
"""
22
22
 
 
23
import sys
23
24
from cStringIO import StringIO
24
25
 
25
26
from bzrlib.lazy_import import lazy_import
32
33
    urlutils,
33
34
    transport,
34
35
    )
35
 
from bzrlib.i18n import gettext
36
36
""")
37
37
 
38
38
from bzrlib.commands import Command
 
39
from bzrlib.option import Option
 
40
from bzrlib.trace import note
39
41
 
40
42
 
41
43
class cmd_bundle_info(Command):
42
 
    __doc__ = """Output interesting stats about a bundle"""
 
44
    """Output interesting stats about a bundle"""
43
45
 
44
46
    hidden = True
45
47
    takes_args = ['location']
52
54
        from bzrlib import osutils
53
55
        term_encoding = osutils.get_terminal_encoding()
54
56
        bundle_info = read_mergeable_from_url(location)
55
 
        if isinstance(bundle_info, merge_directive.BaseMergeDirective):
 
57
        if isinstance(bundle_info, merge_directive._BaseMergeDirective):
56
58
            bundle_file = StringIO(bundle_info.get_raw_bundle())
57
59
            bundle_info = read_bundle(bundle_file)
58
60
        else:
59
61
            if verbose:
60
 
                raise errors.BzrCommandError(gettext(
61
 
                            '--verbose requires a merge directive'))
 
62
                raise errors.BzrCommandError('--verbose requires a merge'
 
63
                    ' directive')
62
64
        reader_method = getattr(bundle_info, 'get_bundle_reader', None)
63
65
        if reader_method is None:
64
 
            raise errors.BzrCommandError(gettext('Bundle format not supported'))
 
66
            raise errors.BzrCommandError('Bundle format not supported')
65
67
 
66
68
        by_kind = {}
67
69
        file_ids = set()
71
73
                (bytes, parents, repo_kind, revision_id, file_id))
72
74
            if file_id is not None:
73
75
                file_ids.add(file_id)
74
 
        self.outf.write(gettext('Records\n'))
 
76
        self.outf.write('Records\n')
75
77
        for kind, records in sorted(by_kind.iteritems()):
76
78
            multiparent = sum(1 for b, m, k, r, f in records if
77
79
                              len(m.get('parents', [])) > 1)
78
 
            self.outf.write(gettext('{0}: {1} ({2} multiparent)\n').format(
79
 
                kind, len(records), multiparent))
80
 
        self.outf.write(gettext('unique files: %d\n') % len(file_ids))
 
80
            self.outf.write('%s: %d (%d multiparent)\n' % \
 
81
                (kind, len(records), multiparent))
 
82
        self.outf.write('unique files: %d\n' % len(file_ids))
81
83
        self.outf.write('\n')
82
84
        nicks = set()
83
85
        committers = set()
86
88
                nicks.add(revision.properties['branch-nick'])
87
89
            committers.add(revision.committer)
88
90
 
89
 
        self.outf.write(gettext('Revisions\n'))
90
 
        self.outf.write((gettext('nicks: %s\n')
 
91
        self.outf.write('Revisions\n')
 
92
        self.outf.write(('nicks: %s\n'
91
93
            % ', '.join(sorted(nicks))).encode(term_encoding, 'replace'))
92
 
        self.outf.write((gettext('committers: \n%s\n') %
 
94
        self.outf.write(('committers: \n%s\n' %
93
95
        '\n'.join(sorted(committers)).encode(term_encoding, 'replace')))
94
96
        if verbose:
95
97
            self.outf.write('\n')
97
99
            line = bundle_file.readline()
98
100
            line = bundle_file.readline()
99
101
            content = bundle_file.read().decode('bz2')
100
 
            self.outf.write(gettext("Decoded contents\n"))
 
102
            self.outf.write("Decoded contents\n")
101
103
            self.outf.write(content)
102
104
            self.outf.write('\n')