/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 breezy/bundle/commands.py

  • Committer: Jelmer Vernooij
  • Date: 2019-03-05 07:32:38 UTC
  • mto: (7290.1.21 work)
  • mto: This revision was merged to the branch mainline in revision 7311.
  • Revision ID: jelmer@jelmer.uk-20190305073238-zlqn981opwnqsmzi
Add appveyor configuration.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
and for applying a changeset.
22
22
"""
23
23
 
24
 
from io import BytesIO
25
 
 
26
 
from ... import (
27
 
    errors,
28
 
    )
29
 
 
30
 
from ...lazy_import import lazy_import
 
24
from __future__ import absolute_import
 
25
 
 
26
from ..lazy_import import lazy_import
31
27
lazy_import(globals(), """
32
28
from breezy import (
33
29
    branch,
 
30
    errors,
34
31
    merge_directive,
35
32
    revision as _mod_revision,
36
33
    urlutils,
39
36
from breezy.i18n import gettext
40
37
""")
41
38
 
42
 
from ...commands import Command
 
39
from ..commands import Command
 
40
from ..sixish import (
 
41
    BytesIO,
 
42
    viewitems,
 
43
    )
43
44
 
44
45
 
45
46
class cmd_bundle_info(Command):
51
52
    encoding_type = 'exact'
52
53
 
53
54
    def run(self, location, verbose=False):
54
 
        from breezy.bzr.bundle.serializer import read_bundle
55
 
        from breezy.mergeable import read_mergeable_from_url
 
55
        from breezy.bundle.serializer import read_bundle
 
56
        from breezy.bundle import read_mergeable_from_url
56
57
        from breezy import osutils
57
58
        term_encoding = osutils.get_terminal_encoding()
58
59
        bundle_info = read_mergeable_from_url(location)
61
62
            bundle_info = read_bundle(bundle_file)
62
63
        else:
63
64
            if verbose:
64
 
                raise errors.CommandError(gettext(
 
65
                raise errors.BzrCommandError(gettext(
65
66
                    '--verbose requires a merge directive'))
66
67
        reader_method = getattr(bundle_info, 'get_bundle_reader', None)
67
68
        if reader_method is None:
68
 
            raise errors.CommandError(
 
69
            raise errors.BzrCommandError(
69
70
                gettext('Bundle format not supported'))
70
71
 
71
72
        by_kind = {}
77
78
            if file_id is not None:
78
79
                file_ids.add(file_id)
79
80
        self.outf.write(gettext('Records\n'))
80
 
        for kind, records in sorted(by_kind.items()):
 
81
        for kind, records in sorted(viewitems(by_kind)):
81
82
            multiparent = sum(1 for b, m, k, r, f in records if
82
83
                              len(m.get('parents', [])) > 1)
83
84
            self.outf.write(gettext('{0}: {1} ({2} multiparent)\n').format(