Rev 1026: Merge 0.4. in file:///data/jelmer/bzr-svn/pyrex/
Jelmer Vernooij
jelmer at samba.org
Fri Mar 21 15:49:20 GMT 2008
At file:///data/jelmer/bzr-svn/pyrex/
------------------------------------------------------------
revno: 1026
revision-id: jelmer at samba.org-20080321154919-wxnwxvpotm03l5z0
parent: jelmer at samba.org-20080321154004-mu7emnevmvklj3lv
parent: jelmer at samba.org-20080321150137-mk2q5ehxvyf1wo2c
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: pyrex
timestamp: Fri 2008-03-21 16:49:19 +0100
message:
Merge 0.4.
modified:
Makefile makefile.other-20080311181537-5svhje3v1flh1n4f-1
NEWS news-20061231030336-h9fhq245ie0de8bs-1
repository.py repository.py-20060306123302-1f8c5069b3fe0265
tests/test_push.py test_push.py-20070201165715-g2ievcdfqi33wqsy-1
------------------------------------------------------------
revno: 950.1.9
revision-id: jelmer at samba.org-20080321150137-mk2q5ehxvyf1wo2c
parent: jelmer at samba.org-20080321143829-60v1ksle4ub32y0z
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Fri 2008-03-21 16:01:37 +0100
message:
Reimplement get_revision_graph() using get_graph().
modified:
NEWS news-20061231030336-h9fhq245ie0de8bs-1
repository.py repository.py-20060306123302-1f8c5069b3fe0265
------------------------------------------------------------
revno: 950.1.8
revision-id: jelmer at samba.org-20080321143829-60v1ksle4ub32y0z
parent: jelmer at samba.org-20080321130751-90h9dt4wbtwbh7s9
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Fri 2008-03-21 15:38:29 +0100
message:
Avoid property lookup when getting revision information.
modified:
Makefile makefile.other-20080311181537-5svhje3v1flh1n4f-1
repository.py repository.py-20060306123302-1f8c5069b3fe0265
tests/test_push.py test_push.py-20070201165715-g2ievcdfqi33wqsy-1
=== modified file 'Makefile'
--- a/Makefile 2008-03-21 13:09:20 +0000
+++ b/Makefile 2008-03-21 15:49:19 +0000
@@ -28,7 +28,7 @@
mkdir -p $@
$(TMP_PLUGINS_DIR)/svn: build-inplace $(TMP_PLUGINS_DIR)
- ln -sf $@ `pwd`
+ ln -sf $@ ..
check:: $(TMP_PLUGINS_DIR)/svn
BZR_PLUGIN_PATH=$(TMP_PLUGINS_DIR) $(DEBUGGER) $(PYTHON) $(BZR) selftest $(TEST_OPTIONS) $(TESTS)
=== modified file 'NEWS'
--- a/NEWS 2008-03-21 13:01:35 +0000
+++ b/NEWS 2008-03-21 15:49:19 +0000
@@ -10,6 +10,10 @@
* Set revision properties when possible.
+ * Avoid doing two branch property lookups when getting revision metadata.
+
+ * Use caching revision graph.
+
BUGS
* Fix compatibility with bzr 1.3.
=== modified file 'repository.py'
--- a/repository.py 2008-03-18 02:49:39 +0000
+++ b/repository.py 2008-03-21 15:49:19 +0000
@@ -20,6 +20,7 @@
from bzrlib.branch import Branch, BranchCheckResult
from bzrlib.errors import (InvalidRevisionId, NoSuchRevision, NotBranchError,
UninitializableFormat, UnrelatedBranches)
+from bzrlib.graph import CachingParentsProvider
from bzrlib.inventory import Inventory
from bzrlib.lockable_files import LockableFiles, TransportLock
from bzrlib.repository import Repository, RepositoryFormat
@@ -115,7 +116,6 @@
return "Subversion Repository"
def initialize(self, url, shared=False, _internal=False):
- """Svn repositories cannot be created (yet)."""
raise UninitializableFormat(self)
def check_conversion_target(self, target_repo_format):
@@ -199,6 +199,9 @@
def get_mapping(self):
return get_default_mapping()(self.get_scheme())
+ def _make_parents_provider(self):
+ return CachingParentsProvider(self)
+
def get_scheme(self):
"""Determine the branching scheme to use for this repository.
@@ -454,7 +457,8 @@
if revid is not None:
yield revid
- def revision_parents(self, revision_id, svn_fileprops=None):
+ def revision_parents(self, revision_id, svn_fileprops=None,
+ svn_revprops=None):
"""See Repository.revision_parents()."""
parent_ids = []
(branch, revnum, mapping) = self.lookup_revision_id(revision_id)
@@ -465,7 +469,8 @@
if svn_fileprops is None:
svn_fileprops = lazy_dict(lambda: self.branchprop_list.get_changed_properties(branch, revnum))
- svn_revprops = lazy_dict(lambda: self.transport.revprop_list(revnum))
+ if svn_revprops is None:
+ svn_revprops = lazy_dict(lambda: self.transport.revprop_list(revnum))
extra_rhs_parents = mapping.get_rhs_parents(branch, svn_revprops, svn_fileprops)
parent_ids.extend(extra_rhs_parents)
@@ -482,15 +487,15 @@
(path, revnum, mapping) = self.lookup_revision_id(revision_id)
- parent_ids = self.revision_parents(revision_id)
+ svn_revprops = lazy_dict(lambda: self.transport.revprop_list(revnum))
+ svn_fileprops = lazy_dict(lambda: self.branchprop_list.get_changed_properties(path, revnum))
+ parent_ids = self.revision_parents(revision_id, svn_fileprops=svn_fileprops, svn_revprops=svn_revprops)
# Commit SVN revision properties to a Revision object
class LazySvnRevision(Revision):
inventory_sha1 = property(lambda rev: self.get_inventory_sha1(rev.revision_id))
rev = LazySvnRevision(revision_id=revision_id, parent_ids=parent_ids)
- svn_revprops = lazy_dict(lambda: self.transport.revprop_list(revnum))
- svn_fileprops = lazy_dict(lambda: self.branchprop_list.get_changed_properties(path, revnum))
mapping.import_revision(svn_revprops, svn_fileprops, rev)
@@ -526,8 +531,7 @@
try:
revprops = lazy_dict(lambda: self._log._get_transport().revprop_list(revnum))
fileprops = lazy_dict(lambda: self.branchprop_list.get_changed_properties(path, revnum))
- (bzr_revno, revid) = mapping.get_revision_id(path, revprops,
- fileprops)
+ (bzr_revno, revid) = mapping.get_revision_id(path, revprops, fileprops)
except SubversionException, (_, num):
if num == constants.ERR_FS_NO_SUCH_REVISION:
raise NoSuchRevision(path, revnum)
@@ -821,39 +825,20 @@
# SVN doesn't store GPG signatures
raise NoSuchRevision(self, revision_id)
- def _full_revision_graph(self, mapping, _latest_revnum=None):
- if _latest_revnum is None:
- _latest_revnum = self.transport.get_latest_revnum()
- graph = {}
- for (branch, revnum) in self.follow_history(_latest_revnum,
- mapping):
- mutter('%r, %r' % (branch, revnum))
- revid = self.generate_revision_id(revnum, branch, mapping)
- graph[revid] = self.revision_parents(revid)
- return graph
-
def get_revision_graph(self, revision_id=None):
"""See Repository.get_revision_graph()."""
- if revision_id == NULL_REVISION:
- return {}
+ graph = self.get_graph()
if revision_id is None:
- return self._full_revision_graph(self.get_mapping())
-
- (path, revnum, mapping) = self.lookup_revision_id(revision_id)
-
- _previous = revision_id
- self._ancestry = {}
-
- if revnum > 0:
- for (branch, rev) in self.follow_branch(path, revnum - 1, mapping):
- revid = self.generate_revision_id(rev, branch, mapping)
- self._ancestry[_previous] = [revid]
- _previous = revid
-
- self._ancestry[_previous] = []
-
- return self._ancestry
+ revision_ids = self.all_revision_ids(self.get_mapping())
+ else:
+ revision_ids = [revision_id]
+
+ ret = {}
+ for (revid, parents) in graph.iter_ancestry(revision_ids):
+ ret[revid] = parents
+
+ return ret
def find_branches(self, using=False):
"""Find branches underneath this repository.
=== modified file 'tests/test_push.py'
--- a/tests/test_push.py 2008-03-21 13:09:20 +0000
+++ b/tests/test_push.py 2008-03-21 15:49:19 +0000
@@ -713,8 +713,8 @@
def test_push_unnecessary_merge(self):
from bzrlib.debug import debug_flags
- debug_flags.add('transport')
- debug_flags.add('commit')
+ debug_flags.add("commit")
+ debug_flags.add("fetch")
repos_url = self.make_client("a", "dc")
bzrwt = BzrDir.create_standalone_workingtree("c",
format=format.get_rich_root_format())
@@ -750,7 +750,7 @@
trunk.pull(bzrwt.branch)
self.assertEquals(bzr_parents,
- trunk.repository.revision_parents(revid2))
+ trunk.repository.get_revision(revid2).parent_ids)
self.assertEquals([revid1, revid2], trunk.revision_history())
self.client_update("dc")
More information about the bazaar-commits
mailing list