Rev 1309: Add note about find_children function. in http://people.samba.org/bzr/jelmer/bzr-svn/0.4
Jelmer Vernooij
jelmer at samba.org
Mon Jun 23 04:44:02 BST 2008
At http://people.samba.org/bzr/jelmer/bzr-svn/0.4
------------------------------------------------------------
revno: 1309
revision-id: jelmer at samba.org-20080623034400-l7ia3f27u0ddqnpb
parent: jelmer at samba.org-20080623031812-b8fqdn9hiwwu95db
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Mon 2008-06-23 05:44:00 +0200
message:
Add note about find_children function.
modified:
NEWS news-20061231030336-h9fhq245ie0de8bs-1
mapping3/__init__.py __init__.py-20080502174630-9324zh25kka98vlw-1
=== modified file 'NEWS'
--- a/NEWS 2008-06-23 03:18:12 +0000
+++ b/NEWS 2008-06-23 03:44:00 +0000
@@ -54,6 +54,8 @@
* Convert redirect requests received from Subversion. (#229848)
+ * New function for finding path children that's faster and more correct. (#240954)
+
bzr-svn 0.4.10 2008-05-12
CHANGES
=== modified file 'mapping3/__init__.py'
--- a/mapping3/__init__.py 2008-06-22 08:45:53 +0000
+++ b/mapping3/__init__.py 2008-06-23 03:44:00 +0000
@@ -33,13 +33,23 @@
SCHEME_GUESS_SAMPLE_SIZE = 2000
def expand_branch_pattern(begin, todo, check_path, get_children):
+ """Find the paths in the repository that match the expected branch pattern.
+
+ :param begin: List of path elements currently opened.
+ :param todo: List of path elements to still evaluate (including wildcards)
+ :param check_path: Function for checking a path exists
+ :param get_children: Function for retrieving the children of a path
+ """
+ mutter('expand branches: %r, %r', begin, todo)
path = "/".join(begin)
+ # If all elements have already been handled, just check the path exists
if len(todo) == 0:
if check_path(path):
return [path]
else:
return []
- if not "*" in todo[0]:
+ # Not a wildcard? Just expand next bits
+ if todo[0] != "*":
return expand_branch_pattern(begin+[todo[0]], todo[1:], check_path, get_children)
children = get_children(path)
if children is None:
@@ -47,6 +57,7 @@
ret = []
for c in children:
if len(todo) == 1:
+ # Last path element, so return directly
ret.append("/".join(begin+[c]))
else:
ret += expand_branch_pattern(begin+[c], todo[1:], check_path, get_children)
More information about the bazaar-commits
mailing list