~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bundle/__init__.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-09-01 08:02:42 UTC
  • mfrom: (5390.3.3 faster-revert-593560)
  • Revision ID: pqm@pqm.ubuntu.com-20100901080242-esg62ody4frwmy66
(spiv) Avoid repeatedly calling self.target.all_file_ids() in
 InterTree.iter_changes. (Andrew Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
16
 
17
 
from __future__ import absolute_import
18
 
 
19
17
from cStringIO import StringIO
20
18
 
21
19
from bzrlib.lazy_import import lazy_import
22
20
lazy_import(globals(), """
23
21
from bzrlib import (
24
22
    errors,
25
 
    transport as _mod_transport,
26
23
    urlutils,
27
24
    )
28
25
from bzrlib.bundle import serializer as _serializer
29
26
from bzrlib.merge_directive import MergeDirective
30
 
from bzrlib.i18n import gettext
 
27
from bzrlib.transport import (
 
28
    do_catching_redirections,
 
29
    get_transport,
 
30
    )
31
31
""")
32
32
from bzrlib.trace import note
33
33
 
38
38
    :return: An object supporting get_target_revision.  Raises NotABundle if
39
39
        the target is not a mergeable type.
40
40
    """
41
 
    child_transport = _mod_transport.get_transport(url,
 
41
    child_transport = get_transport(url,
42
42
        possible_transports=possible_transports)
43
43
    transport = child_transport.clone('..')
44
44
    filename = transport.relpath(child_transport.base)
56
56
        url, filename = urlutils.split(exception.target,
57
57
                                       exclude_trailing_slash=False)
58
58
        if not filename:
59
 
            raise errors.NotABundle(gettext('A directory cannot be a bundle'))
60
 
        return _mod_transport.get_transport_from_url(url)
 
59
            raise errors.NotABundle('A directory cannot be a bundle')
 
60
        return get_transport(url)
61
61
 
62
62
    try:
63
 
        bytef, transport = _mod_transport.do_catching_redirections(
64
 
            get_bundle, transport, redirected_transport)
 
63
        bytef, transport = do_catching_redirections(get_bundle, transport,
 
64
                                                    redirected_transport)
65
65
    except errors.TooManyRedirections:
66
66
        raise errors.NotABundle(transport.clone(filename).base)
67
67
    except (errors.ConnectionReset, errors.ConnectionError), e: