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

  • Committer: Robert Collins
  • Date: 2007-09-19 05:14:14 UTC
  • mto: (2835.1.1 ianc-integration)
  • mto: This revision was merged to the branch mainline in revision 2836.
  • Revision ID: robertc@robertcollins.net-20070919051414-2tgjqteg7k3ps4h0
* ``pull``, ``merge`` and ``push`` will no longer silently correct some
  repository index errors that occured as a result of the Weave disk format.
  Instead the ``reconcile`` command needs to be run to correct those
  problems if they exist (and it has been able to fix most such problems
  since bzr 0.8). Some new problems have been identified during this release
  and you should run ``bzr check`` once on every repository to see if you
  need to reconcile. If you cannot ``pull`` or ``merge`` from a remote
  repository due to mismatched parent errors - a symptom of index errors -
  you should simply take a full copy of that remote repository to a clean
  directory outside any local repositories, then run reconcile on it, and
  finally pull from it locally. (And naturally email the repositories owner
  to ask them to upgrade and run reconcile).
  (Robert Collins)

* ``VersionedFile.fix_parents`` has been removed as a harmful API.
  ``VersionedFile.join`` will no longer accept different parents on either
  side of a join - it will either ignore them, or error, depending on the
  implementation. See notes when upgrading for more information.
  (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 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.
41
41
 
42
42
 
43
43
class cmd_bundle_info(Command):
44
 
    __doc__ = """Output interesting stats about a bundle"""
 
44
    """Output interesting stats about a bundle"""
45
45
 
46
46
    hidden = True
47
47
    takes_args = ['location']
54
54
        from bzrlib import osutils
55
55
        term_encoding = osutils.get_terminal_encoding()
56
56
        bundle_info = read_mergeable_from_url(location)
57
 
        if isinstance(bundle_info, merge_directive.BaseMergeDirective):
 
57
        if isinstance(bundle_info, merge_directive._BaseMergeDirective):
58
58
            bundle_file = StringIO(bundle_info.get_raw_bundle())
59
59
            bundle_info = read_bundle(bundle_file)
60
60
        else:
61
61
            if verbose:
62
 
                raise errors.BzrCommandError('--verbose requires a merge'
63
 
                    ' directive')
 
62
                raise errors.BzrCommandError('Verbose requires a merge'
 
63
                                             ' directive')
64
64
        reader_method = getattr(bundle_info, 'get_bundle_reader', None)
65
65
        if reader_method is None:
66
66
            raise errors.BzrCommandError('Bundle format not supported')
73
73
                (bytes, parents, repo_kind, revision_id, file_id))
74
74
            if file_id is not None:
75
75
                file_ids.add(file_id)
76
 
        self.outf.write('Records\n')
 
76
        print >> self.outf, 'Records'
77
77
        for kind, records in sorted(by_kind.iteritems()):
78
78
            multiparent = sum(1 for b, m, k, r, f in records if
79
79
                              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))
83
 
        self.outf.write('\n')
 
80
            print >> self.outf, '%s: %d (%d multiparent)' % \
 
81
                (kind, len(records), multiparent)
 
82
        print >> self.outf, 'unique files: %d' % len(file_ids)
 
83
        print >> self.outf
84
84
        nicks = set()
85
85
        committers = set()
86
86
        for revision in bundle_info.real_revisions:
88
88
                nicks.add(revision.properties['branch-nick'])
89
89
            committers.add(revision.committer)
90
90
 
91
 
        self.outf.write('Revisions\n')
92
 
        self.outf.write(('nicks: %s\n'
93
 
            % ', '.join(sorted(nicks))).encode(term_encoding, 'replace'))
94
 
        self.outf.write(('committers: \n%s\n' %
95
 
        '\n'.join(sorted(committers)).encode(term_encoding, 'replace')))
 
91
        print >> self.outf, 'Revisions'
 
92
        print >> self.outf, ('nicks: %s'
 
93
            % ', '.join(sorted(nicks))).encode(term_encoding, 'replace')
 
94
        print >> self.outf, ('committers: \n%s' %
 
95
        '\n'.join(sorted(committers)).encode(term_encoding, 'replace'))
96
96
        if verbose:
97
 
            self.outf.write('\n')
 
97
            print >> self.outf
98
98
            bundle_file.seek(0)
99
99
            line = bundle_file.readline()
100
100
            line = bundle_file.readline()
101
101
            content = bundle_file.read().decode('bz2')
102
 
            self.outf.write("Decoded contents\n")
 
102
            print >> self.outf, "Decoded contents"
103
103
            self.outf.write(content)
104
 
            self.outf.write('\n')
 
104
            print >> self.outf