Rev 2315: Stop iterating over non-visibile children of items when determining file ids. in file:///data/jelmer/bzr-svn/fileids/
Jelmer Vernooij
jelmer at samba.org
Fri Jan 16 21:58:21 GMT 2009
At file:///data/jelmer/bzr-svn/fileids/
------------------------------------------------------------
revno: 2315
revision-id: jelmer at samba.org-20090116215818-xqg60uaiw98pr1o6
parent: jelmer at samba.org-20090115233019-ch4g9mxlo9y1y230
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: fileids
timestamp: Fri 2009-01-16 22:58:18 +0100
message:
Stop iterating over non-visibile children of items when determining file ids.
modified:
NEWS news-20061231030336-h9fhq245ie0de8bs-1
fileids.py fileids.py-20060714013623-u5iiyqqnko11grcf-1
=== modified file 'NEWS'
--- a/NEWS 2009-01-15 22:30:48 +0000
+++ b/NEWS 2009-01-16 21:58:18 +0000
@@ -48,6 +48,8 @@
* Use unicode objects internally for sqlite. (#296868)
+ * Stop iterating over non-visible children of files when determining file ids. (#306259)
+
bzr-svn 0.5.0~rc1 2008-12-08
CHANGES
=== modified file 'fileids.py'
--- a/fileids.py 2009-01-15 01:28:44 +0000
+++ b/fileids.py 2009-01-16 21:58:18 +0000
@@ -32,8 +32,7 @@
iter_with_mapping,
)
-def get_local_changes(paths, branch, mapping, layout, generate_revid,
- get_children=None):
+def get_local_changes(paths, branch, mapping, layout, generate_revid):
"""Obtain all of the changes relative to a particular path
(usually a branch path).
@@ -42,13 +41,10 @@
:param mapping: Mapping to use to determine what are valid branch paths
:param layout: Layout to use
:param generate_revid: Function for generating revision id from svn revnum
- :param get_children: Function for obtaining the children of a path
"""
if (branch in paths and
paths[branch][0] == 'A' and
- paths[branch][1] is None and get_children is None):
- # Avoid finding all file ids if we're returning unusual
- # file ids only (get_children is None)
+ paths[branch][1] is None):
return {}
new_paths = {}
for p in sorted(paths.keys(), reverse=False):
@@ -69,10 +65,6 @@
except errors.NotSvnBranchPath:
# Copied from outside of a known branch
# Make it look like the files were added in this revision
- if get_children is not None:
- for c in get_children(data[1], data[2]):
- mutter('oops: %r child %r', data[1], c)
- new_paths[changes.rebase_path(c, data[1], new_p)] = (data[0], None, -1)
data = (data[0], None, -1)
new_paths[new_p] = data
@@ -81,7 +73,7 @@
FILEIDMAP_VERSION = 2
-def simple_apply_changes(new_file_id, changes, find_children=None):
+def simple_apply_changes(new_file_id, changes):
"""Simple function that generates a dictionary with file id changes.
Does not track renames. """
@@ -99,13 +91,6 @@
if data[1] is not None:
mutter('%r copied from %r:%s', inv_p, data[1], data[2])
- if find_children is not None:
- for c in find_children(data[1], data[2]):
- inv_c = c.decode("utf-8")
- path = inv_c.replace(data[1].decode("utf-8"), inv_p+"/", 1).replace(u"//", u"/")
- assert isinstance(path, unicode)
- map[path] = new_file_id(path)
- mutter('added mapping %r -> %r', path, map[path])
return map
@@ -126,7 +111,7 @@
assert path in map
map[path] = (map[path][0], revid)
- def apply_changes(self, revmeta, mapping, find_children=None):
+ def apply_changes(self, revmeta, mapping):
"""Change file id map to incorporate specified changes.
:param revmeta: RevisionMetadata object for revision with changes
@@ -136,19 +121,12 @@
renames = revmeta.get_fileid_map(mapping)
changes = get_local_changes(revmeta.get_paths(mapping), revmeta.branch_path, mapping,
self.repos.get_layout(),
- self.repos.generate_revision_id, find_children)
- if find_children is not None:
- def get_children(path, revid):
- (uuid, bp, revnum), mapping = self.repos.lookup_revision_id(revid)
- for p in find_children(bp+"/"+path, revnum):
- yield p[len(bp):].strip("/")
- else:
- get_children = None
+ self.repos.generate_revision_id)
def new_file_id(x):
return mapping.generate_file_id(revmeta.uuid, revmeta.revnum, revmeta.branch_path, x)
- idmap = self.apply_changes_fn(new_file_id, changes, get_children)
+ idmap = self.apply_changes_fn(new_file_id, changes)
idmap.update(renames)
return (idmap, changes)
@@ -179,7 +157,7 @@
continue
revid = revmeta.get_revision_id(mapping)
(idmap, changes) = self.apply_changes(revmeta,
- mapping, self.repos.find_children)
+ mapping)
self.update_map(map, revid, idmap, changes)
self._use_text_revids(mapping, revmeta, map)
parent_revs = next_parent_revs
@@ -299,7 +277,7 @@
revid = revmeta.get_revision_id(mapping)
(idmap, changes) = self.actual.apply_changes(
- revmeta, mapping, self.repos.find_children)
+ revmeta, mapping)
self.actual.update_map(map, revid, idmap, changes)
self._use_text_revids(mapping, revmeta, map)
More information about the bazaar-commits
mailing list