Rev 331: Reduce amount of output of follow_history() functions. in http://people.samba.org/bzr/jelmer/bzr-svn/bzr.dev
Jelmer Vernooij
jelmer at samba.org
Fri Dec 29 20:33:23 GMT 2006
------------------------------------------------------------
revno: 331
revision-id: jelmer at samba.org-20061229203040-w86k8wxrfinr8bg2
parent: jelmer at samba.org-20061229201444-jmgaaquygfp4ty6n
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: main
timestamp: Fri 2006-12-29 21:30:40 +0100
message:
Reduce amount of output of follow_history() functions.
modified:
fetch.py fetch.py-20060625004942-x2lfaib8ra707a8p-1
repository.py repository.py-20060306123302-1f8c5069b3fe0265
tests/test_repos.py test_repos.py-20060508151940-ddc49a59257ca712
=== modified file 'fetch.py'
--- a/fetch.py 2006-12-29 20:14:44 +0000
+++ b/fetch.py 2006-12-29 20:30:40 +0000
@@ -307,8 +307,8 @@
if path is None:
it = self.source.follow_history(until_revnum)
else:
- it = self.source.follow_branch_history(path, until_revnum)
- for (branch, changes, revnum) in it:
+ it = self.source.follow_branch(path, until_revnum)
+ for (branch, revnum) in it:
revid = self.source.generate_revision_id(revnum, branch)
if prev_revid is not None:
=== modified file 'repository.py'
--- a/repository.py 2006-12-29 20:14:44 +0000
+++ b/repository.py 2006-12-29 20:30:40 +0000
@@ -486,32 +486,16 @@
def follow_history(self, revnum):
while revnum > 0:
- paths = self._log.get_revision_paths(revnum)
- changed_paths = {}
- for p in paths:
+ yielded_paths = []
+ for p in self._log.get_revision_paths(revnum):
try:
- (bp, rp) = self.scheme.unprefix(p)
- if not changed_paths.has_key(bp):
- changed_paths[bp] = {}
- changed_paths[bp][p] = paths[p]
+ (bp, _) = self.scheme.unprefix(p)
+ if not bp in yielded_paths:
+ yield (bp, revnum)
+ yielded_paths.append(bp)
except NotBranchError:
pass
- for bp in changed_paths:
- if (changed_paths[bp].has_key(bp) and
- changed_paths[bp][bp][1] is not None and
- not self.scheme.is_branch(changed_paths[bp][bp][1])):
- # FIXME: if copyfrom_path is not a branch path,
- # should simulate a reverse "split" of a branch
- # For now, just make it look like the branch originated here.
- mutter('breaking off "split"')
- for c in self._log.find_children(changed_paths[bp][bp][1], changed_paths[bp][bp][2]):
- path = c.replace(changed_paths[bp][bp][1], bp+"/", 1).replace("//", "/")
- changed_paths[bp][path] = ('A', None, -1)
- changed_paths[bp][bp] = ('A', None, -1)
-
- yield (bp, changed_paths[bp], revnum)
-
revnum-=1
def follow_branch(self, branch_path, revnum):
=== modified file 'tests/test_repos.py'
--- a/tests/test_repos.py 2006-12-29 02:50:04 +0000
+++ b/tests/test_repos.py 2006-12-29 20:30:40 +0000
@@ -92,9 +92,8 @@
repos.set_branching_scheme(TrunkBranchingScheme())
items = list(repos.follow_history(2))
- self.assertEqual([('branches/abranch', {'branches/abranch': ('A', 'trunk', 1)}, 2),
- ('trunk', {'trunk/afile': ('A', None, -1),
- 'trunk': (u'A', None, -1)}, 1)], items)
+ self.assertEqual([('branches/abranch', 2),
+ ('trunk', 1)], items)
def test_branch_log_specific(self):
repos_url = self.make_client("a", "dc")
More information about the bazaar-commits
mailing list