~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bundle/commands.py

  • Committer: Martin Pool
  • Date: 2011-04-19 07:52:11 UTC
  • mto: This revision was merged to the branch mainline in revision 5833.
  • Revision ID: mbp@sourcefrog.net-20110419075211-3m94qorhr0rg3gzg
Add and test _RulesSearcher.get_single_value

Show diffs side-by-side

added added

removed removed

Lines of Context:
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
 
 
17
16
"""\
18
17
This is an attempt to take the internal delta object, and represent
19
18
it as a single-file text-only changeset.
21
20
and for applying a changeset.
22
21
"""
23
22
 
24
 
from __future__ import absolute_import
25
 
 
26
23
from cStringIO import StringIO
27
24
 
28
25
from bzrlib.lazy_import import lazy_import
35
32
    urlutils,
36
33
    transport,
37
34
    )
38
 
from bzrlib.i18n import gettext
39
35
""")
40
36
 
41
37
from bzrlib.commands import Command
60
56
            bundle_info = read_bundle(bundle_file)
61
57
        else:
62
58
            if verbose:
63
 
                raise errors.BzrCommandError(gettext(
64
 
                            '--verbose requires a merge directive'))
 
59
                raise errors.BzrCommandError('--verbose requires a merge'
 
60
                    ' directive')
65
61
        reader_method = getattr(bundle_info, 'get_bundle_reader', None)
66
62
        if reader_method is None:
67
 
            raise errors.BzrCommandError(gettext('Bundle format not supported'))
 
63
            raise errors.BzrCommandError('Bundle format not supported')
68
64
 
69
65
        by_kind = {}
70
66
        file_ids = set()
74
70
                (bytes, parents, repo_kind, revision_id, file_id))
75
71
            if file_id is not None:
76
72
                file_ids.add(file_id)
77
 
        self.outf.write(gettext('Records\n'))
 
73
        self.outf.write('Records\n')
78
74
        for kind, records in sorted(by_kind.iteritems()):
79
75
            multiparent = sum(1 for b, m, k, r, f in records if
80
76
                              len(m.get('parents', [])) > 1)
81
 
            self.outf.write(gettext('{0}: {1} ({2} multiparent)\n').format(
82
 
                kind, len(records), multiparent))
83
 
        self.outf.write(gettext('unique files: %d\n') % len(file_ids))
 
77
            self.outf.write('%s: %d (%d multiparent)\n' % \
 
78
                (kind, len(records), multiparent))
 
79
        self.outf.write('unique files: %d\n' % len(file_ids))
84
80
        self.outf.write('\n')
85
81
        nicks = set()
86
82
        committers = set()
89
85
                nicks.add(revision.properties['branch-nick'])
90
86
            committers.add(revision.committer)
91
87
 
92
 
        self.outf.write(gettext('Revisions\n'))
93
 
        self.outf.write((gettext('nicks: %s\n')
 
88
        self.outf.write('Revisions\n')
 
89
        self.outf.write(('nicks: %s\n'
94
90
            % ', '.join(sorted(nicks))).encode(term_encoding, 'replace'))
95
 
        self.outf.write((gettext('committers: \n%s\n') %
 
91
        self.outf.write(('committers: \n%s\n' %
96
92
        '\n'.join(sorted(committers)).encode(term_encoding, 'replace')))
97
93
        if verbose:
98
94
            self.outf.write('\n')
100
96
            line = bundle_file.readline()
101
97
            line = bundle_file.readline()
102
98
            content = bundle_file.read().decode('bz2')
103
 
            self.outf.write(gettext("Decoded contents\n"))
 
99
            self.outf.write("Decoded contents\n")
104
100
            self.outf.write(content)
105
101
            self.outf.write('\n')