Yuvipanda has uploaded a new change for review.
https://gerrit.wikimedia.org/r/77693
Change subject: Move config file back into the repository
......................................................................
Move config file back into the repository
Change-Id: I1c55fe8cd22e101fe2dade9adb3d2f879506d534
---
M src/gerrit-to-github.py
M src/github-to-gerrit.py
2 files changed, 10 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/labs/tools/SuchABot
refs/changes/93/77693/1
diff --git a/src/gerrit-to-github.py b/src/gerrit-to-github.py
index c140ecf..b461d33 100644
--- a/src/gerrit-to-github.py
+++ b/src/gerrit-to-github.py
@@ -23,7 +23,9 @@
{{event.comment}}""")
-CONFIG_FILE = os.path.expanduser('~/.suchabot.yaml')
+
+BASE_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..')
+CONFIG_FILE = os.path.join(BASE_PATH, 'config.yaml')
with open(CONFIG_FILE) as f:
config = yaml.load(f)
diff --git a/src/github-to-gerrit.py b/src/github-to-gerrit.py
index 6915557..f439cae 100644
--- a/src/github-to-gerrit.py
+++ b/src/github-to-gerrit.py
@@ -10,16 +10,20 @@
import re
+BASE_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..')
+CONFIG_PATH = os.path.join(BASE_PATH, 'config.yaml')
WORKING_DIR = os.path.expanduser("~/.sucharepos")
-CONFIG_PATH = os.path.expanduser('~/.suchabot.yaml')
+
REPOS_MAPPING = yaml.load(open('repos.yaml'))
REPOS_GITHUB_TO_GERRIT = REPOS_MAPPING['repos']
REPOS_GERRIT_TO_GITHUB = {v:k for k, v in REPOS_GITHUB_TO_GERRIT.iteritems()}
OWNER = "wikimedia"
+
CHANGE_ID_REGEX = re.compile('Change-Id: (\w+)')
GERRIT_TAG_REGEX = re.compile('^(Bug|RT):', re.MULTILINE | re.IGNORECASE)
GERRIT_TEMPLATE = "ssh://[email protected]:29418/%s.git"
BOT_AUTHOR = "SuchABot <[email protected]>"
+
COMMIT_MSG_TEMPLATE = jinja2.Template("""{{pr.title}}
{{body}}
@@ -32,7 +36,7 @@
REDIS_DB = config['redis']['db']
REDIS_HOST = config['redis']['host']
-PREFIX = config['github_receiver']['redis_prefix']
+QUEUE_KEY = config['github']['queue_key']
def is_git_repo(path):
return os.path.exists(path) and os.path.exists(os.path.join(path, '.git'))
@@ -162,7 +166,7 @@
try:
while True:
- data = json.loads(red.brpop(CLIENT_KEY)[1])
+ data = json.loads(red.brpop(QUEUE_KEY)[1])
do_review(data)
except:
gh.repos(OWNER, name).issues(pr_num).comments.post(body='Sorry, an
error occured :( @yuvipanda will now be notified that this sync did not end
well')
--
To view, visit https://gerrit.wikimedia.org/r/77693
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1c55fe8cd22e101fe2dade9adb3d2f879506d534
Gerrit-PatchSet: 1
Gerrit-Project: labs/tools/SuchABot
Gerrit-Branch: master
Gerrit-Owner: Yuvipanda <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits