summaryrefslogtreecommitdiff
path: root/lorrycontroller/lsupstreams.py
diff options
context:
space:
mode:
Diffstat (limited to 'lorrycontroller/lsupstreams.py')
-rw-r--r--lorrycontroller/lsupstreams.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/lorrycontroller/lsupstreams.py b/lorrycontroller/lsupstreams.py
index a535174..0b0802a 100644
--- a/lorrycontroller/lsupstreams.py
+++ b/lorrycontroller/lsupstreams.py
@@ -94,12 +94,13 @@ class HostRepositoryLister(object):
return repo_map
def parse_prefixmap(self, prefixmap_string):
- return json.loads(prefixmap_string)
+ # Sort prefixes in reverse order, so more specific prefixes
+ # come first
+ return sorted(json.loads(prefixmap_string).items(), reverse=True)
def map_one_remote_repo_to_local_one(self, remote_path, prefixmap):
- for remote_prefix in prefixmap:
+ for remote_prefix, local_prefix in prefixmap:
if self.path_starts_with_prefix(remote_path, remote_prefix):
- local_prefix = prefixmap[remote_prefix]
relative_path = remote_path[len(remote_prefix):]
local_path = local_prefix + relative_path
return local_path