~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remote.py

(jelmer) Use real commit object in RemoteRepository.get_commit_builder.
 (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1211
1211
        if response != ('ok', ):
1212
1212
            raise errors.UnexpectedSmartServerResponse(response)
1213
1213
        self._write_group_tokens = None
 
1214
        # Refresh data after writing to the repository.
 
1215
        self.refresh_data()
1214
1216
 
1215
1217
    def resume_write_group(self, tokens):
1216
1218
        if self._real_repository:
1765
1767
    def get_commit_builder(self, branch, parents, config, timestamp=None,
1766
1768
                           timezone=None, committer=None, revprops=None,
1767
1769
                           revision_id=None, lossy=False):
1768
 
        # FIXME: It ought to be possible to call this without immediately
1769
 
        # triggering _ensure_real.  For now it's the easiest thing to do.
1770
 
        self._ensure_real()
1771
 
        real_repo = self._real_repository
1772
 
        builder = real_repo.get_commit_builder(branch, parents,
1773
 
                config, timestamp=timestamp, timezone=timezone,
1774
 
                committer=committer, revprops=revprops,
1775
 
                revision_id=revision_id, lossy=lossy)
1776
 
        return builder
 
1770
        """Obtain a CommitBuilder for this repository.
 
1771
 
 
1772
        :param branch: Branch to commit to.
 
1773
        :param parents: Revision ids of the parents of the new revision.
 
1774
        :param config: Configuration to use.
 
1775
        :param timestamp: Optional timestamp recorded for commit.
 
1776
        :param timezone: Optional timezone for timestamp.
 
1777
        :param committer: Optional committer to set for commit.
 
1778
        :param revprops: Optional dictionary of revision properties.
 
1779
        :param revision_id: Optional revision id.
 
1780
        :param lossy: Whether to discard data that can not be natively
 
1781
            represented, when pushing to a foreign VCS
 
1782
        """
 
1783
        if self._fallback_repositories and not self._format.supports_chks:
 
1784
            raise errors.BzrError("Cannot commit directly to a stacked branch"
 
1785
                " in pre-2a formats. See "
 
1786
                "https://bugs.launchpad.net/bzr/+bug/375013 for details.")
 
1787
        if self._format.rich_root_data:
 
1788
            commit_builder_kls = vf_repository.VersionedFileRootCommitBuilder
 
1789
        else:
 
1790
            commit_builder_kls = vf_repository.VersionedFileCommitBuilder
 
1791
        result = commit_builder_kls(self, parents, config,
 
1792
            timestamp, timezone, committer, revprops, revision_id,
 
1793
            lossy)
 
1794
        self.start_write_group()
 
1795
        return result
1777
1796
 
1778
1797
    def add_fallback_repository(self, repository):
1779
1798
        """Add a repository to use for looking up data not held locally.
1993
2012
        """
1994
2013
        if self._real_repository is not None:
1995
2014
            self._real_repository.refresh_data()
 
2015
        # Refresh the parents cache for this object
 
2016
        self._unstacked_provider.disable_cache()
 
2017
        self._unstacked_provider.enable_cache()
1996
2018
 
1997
2019
    def revision_ids_to_search_result(self, result_set):
1998
2020
        """Convert a set of revision ids to a graph SearchResult."""