~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/vf_repository.py

  • Committer: Jelmer Vernooij
  • Date: 2012-01-05 16:03:11 UTC
  • mfrom: (6432 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6433.
  • Revision ID: jelmer@samba.org-20120105160311-12o5p67kin1v3zps
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Repository formats built around versioned files."""
18
18
 
 
19
from __future__ import absolute_import
 
20
 
19
21
 
20
22
from bzrlib.lazy_import import lazy_import
21
23
lazy_import(globals(), """
198
200
                       revision_id=self._new_revision_id,
199
201
                       properties=self._revprops)
200
202
        rev.parent_ids = self.parents
201
 
        self.repository.add_revision(self._new_revision_id, rev,
202
 
            self.new_inventory, self._config_stack)
 
203
        if self._config_stack.get('create_signatures') == _mod_config.SIGN_ALWAYS:
 
204
            testament = Testament(rev, self.revision_tree())
 
205
            plaintext = testament.as_short_text()
 
206
            self.repository.store_revision_signature(
 
207
                gpg.GPGStrategy(self._config_stack), plaintext,
 
208
                self._new_revision_id)
 
209
        self.repository._add_revision(rev)
203
210
        self._ensure_fallback_inventories()
204
211
        self.repository.commit_write_group()
205
212
        return self._new_revision_id
1031
1038
        self.inventories._access.flush()
1032
1039
        return result
1033
1040
 
1034
 
    def add_revision(self, revision_id, rev, inv=None, config=None):
 
1041
    def add_revision(self, revision_id, rev, inv=None):
1035
1042
        """Add rev to the revision store as revision_id.
1036
1043
 
1037
1044
        :param revision_id: the revision id to use.
1038
1045
        :param rev: The revision object.
1039
1046
        :param inv: The inventory for the revision. if None, it will be looked
1040
1047
                    up in the inventory storer
1041
 
        :param config: If None no digital signature will be created.
1042
 
                       If supplied its signature_needed method will be used
1043
 
                       to determine if a signature should be made.
1044
1048
        """
1045
1049
        # TODO: jam 20070210 Shouldn't we check rev.revision_id and
1046
1050
        #       rev.parent_ids?
1047
1051
        _mod_revision.check_not_reserved_id(revision_id)
1048
 
        if (config is not None and
1049
 
            config.get('create_signatures') == _mod_config.SIGN_ALWAYS):
1050
 
            if inv is None:
1051
 
                inv = self.get_inventory(revision_id)
1052
 
            tree = InventoryRevisionTree(self, inv, revision_id)
1053
 
            testament = Testament(rev, tree)
1054
 
            plaintext = testament.as_short_text()
1055
 
            self.store_revision_signature(
1056
 
                gpg.GPGStrategy(config), plaintext, revision_id)
1057
1052
        # check inventory present
1058
1053
        if not self.inventories.get_parent_map([(revision_id,)]):
1059
1054
            if inv is None: