Merge branch '14-15' into 'master'
Diff notes and skeleton Closes #14 and #15 See merge request xfocko/pushee!5
This commit is contained in:
commit
beac5136d9
2 changed files with 11 additions and 6 deletions
|
@ -51,18 +51,20 @@ class Comments(BaseCommand):
|
||||||
|
|
||||||
for file_path in comments[author]:
|
for file_path in comments[author]:
|
||||||
if file_path is not None:
|
if file_path is not None:
|
||||||
print(f"# `{file_path.split('/')[-1]}`")
|
filename = file_path.split("/")[-1]
|
||||||
|
print(f"\n`{filename}`\n{'-'*(len(filename) + 2)}")
|
||||||
for comment in comments[author][file_path]:
|
for comment in comments[author][file_path]:
|
||||||
if comment["system"]:
|
if comment["system"]:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if comment["type"] == "DiffNote":
|
if comment["type"] == "DiffNote":
|
||||||
body = comment["body"].replace(
|
body = comment["body"].replace(
|
||||||
"\n", "\n" + " " * (Comments.width + 2)
|
"\n",
|
||||||
)
|
"\n"
|
||||||
print(
|
+ " " * (len(str(comment["position"]["new_line"])) + 5),
|
||||||
f"""{f'L{comment["position"]["new_line"]}':>{Comments.width}}: {body}"""
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
print(f"""- L{comment["position"]["new_line"]}: {body}""")
|
||||||
else:
|
else:
|
||||||
print(f"""[{comment["created_at"]}]\n{comment["body"]}""")
|
print(f"""[{comment["created_at"]}]\n{comment["body"]}""")
|
||||||
print(header)
|
print(header)
|
||||||
|
|
|
@ -48,7 +48,7 @@ class MergeRequests(BaseGitCommand):
|
||||||
mail = f"<details>\n<summary>Mail</summary>\n\n<pre>{submission.get_mail()}</pre></details>"
|
mail = f"<details>\n<summary>Mail</summary>\n\n<pre>{submission.get_mail()}</pre></details>"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.gitlab.post_mr(
|
mr = self.gitlab.post_mr(
|
||||||
source_branch=submission.branch,
|
source_branch=submission.branch,
|
||||||
target_branch="master",
|
target_branch="master",
|
||||||
title=f"[{submission.homework}{'-opravne' if submission.correction else ''}] {submission.login}",
|
title=f"[{submission.homework}{'-opravne' if submission.correction else ''}] {submission.login}",
|
||||||
|
@ -57,5 +57,8 @@ class MergeRequests(BaseGitCommand):
|
||||||
remove_source_branch="true",
|
remove_source_branch="true",
|
||||||
assignee_ids=["1772"],
|
assignee_ids=["1772"],
|
||||||
)
|
)
|
||||||
|
mr.comment(
|
||||||
|
body="Summary\n=======\n\n# TODO\n\nDiff notes\n==========\n\n# TODO\n\nCorrection (YYYY/MM/DD)\n=======================\n\n# TODO"
|
||||||
|
)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
Reference in a new issue