~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/weave.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-07-01 04:21:23 UTC
  • mfrom: (3350.8.14 stacking-knits)
  • Revision ID: pqm@pqm.ubuntu.com-20080701042123-zcmqzb7o6znwjx34
(robertc) Teach KnitVersionedFiles how to stack on other
        VersionedFile objects. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
110
110
    def __init__(self, version, weave):
111
111
        """Create a WeaveContentFactory for version from weave."""
112
112
        ContentFactory.__init__(self)
113
 
        self.sha1 = weave.get_sha1s([version])[0]
 
113
        self.sha1 = weave.get_sha1s([version])[version]
114
114
        self.key = (version,)
115
115
        parents = weave.get_parent_map([version])[version]
116
116
        self.parents = tuple((parent,) for parent in parents)
765
765
 
766
766
    def get_sha1s(self, version_ids):
767
767
        """See VersionedFile.get_sha1s()."""
768
 
        return [self._sha1s[self._lookup(v)] for v in version_ids]
 
768
        result = {}
 
769
        for v in version_ids:
 
770
            result[v] = self._sha1s[self._lookup(v)]
 
771
        return result
769
772
 
770
773
    def num_versions(self):
771
774
        """How many versions are in this weave?"""