forked from importers/git-importer
Fancy up the git commit message
This commit is contained in:
parent
5ae02a413d
commit
5e495dbd95
@ -52,9 +52,27 @@ class DBRevision:
|
||||
return self.package < other.package
|
||||
return self.rev < other.rev
|
||||
|
||||
def request_accept_message(self):
|
||||
request = Request.find(self.db, self.request_id)
|
||||
msg = f"Accepting request {request.number} from {request.source_project}\n\n"
|
||||
msg += self.comment.strip()
|
||||
url = self.api_url.replace("api.", "build.")
|
||||
msg += f"\n\nOBS-URL: {url}/request/show/{self.request_number}"
|
||||
return msg
|
||||
|
||||
def git_commit_message(self):
|
||||
# TODO: Normalize better the commit message
|
||||
return f"{self.comment}\n\n{self}"
|
||||
msg = ""
|
||||
if self.request_id:
|
||||
msg = self.request_accept_message()
|
||||
else:
|
||||
msg = self.comment.strip() + "\n"
|
||||
url = self.api_url.replace("api.", "build.")
|
||||
if self.rev == int(self.rev):
|
||||
# do not link to fake revisions
|
||||
msg += f"\nOBS-URL: {url}/package/show/{self.project}/{self.package}?expand=0&rev={int(self.rev)}"
|
||||
else:
|
||||
msg += f"\nOBS-URL: {url}/package/show/{self.project}/{self.package}?expand=0&rev={self.expanded_srcmd5}"
|
||||
return msg
|
||||
|
||||
def as_dict(self):
|
||||
"""Return a dict we can put into YAML for test cases"""
|
||||
|
Loading…
Reference in New Issue
Block a user