Rev 339: Implement all_revision_ids(). in http://people.samba.org/bzr/jelmer/bzr-svn/bzr.dev
Jelmer Vernooij
jelmer at samba.org
Sat Dec 30 21:10:15 GMT 2006
------------------------------------------------------------
revno: 339
revision-id: jelmer at samba.org-20061230210837-oqd06o4d929mah6j
parent: jelmer at samba.org-20061230192957-nyzdptkm4iu91jm0
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: main
timestamp: Sat 2006-12-30 22:08:37 +0100
message:
Implement all_revision_ids().
Mutter less.
modified:
branch.py svnbranch.py-20051017135706-11c749eb0dab04a7
repository.py repository.py-20060306123302-1f8c5069b3fe0265
tests/test_repos.py test_repos.py-20060508151940-ddc49a59257ca712
=== modified file 'branch.py'
--- a/branch.py 2006-12-29 21:15:51 +0000
+++ b/branch.py 2006-12-30 21:08:37 +0000
@@ -64,7 +64,6 @@
self.control_files = FakeControlFiles()
self.base = base.rstrip("/")
self._format = SvnBranchFormat()
- mutter("Connected to branch at %r" % self.branch_path)
self._generate_revision_history(self.repository._latest_revnum)
def check(self):
=== modified file 'repository.py'
--- a/repository.py 2006-12-30 17:43:09 +0000
+++ b/repository.py 2006-12-30 21:08:37 +0000
@@ -212,8 +212,6 @@
assert self.base
assert self.uuid
- mutter("Connected to repository with UUID %s" % self.uuid)
-
cache_file = os.path.join(self.create_cache_dir(), 'cache-v1')
if not cachedbs.has_key(cache_file):
cachedbs[cache_file] = sqlite3.connect(cache_file)
@@ -275,7 +273,8 @@
raise NoSuchFile(path=rp)
def all_revision_ids(self):
- raise NotImplementedError(self.all_revision_ids)
+ for (bp, rev) in self.follow_history(self._latest_revnum):
+ yield self.generate_revision_id(rev, bp)
def get_inventory_weave(self):
raise NotImplementedError(self.get_inventory_weave)
@@ -484,11 +483,13 @@
def follow_history(self, revnum):
while revnum > 0:
yielded_paths = []
- for p in self._log.get_revision_paths(revnum):
+ paths = self._log.get_revision_paths(revnum)
+ for p in paths:
try:
- (bp, _) = self.scheme.unprefix(p)
+ bp = self.scheme.unprefix(p)[0]
if not bp in yielded_paths:
- yield (bp, revnum)
+ if not paths.has_key(bp) or paths[bp][0] != 'D':
+ yield (bp, revnum)
yielded_paths.append(bp)
except NotBranchError:
pass
=== modified file 'tests/test_repos.py'
--- a/tests/test_repos.py 2006-12-30 01:18:10 +0000
+++ b/tests/test_repos.py 2006-12-30 21:08:37 +0000
@@ -78,6 +78,30 @@
self.assertEqual(1, len(list(repos.follow_history(1))))
+ def test_all_revs_empty(self):
+ repos_url = self.make_client("a", "dc")
+ repos = Repository.open(repos_url)
+ repos.set_branching_scheme(TrunkBranchingScheme())
+ self.assertEqual([], list(repos.all_revision_ids()))
+
+ def test_all_revs(self):
+ repos_url = self.make_client("a", "dc")
+ self.build_tree({'dc/trunk/file': "data", "dc/foo/file":"data"})
+ self.client_add("dc/trunk")
+ self.client_commit("dc", "add trunk")
+ self.build_tree({'dc/branches/somebranch/somefile': 'data'})
+ self.client_add("dc/branches")
+ self.client_commit("dc", "add a branch")
+ self.client_delete("dc/branches/somebranch")
+ self.client_commit("dc", "remove branch")
+
+ repos = Repository.open(repos_url)
+ repos.set_branching_scheme(TrunkBranchingScheme())
+ self.assertEqual([
+ "svn-v%d:2@%s-branches%%2fsomebranch" % (MAPPING_VERSION, repos.uuid),
+ "svn-v%d:1@%s-trunk" % (MAPPING_VERSION, repos.uuid)
+ ], list(repos.all_revision_ids()))
+
def test_follow_history_follow(self):
repos_url = self.make_client("a", "dc")
self.build_tree({'dc/trunk/afile': "data", "dc/branches": None})
More information about the bazaar-commits
mailing list