/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/__init__.py

  • Committer: Aaron Bentley
  • Date: 2007-03-16 15:14:40 UTC
  • mto: This revision was merged to the branch mainline in revision 2389.
  • Revision ID: abentley@panoramicfeedback.com-20070316151440-kwqaumvxjcyiurv2
Change bundle reader and merge directive to both be 'mergeables'

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
def read_bundle_from_url(url):
31
31
    return read_bundle_or_directive_from_url(url, _do_directive=False)[0]
32
32
 
33
 
def read_bundle_or_directive_from_url(url, _do_directive=True):
34
 
    """Read a bundle from a given URL.
 
33
def read_mergeable_from_url(url, _do_directive=True):
 
34
    """Read mergable object from a given URL.
35
35
 
36
 
    :return: A BundleReader, may raise NotABundle if the target 
37
 
            is not a proper bundle.
 
36
    :return: An object supporting get_target_revision.  Raises NotABundle if
 
37
        the target is not a mergeable type.
38
38
    """
39
39
    from bzrlib.merge_directive import MergeDirective
40
40
    url = urlutils.normalize_url(url)
52
52
        f = t.get(filename)
53
53
        if _do_directive:
54
54
            directive = MergeDirective.from_lines(f.readlines())
55
 
            if directive.patch_type == 'bundle':
56
 
                reader = _serializer.read_bundle(StringIO(directive.patch))
57
 
            else:
58
 
                reader = None
59
 
            return reader, directive
 
55
            return directive
60
56
        else:
61
 
            return _serializer.read_bundle(f), None
 
57
            return _serializer.read_bundle(f)
62
58
    except (errors.TransportError, errors.PathError), e:
63
59
        raise errors.NotABundle(str(e))
64
60
    except (IOError,), e: