~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remote.py

  • Committer: Jelmer Vernooij
  • Date: 2012-01-04 16:02:14 UTC
  • mto: This revision was merged to the branch mainline in revision 6424.
  • Revision ID: jelmer@samba.org-20120104160214-d33njd62pq2aj4bq
Move revision signing to CommitBuilder.

Use internal helper method _add_revision rather than add_revision, which
does various unnecessary checks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1844
1844
            delta, new_revision_id, parents, basis_inv=basis_inv,
1845
1845
            propagate_caches=propagate_caches)
1846
1846
 
1847
 
    def add_revision(self, revision_id, rev, inv=None, config=None):
 
1847
    def add_revision(self, revision_id, rev, inv=None):
1848
1848
        _mod_revision.check_not_reserved_id(revision_id)
1849
 
        if (config is not None and
1850
 
            config.get('create_signatures') == _mod_config.SIGN_ALWAYS):
1851
 
            if inv is None:
1852
 
                inv = self.get_inventory(revision_id)
1853
 
            tree = InventoryRevisionTree(self, inv, revision_id)
1854
 
            testament = _mod_testament.Testament(rev, tree)
1855
 
            plaintext = testament.as_short_text()
1856
 
            self.store_revision_signature(
1857
 
                gpg.GPGStrategy(config), plaintext, revision_id)
1858
1849
        key = (revision_id,)
1859
1850
        # check inventory present
1860
1851
        if not self.inventories.get_parent_map([key]):
1867
1858
                                                        rev.parent_ids)
1868
1859
        else:
1869
1860
            rev.inventory_sha1 = self.inventories.get_sha1s([key])[key]
 
1861
        self._add_revision(rev)
 
1862
 
 
1863
    def _add_revision(self, rev):
1870
1864
        if self._real_repository is not None:
1871
 
            return self._real_repository.add_revision(
1872
 
                revision_id, rev, inv, config)
 
1865
            return self._real_repository._add_revision(rev)
1873
1866
        text = self._serializer.write_revision_to_string(rev)
 
1867
        key = (rev.revision_id,)
1874
1868
        parents = tuple((parent,) for parent in rev.parent_ids)
1875
1869
        self._write_group_tokens, missing_keys = self._get_sink().insert_stream(
1876
1870
            [('revisions', [FulltextContentFactory(key, parents, None, text)])],