summaryrefslogtreecommitdiff
path: root/lorrycontroller/lsupstreams.py
diff options
context:
space:
mode:
authorBen Hutchings <ben.hutchings@codethink.co.uk>2020-06-08 19:27:20 +0000
committerBen Hutchings <ben.hutchings@codethink.co.uk>2020-06-08 19:27:20 +0000
commitdddd932f93b81a4d0d4477c80544f23efab37217 (patch)
tree6af1a6b2dc0ee7a890c3865cd6ca69396a4e858e /lorrycontroller/lsupstreams.py
parent54d0672b8cfe7bc1273ce1631f3dc7c730198a45 (diff)
parentae7af5d8de06804e75a9a6aca3ede1a75eb3acfb (diff)
downloadlorry-controller-dddd932f93b81a4d0d4477c80544f23efab37217.tar.gz
Merge branch 'bwh/gitea-support' into 'master'
Add gitea Downstream Host connector Closes #9 See merge request CodethinkLabs/lorry-controller!12
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