Add signing support for tags in rabbitvcs.
This commit is contained in:
parent
ba37538da5
commit
f595f1ad98
@ -765,6 +765,22 @@ class GittyupClient(object):
|
|||||||
self._config_set("remote \"origin\"", "url", host)
|
self._config_set("remote \"origin\"", "url", host)
|
||||||
self.config.write_to_path()
|
self.config.write_to_path()
|
||||||
|
|
||||||
|
def _get_gpg_sig(self):
|
||||||
|
try:
|
||||||
|
config_user_signingkey = S(self._config_get_glb(("user", ), "signingkey"))
|
||||||
|
if config_user_signingkey == "":
|
||||||
|
raise KeyError()
|
||||||
|
except KeyError:
|
||||||
|
return None
|
||||||
|
|
||||||
|
try:
|
||||||
|
config_commit_gpgsign = S(self._config_get_glb(("commit", ), "gpgsign"))
|
||||||
|
if config_commit_gpgsign == "" or config_commit_gpgsign.lower() != "true":
|
||||||
|
raise KeyError()
|
||||||
|
return config_user_signingkey
|
||||||
|
except KeyError:
|
||||||
|
return None
|
||||||
|
|
||||||
def commit(self, message, parents=None, committer=None, commit_time=None,
|
def commit(self, message, parents=None, committer=None, commit_time=None,
|
||||||
commit_timezone=None, author=None, author_time=None,
|
commit_timezone=None, author=None, author_time=None,
|
||||||
author_timezone=None, encoding=None, commit_all=False):
|
author_timezone=None, encoding=None, commit_all=False):
|
||||||
@ -817,27 +833,10 @@ class GittyupClient(object):
|
|||||||
if commit_timezone is None:
|
if commit_timezone is None:
|
||||||
commit_timezone = helper.utc_offset()
|
commit_timezone = helper.utc_offset()
|
||||||
|
|
||||||
try:
|
config_user_signingkey = self._get_gpg_sig()
|
||||||
config_user_signingkey = S(self._config_get_glb(("user", ), "signingkey"))
|
|
||||||
if config_user_signingkey == "":
|
|
||||||
raise KeyError()
|
|
||||||
except KeyError:
|
|
||||||
config_user_signingkey = None
|
|
||||||
|
|
||||||
config_commit_gpgsign = "false"
|
|
||||||
if config_user_signingkey is not None:
|
|
||||||
try:
|
|
||||||
config_commit_gpgsign = S(self._config_get_glb(("commit", ), "gpgsign"))
|
|
||||||
if config_commit_gpgsign == "":
|
|
||||||
raise KeyError()
|
|
||||||
else:
|
|
||||||
config_commit_gpgsign = config_commit_gpgsign.lower()
|
|
||||||
except KeyError:
|
|
||||||
config_commit_gpgsign = "false"
|
|
||||||
config_user_signingkey = None
|
|
||||||
|
|
||||||
commit_id = None
|
commit_id = None
|
||||||
if config_commit_gpgsign == "true":
|
if config_user_signingkey is not None:
|
||||||
self.notify("GPG Signing Key: "+S(config_user_signingkey))
|
self.notify("GPG Signing Key: "+S(config_user_signingkey))
|
||||||
commit_id = self.repo.do_commit(**helper.to_bytes({
|
commit_id = self.repo.do_commit(**helper.to_bytes({
|
||||||
"message": message,
|
"message": message,
|
||||||
@ -1362,7 +1361,19 @@ class GittyupClient(object):
|
|||||||
@param revision: The revision to tag. Defaults to HEAD
|
@param revision: The revision to tag. Defaults to HEAD
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
config_user_signingkey = self._get_gpg_sig()
|
||||||
|
|
||||||
|
if config_user_signingkey is not None:
|
||||||
|
self.notify("GPG Signing Key: "+S(config_user_signingkey))
|
||||||
|
if hasattr(dulwich.porcelain,'tag'):
|
||||||
|
dulwich.porcelain.tag(self.repo, name, objectish=revision, message=message, sign=str(config_user_signingkey))
|
||||||
|
else:
|
||||||
|
dulwich.porcelain.tag_create(self.repo, name, objectish=revision, message=message, sign=str(config_user_signingkey))
|
||||||
|
else:
|
||||||
|
if hasattr(dulwich.porcelain,'tag'):
|
||||||
dulwich.porcelain.tag(self.repo, name, objectish=revision, message=message)
|
dulwich.porcelain.tag(self.repo, name, objectish=revision, message=message)
|
||||||
|
else:
|
||||||
|
dulwich.porcelain.tag_create(self.repo, name, objectish=revision, message=message)
|
||||||
|
|
||||||
def tag_delete(self, name):
|
def tag_delete(self, name):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user