Rev 1612: Simplify fileprop path finding code. in http://people.samba.org/bzr/jelmer/bzr-svn/trunk
Jelmer Vernooij
jelmer at samba.org
Sat Aug 23 03:32:06 BST 2008
At http://people.samba.org/bzr/jelmer/bzr-svn/trunk
------------------------------------------------------------
revno: 1612
revision-id: jelmer at samba.org-20080823023158-006yv896kpofnkev
parent: jelmer at samba.org-20080823022655-0plqua58j6wrej5d
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Sat 2008-08-23 04:31:58 +0200
message:
Simplify fileprop path finding code.
modified:
convert.py svn2bzr.py-20051018015439-cb4563bff29e632d
repository.py repository.py-20060306123302-1f8c5069b3fe0265
revids.py revids.py-20070416220458-36vfa0730cchevp1-1
=== modified file 'convert.py'
--- a/convert.py 2008-08-22 16:22:40 +0000
+++ b/convert.py 2008-08-23 02:31:58 +0000
@@ -172,8 +172,9 @@
else:
from_revnum = 0
to_revnum = source_repos.get_latest_revnum()
- changed_branches = source_repos.find_fileprop_branches(layout=layout,
- from_revnum=from_revnum, to_revnum=to_revnum, check_removed=True)
+ changed_branches = source_repos.find_fileprop_paths(layout=layout,
+ from_revnum=from_revnum, to_revnum=to_revnum, check_removed=True,
+ find_branches=True, find_tags=False)
existing_branches = []
removed_branches = []
for (bp, revnum, exists) in changed_branches:
=== modified file 'repository.py'
--- a/repository.py 2008-08-23 02:26:55 +0000
+++ b/repository.py 2008-08-23 02:31:58 +0000
@@ -906,14 +906,31 @@
return SvnCommitBuilder(self, branch, parents, config, timestamp,
timezone, committer, revprops, revision_id)
- def find_fileprop_branches(self, layout, from_revnum, to_revnum,
- project=None, check_removed=False):
+ def find_fileprop_path(self, layout, from_revnum, to_revnum,
+ project=None, check_removed=False,
+ find_branches=True, find_tags=True):
if not check_removed and from_revnum == 0:
- for (project, branch, nick) in chain(layout.get_branches(to_revnum, project), layout.get_tags(to_revnum, project)):
+ it = iter()
+ if find_branches:
+ it = chain(it, layout.get_branches(to_revnum, project))
+ if find_tags:
+ it = chain(it, layout.get_tags(to_revnum, project))
+ for (project, branch, nick) in it:
yield (branch, to_revnum, True)
else:
+ if find_branches and find_tags:
+ check_path_fn = layout.is_branch_or_tag
+ check_parent_path_fn = layout.is_branch_or_tag_parent
+ elif find_branches:
+ check_path_fn = layout.is_branch
+ check_parent_path_fn = layout.is_branch_parent
+ elif find_tags:
+ check_path_fn = layout.is_tag
+ check_parent_path_fn = layout.is_tag_parent
+ else:
+ assert False
for (branch, revno, exists) in self.find_branchpaths(
- layout.is_branch_or_tag, layout.is_branch_or_tag_parent,
+ check_path_fn, check_parent_path_fn,
from_revnum, to_revnum, project):
yield (branch, revno, exists)
=== modified file 'revids.py'
--- a/revids.py 2008-08-22 16:39:29 +0000
+++ b/revids.py 2008-08-23 02:31:58 +0000
@@ -72,7 +72,7 @@
reuse_policy = self.repos.get_config().get_reuse_revisions()
assert reuse_policy in ("other-branches", "removed-branches", "none")
check_removed = (reuse_policy == "removed-branches")
- for (branch, revno, exists) in self.repos.find_fileprop_branches(layout, from_revnum, to_revnum, project, check_removed=check_removed):
+ for (branch, revno, exists) in self.repos.find_fileprop_branches(layout, from_revnum, to_revnum, project, check_removed=check_removed, find_branches=True, find_tags=True):
assert isinstance(branch, str)
assert isinstance(revno, int)
# Look at their bzr:revision-id-vX
More information about the bazaar-commits
mailing list