200
200
revision_id=self._new_revision_id,
201
201
properties=self._revprops)
202
202
rev.parent_ids = self.parents
203
self.repository.add_revision(self._new_revision_id, rev,
204
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)
205
210
self._ensure_fallback_inventories()
206
211
self.repository.commit_write_group()
207
212
return self._new_revision_id
1033
1038
self.inventories._access.flush()
1036
def add_revision(self, revision_id, rev, inv=None, config=None):
1041
def add_revision(self, revision_id, rev, inv=None):
1037
1042
"""Add rev to the revision store as revision_id.
1039
1044
:param revision_id: the revision id to use.
1040
1045
:param rev: The revision object.
1041
1046
:param inv: The inventory for the revision. if None, it will be looked
1042
1047
up in the inventory storer
1043
:param config: If None no digital signature will be created.
1044
If supplied its signature_needed method will be used
1045
to determine if a signature should be made.
1047
1049
# TODO: jam 20070210 Shouldn't we check rev.revision_id and
1048
1050
# rev.parent_ids?
1049
1051
_mod_revision.check_not_reserved_id(revision_id)
1050
if (config is not None and
1051
config.get('create_signatures') == _mod_config.SIGN_ALWAYS):
1053
inv = self.get_inventory(revision_id)
1054
tree = InventoryRevisionTree(self, inv, revision_id)
1055
testament = Testament(rev, tree)
1056
plaintext = testament.as_short_text()
1057
self.store_revision_signature(
1058
gpg.GPGStrategy(config), plaintext, revision_id)
1059
1052
# check inventory present
1060
1053
if not self.inventories.get_parent_map([(revision_id,)]):
1061
1054
if inv is None: