summaryrefslogtreecommitdiffstats
path: root/gitautodeploy/parsers/common.py
diff options
context:
space:
mode:
authorOliver Poignant <oliver@poignant.se>2016-03-06 23:08:58 +0100
committerOliver Poignant <oliver@poignant.se>2016-03-06 23:08:58 +0100
commit9bb81f8c8e75278db86868575fc47394b0541eef (patch)
treed9b2247df0b2bd430e2c59ccc49d9a5774d7e183 /gitautodeploy/parsers/common.py
parent92661088c7a61f3f53c4aa56bc5f7257a6487075 (diff)
downloadGit-Auto-Deploy-9bb81f8c8e75278db86868575fc47394b0541eef.zip
Git-Auto-Deploy-9bb81f8c8e75278db86868575fc47394b0541eef.tar.gz
Git-Auto-Deploy-9bb81f8c8e75278db86868575fc47394b0541eef.tar.bz2
Store parent in common.py
Diffstat (limited to 'gitautodeploy/parsers/common.py')
-rw-r--r--gitautodeploy/parsers/common.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/gitautodeploy/parsers/common.py b/gitautodeploy/parsers/common.py
new file mode 100644
index 0000000..42cbbdd
--- /dev/null
+++ b/gitautodeploy/parsers/common.py
@@ -0,0 +1,24 @@
+
+class WebhookRequestParser(object):
+ """Abstract parent class for git service parsers. Contains helper
+ methods."""
+
+ def __init__(self, config):
+ self._config = config
+
+ def get_matching_repo_configs(self, urls):
+ """Iterates over the various repo URLs provided as argument (git://,
+ ssh:// and https:// for the repo) and compare them to any repo URL
+ specified in the config"""
+
+ configs = []
+ for url in urls:
+ for repo_config in self._config['repositories']:
+ if repo_config in configs:
+ continue
+ if repo_config['url'] == url:
+ configs.append(repo_config)
+ elif 'url_without_usernme' in repo_config and repo_config['url_without_usernme'] == url:
+ configs.append(repo_config)
+
+ return configs \ No newline at end of file