~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bundle/commands.py

  • Committer: Aaron Bentley
  • Date: 2007-08-20 13:07:12 UTC
  • mfrom: (2732 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2733.
  • Revision ID: abentley@panoramicfeedback.com-20070820130712-buopmg528zcgwyxc
Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
 
46
46
    hidden = True
47
47
    takes_args = ['location']
48
 
    takes_options = []
 
48
    takes_options = ['verbose']
49
49
    encoding_type = 'exact'
50
50
 
51
51
    def run(self, location, verbose=False):
55
55
        term_encoding = osutils.get_terminal_encoding()
56
56
        bundle_info = read_mergeable_from_url(location)
57
57
        if isinstance(bundle_info, merge_directive._BaseMergeDirective):
58
 
            bundle_info = read_bundle(StringIO(bundle_info.get_raw_bundle()))
 
58
            bundle_file = StringIO(bundle_info.get_raw_bundle())
 
59
            bundle_info = read_bundle(bundle_file)
 
60
        else:
 
61
            if verbose:
 
62
                raise errors.BzrCommandError('Verbose requires a merge'
 
63
                                             ' directive')
59
64
        reader_method = getattr(bundle_info, 'get_bundle_reader', None)
60
65
        if reader_method is None:
61
66
            raise errors.BzrCommandError('Bundle format not supported')
70
75
                file_ids.add(file_id)
71
76
        print >> self.outf, 'Records'
72
77
        for kind, records in sorted(by_kind.iteritems()):
73
 
            multiparent = sum(1 for b, p, k, r, f in records if len(p) > 1)
 
78
            multiparent = sum(1 for b, m, k, r, f in records if
 
79
                              len(m.get('parents', [])) > 1)
74
80
            print >> self.outf, '%s: %d (%d multiparent)' % \
75
81
                (kind, len(records), multiparent)
76
82
        print >> self.outf, 'unique files: %d' % len(file_ids)