~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
from bzrlib.store.text import TextStore
40
40
from bzrlib.symbol_versioning import *
41
41
from bzrlib.trace import mutter, note
42
 
from bzrlib.tree import RevisionTree
 
42
from bzrlib.tree import RevisionTree, EmptyTree
43
43
from bzrlib.tsort import topo_sort
44
44
from bzrlib.testament import Testament
45
45
from bzrlib.tree import EmptyTree
 
46
from bzrlib.delta import compare_trees
46
47
import bzrlib.ui
47
48
from bzrlib.weave import WeaveFile
48
49
import bzrlib.xml5
303
304
        """
304
305
        if not revision_id or not isinstance(revision_id, basestring):
305
306
            raise InvalidRevisionId(revision_id=revision_id, branch=self)
306
 
        return self._revision_store.get_revision(revision_id,
307
 
                                                 self.get_transaction())
 
307
        return self._revision_store.get_revisions([revision_id],
 
308
                                                  self.get_transaction())[0]
 
309
    @needs_read_lock
 
310
    def get_revisions(self, revision_ids):
 
311
        return self._revision_store.get_revisions(revision_ids,
 
312
                                                  self.get_transaction())
308
313
 
309
314
    @needs_read_lock
310
315
    def get_revision_xml(self, revision_id):
330
335
        self._check_revision_parents(r, inv)
331
336
        return r
332
337
 
 
338
    def get_revision_delta(self, revision_id):
 
339
        """Return the delta for one revision.
 
340
 
 
341
        The delta is relative to the left-hand predecessor of the
 
342
        revision.
 
343
        """
 
344
        revision = self.get_revision(revision_id)
 
345
        new_tree = self.revision_tree(revision_id)
 
346
        if not revision.parent_ids:
 
347
            old_tree = EmptyTree()
 
348
        else:
 
349
            old_tree = self.revision_tree(revision.parent_ids[0])
 
350
        return compare_trees(old_tree, new_tree)
 
351
 
333
352
    def _check_revision_parents(self, revision, inventory):
334
353
        """Private to Repository and Fetch.
335
354