/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/transport/log.py

  • Committer: Vincent Ladeuil
  • Date: 2009-10-06 14:40:37 UTC
  • mto: (4728.1.2 integration)
  • mto: This revision was merged to the branch mainline in revision 4731.
  • Revision ID: v.ladeuil+lp@free.fr-20091006144037-o76rgosv9hj3td0y
Simplify mutable_tree.has_changes() and update call sites.

* bzrlib/workingtree.py:
(WorkingTree.merge_from_branch): Add a force parameter. Replace
the check_basis() call by the corresponding code, taken the new
'force' parameter into account.

* bzrlib/tests/test_status.py:
(TestStatus.make_multiple_pending_tree): Add force=True on
supplementary merges.

* bzrlib/tests/test_reconfigure.py:
(TestReconfigure): Add a test for pending merges.

* bzrlib/tests/test_msgeditor.py:
(MsgEditorTest.make_multiple_pending_tree): Add force=True on
supplementary merges.

* bzrlib/tests/blackbox/test_uncommit.py:
(TestUncommit.test_uncommit_octopus_merge): Add force=True on
supplementary merges.

* bzrlib/send.py:
(send): Use the simplified has_changes(). Fix typo in comment too.

* bzrlib/reconfigure.py:
(Reconfigure._check): Use the simplified has_changes().

* bzrlib/mutabletree.py:
(MutableTree.has_changes): Make the tree parameter optional but
retain it for tests. Add a pending merges check.

* bzrlib/merge.py:
(Merger.ensure_revision_trees, Merger.file_revisions,
Merger.check_basis, Merger.compare_basis): Deprecate.

* bzrlib/bundle/apply_bundle.py:
(merge_bundle): Replace the check_basis() call by the
corresponding code.

* bzrlib/builtins.py:
(cmd_remove_tree.run, cmd_push.run, cmd_merge.run): Use the
simplified has_changes().
(cmd_merge.run): Replace the check_basis call() by the corresponding
code (minus the alredy done has_changes() check).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008, 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2007 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
26
26
import types
27
27
 
28
28
from bzrlib.trace import mutter
29
 
from bzrlib.transport import decorator
30
 
 
31
 
 
32
 
class TransportLogDecorator(decorator.TransportDecorator):
 
29
from bzrlib.transport.decorator import (
 
30
    TransportDecorator,
 
31
    )
 
32
from bzrlib.transport.trace import (
 
33
    DecoratorServer,
 
34
    TransportTraceDecorator,
 
35
    )
 
36
 
 
37
 
 
38
 
 
39
 
 
40
class TransportLogDecorator(TransportDecorator):
33
41
    """Decorator for Transports that logs interesting operations to .bzr.log.
34
42
 
35
43
    In general we want to log things that usually take a network round trip
128
136
        if False:
129
137
            elapsed = time.time() - before
130
138
            if result_len and elapsed > 0:
131
 
                # this is the rate of higher-level data, not the raw network
132
 
                # speed using base-10 units (see HACKING.txt).
133
 
                mutter("      %9.03fs %8dkB/s"
134
 
                       % (elapsed, result_len/elapsed/1000))
 
139
                # this is the rate of higher-level data, not the raw network speed
 
140
                mutter("      %9.03fs %8dKB/s" % (elapsed, result_len/elapsed/1024))
135
141
            else:
136
142
                mutter("      %9.03fs" % (elapsed))
137
143
        return return_result
148
154
        return t
149
155
 
150
156
 
 
157
class LogDecoratorServer(DecoratorServer):
 
158
    """Server for testing."""
 
159
 
 
160
    def get_decorator_class(self):
 
161
        return TransportLogDecorator
 
162
 
 
163
 
151
164
def get_test_permutations():
152
165
    """Return the permutations to be used in testing."""
153
 
    from bzrlib.tests import test_server
154
 
    return [(TransportLogDecorator, test_server.LogDecoratorServer)]
 
166
    return [(TransportLogDecorator, LogDecoratorServer)]