~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bundle/commands.py

Merge bzr.dev, update to use new hooks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 Canonical Ltd
 
1
# Copyright (C) 2005-2011 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
20
20
and for applying a changeset.
21
21
"""
22
22
 
23
 
import sys
24
23
from cStringIO import StringIO
25
24
 
26
25
from bzrlib.lazy_import import lazy_import
33
32
    urlutils,
34
33
    transport,
35
34
    )
 
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
41
39
 
42
40
 
43
41
class cmd_bundle_info(Command):
59
57
            bundle_info = read_bundle(bundle_file)
60
58
        else:
61
59
            if verbose:
62
 
                raise errors.BzrCommandError('--verbose requires a merge'
63
 
                    ' directive')
 
60
                raise errors.BzrCommandError(gettext(
 
61
                            '--verbose requires a merge directive'))
64
62
        reader_method = getattr(bundle_info, 'get_bundle_reader', None)
65
63
        if reader_method is None:
66
 
            raise errors.BzrCommandError('Bundle format not supported')
 
64
            raise errors.BzrCommandError(gettext('Bundle format not supported'))
67
65
 
68
66
        by_kind = {}
69
67
        file_ids = set()
73
71
                (bytes, parents, repo_kind, revision_id, file_id))
74
72
            if file_id is not None:
75
73
                file_ids.add(file_id)
76
 
        self.outf.write('Records\n')
 
74
        self.outf.write(gettext('Records\n'))
77
75
        for kind, records in sorted(by_kind.iteritems()):
78
76
            multiparent = sum(1 for b, m, k, r, f in records if
79
77
                              len(m.get('parents', [])) > 1)
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))
 
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))
83
81
        self.outf.write('\n')
84
82
        nicks = set()
85
83
        committers = set()
88
86
                nicks.add(revision.properties['branch-nick'])
89
87
            committers.add(revision.committer)
90
88
 
91
 
        self.outf.write('Revisions\n')
92
 
        self.outf.write(('nicks: %s\n'
 
89
        self.outf.write(gettext('Revisions\n'))
 
90
        self.outf.write((gettext('nicks: %s\n')
93
91
            % ', '.join(sorted(nicks))).encode(term_encoding, 'replace'))
94
 
        self.outf.write(('committers: \n%s\n' %
 
92
        self.outf.write((gettext('committers: \n%s\n') %
95
93
        '\n'.join(sorted(committers)).encode(term_encoding, 'replace')))
96
94
        if verbose:
97
95
            self.outf.write('\n')
99
97
            line = bundle_file.readline()
100
98
            line = bundle_file.readline()
101
99
            content = bundle_file.read().decode('bz2')
102
 
            self.outf.write("Decoded contents\n")
 
100
            self.outf.write(gettext("Decoded contents\n"))
103
101
            self.outf.write(content)
104
102
            self.outf.write('\n')