~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bundle/serializer/__init__.py

  • Committer: Patch Queue Manager
  • Date: 2016-02-01 19:56:05 UTC
  • mfrom: (6615.1.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20160201195605-o7rl92wf6uyum3fk
(vila) Open trunk again as 2.8b1 (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2007, 2009, 2010 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
17
17
"""Serializer factory for reading and writing bundles.
18
18
"""
19
19
 
 
20
from __future__ import absolute_import
 
21
 
20
22
import base64
21
23
from StringIO import StringIO
22
24
import re
23
25
 
24
 
import bzrlib.errors as errors
 
26
from bzrlib import (
 
27
    errors,
 
28
    pyutils,
 
29
    )
25
30
from bzrlib.diff import internal_diff
26
31
from bzrlib.revision import NULL_REVISION
27
32
# For backwards-compatibility
156
161
        forced_bases = {revision_id:base_revision_id}
157
162
        if base_revision_id is NULL_REVISION:
158
163
            base_revision_id = None
159
 
        revision_ids = set(repository.get_ancestry(revision_id,
160
 
                           topo_sorted=False))
161
 
        revision_ids.difference_update(repository.get_ancestry(
162
 
            base_revision_id, topo_sorted=False))
 
164
        graph = repository.get_graph()
 
165
        revision_ids = graph.find_unique_ancestors(revision_id,
 
166
            [base_revision_id])
163
167
        revision_ids = list(repository.get_graph().iter_topo_order(
164
168
            revision_ids))
165
169
        revision_ids.reverse()
191
195
    :param overwrite: Should this version override a default
192
196
    """
193
197
    def _loader(version):
194
 
        mod = __import__(module, globals(), locals(), [classname])
195
 
        klass = getattr(mod, classname)
 
198
        klass = pyutils.get_named_object(module, classname)
196
199
        return klass(version)
197
200
    register(version, _loader, overwrite=overwrite)
198
201