Rev 2063: Split up find_mapping() function. in http://people.samba.org/bzr/jelmer/bzr-svn/0.5
Jelmer Vernooij
jelmer at samba.org
Mon Nov 24 17:18:02 GMT 2008
At http://people.samba.org/bzr/jelmer/bzr-svn/0.5
------------------------------------------------------------
revno: 2063
revision-id: jelmer at samba.org-20081124171800-fvjp9f3pdi1lp60a
parent: jelmer at samba.org-20081124171635-qvr0bpu2jw6vioya
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.5
timestamp: Mon 2008-11-24 18:18:00 +0100
message:
Split up find_mapping() function.
modified:
mapping.py mapping.py-20080128201303-6cp01phc0dmc0kiv-1
=== modified file 'mapping.py'
--- a/mapping.py 2008-11-21 14:59:07 +0000
+++ b/mapping.py 2008-11-24 17:18:00 +0000
@@ -784,13 +784,7 @@
mapping_registry.set_default('v4')
-def find_mapping(revprops, fileprops):
- """Find a mapping instance based on the revprops and fileprops set on a revision.
-
- :param revprops: Revision properties.
- :param fileprops: File properties set on branch root.
- :return: BzrSvnMapping instance or None if no mapping found.
- """
+def find_mapping_revprops(revprops):
if SVN_REVPROP_BZR_MAPPING_VERSION in revprops:
try:
cls = mapping_registry.get(revprops[SVN_REVPROP_BZR_MAPPING_VERSION])
@@ -802,12 +796,26 @@
else:
if ret is not None:
return ret
- for k, v in fileprops.iteritems():
+ return None
+
+
+def find_mapping_fileprops(changed_fileprops):
+ for k, v in changed_fileprops.iteritems():
if k.startswith(SVN_PROP_BZR_REVISION_ID):
return mapping_registry.parse_mapping_name("svn-" + k[len(SVN_PROP_BZR_REVISION_ID):])
return None
+def find_mapping(revprops, changed_fileprops):
+ """Find a mapping instance based on the revprops and fileprops set on a revision.
+
+ :param revprops: Revision properties.
+ :param fileprops: File properties set on branch root.
+ :return: BzrSvnMapping instance or None if no mapping found.
+ """
+ return find_mapping_revprops(revprops) or find_mapping_fileprops(changed_fileprops)
+
+
def is_bzr_revision_revprops(revprops):
if revprops.has_key(SVN_REVPROP_BZR_MAPPING_VERSION):
return True
More information about the bazaar-commits
mailing list