[X2Go-Commits] [maintenancescripts] 01/01: git/hooks/update-script._irkerhook.py_: merge in upstream changes.
git-admin at x2go.org
git-admin at x2go.org
Sun May 30 11:06:10 CEST 2021
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository maintenancescripts.
commit cac733b1d98e02f19d947a999da9f36a388f4ab1
Author: Mihai Moldovan <ionic at ionic.de>
Date: Sun May 30 11:06:05 2021 +0200
git/hooks/update-script._irkerhook.py_: merge in upstream changes.
---
git/hooks/update-script._irkerhook.py_ | 58 +++++++++++++++++++---------------
1 file changed, 33 insertions(+), 25 deletions(-)
diff --git a/git/hooks/update-script._irkerhook.py_ b/git/hooks/update-script._irkerhook.py_
index 0760647..b8a104a 100755
--- a/git/hooks/update-script._irkerhook.py_
+++ b/git/hooks/update-script._irkerhook.py_
@@ -1,9 +1,10 @@
#!/usr/bin/env python3
# Copyright (c) 2012 Eric S. Raymond <esr at thyrsus.com>
-# Distributed under BSD terms.
+# SPDX-License-Identifier: BSD-2-Clause
#
# This script contains git porcelain and porcelain byproducts.
-# Requires Python 2.6, or 2.5 with the simplejson library installed.
+# Requires either Python 2.6, or 2.5 with the simplejson library installed
+# or Python 3.x.
#
# usage: irkerhook.py [-V] [-n] [--variable=value...] [commit_id...]
#
@@ -41,7 +42,7 @@ default_channels = u"irc://irc.libera.chat/#x2go"
# No user-serviceable parts below this line:
#
-version = "2.17"
+version = "2.19"
import os, sys, socket, subprocess, locale, datetime, re
from pipes import quote as shellquote
@@ -423,6 +424,7 @@ class HgExtractor(GenericExtractor):
def is_repository(directory):
return has(directory, [".hg"])
def __init__(self, arguments):
+ from mercurial.encoding import unifromlocal
# This fiddling with arguments is necessary since the Mercurial hook can
# be run in two different ways: either directly via Python (in which
# case hg should be pointed to the hg_hook function below) or as a
@@ -449,24 +451,27 @@ class HgExtractor(GenericExtractor):
GenericExtractor.__init__(self, arguments)
# Extract global values from the hg configuration file(s)
- self.project = ui.config('irker', 'project')
- self.repo = ui.config('irker', 'repo')
- self.server = ui.config('irker', 'server')
- self.channels = ui.config('irker', 'channels')
- self.email = ui.config('irker', 'email')
- self.tcp = str(ui.configbool('irker', 'tcp')) # converted to bool again in do_overrides
- self.template = '%(bold)s%(project)s:%(reset)s %(green)s%(author)s%(reset)s %(repo)s:%(yellow)s%(branch)s%(reset)s * %(bold)s%(rev)s%(reset)s / %(bold)s%(files)s%(reset)s: %(logmsg)s %(brown)s%(url)s%(reset)s'
- self.tinyifier = ui.config('irker', 'tinyifier') or default_tinyifier
- self.color = ui.config('irker', 'color')
- self.urlprefix = (ui.config('irker', 'urlprefix') or
- ui.config('web', 'baseurl') or '')
+ self.project = unifromlocal(ui.config(b'irker', b'project') or b'')
+ self.repo = unifromlocal(ui.config(b'irker', b'repo') or b'')
+ self.server = unifromlocal(ui.config(b'irker', b'server') or b'')
+ self.channels = unifromlocal(ui.config(b'irker', b'channels') or b'')
+ self.email = unifromlocal(ui.config(b'irker', b'email') or b'')
+ self.tcp = str(ui.configbool(b'irker', b'tcp')) # converted to bool again in do_overrides
+ self.template = unifromlocal(ui.config(b'irker', b'template') or b'')
+ if not self.template:
+ self.template = '%(bold)s%(project)s:%(reset)s %(green)s%(author)s%(reset)s %(repo)s:%(yellow)s%(branch)s%(reset)s * %(bold)s%(rev)s%(reset)s / %(bold)s%(files)s%(reset)s: %(logmsg)s %(brown)s%(url)s%(reset)s'
+ self.tinyifier = unifromlocal(ui.config(b'irker', b'tinyifier')
+ or default_tinyifier.encode('utf-8'))
+ self.color = unifromlocal(ui.config(b'irker', b'color') or b'')
+ self.urlprefix = unifromlocal((ui.config(b'irker', b'urlprefix') or
+ ui.config(b'web', b'baseurl') or b''))
if self.urlprefix:
# self.commit is appended to this by do_overrides
self.urlprefix = self.urlprefix.rstrip('/') + '/rev/'
- self.cialike = ui.config('irker', 'cialike')
- self.filtercmd = ui.config('irker', 'filtercmd')
+ self.cialike = unifromlocal(ui.config(b'irker', b'cialike') or b'')
+ self.filtercmd = unifromlocal(ui.config(b'irker', b'filtercmd') or b'')
if not self.project:
- self.project = os.path.basename(self.repository.root.rstrip('/'))
+ self.project = os.path.basename(unifromlocal(self.repository.root).rstrip('/'))
self.do_overrides()
def head(self):
"Return a symbolic reference to the tip commit of the current branch."
@@ -475,19 +480,19 @@ class HgExtractor(GenericExtractor):
"Make a Commit object holding data for a specified commit ID."
from mercurial.node import short
from mercurial.templatefilters import person
- node = self.repository.lookup(commit_id)
- commit = Commit(self, short(node))
+ from mercurial.encoding import unifromlocal
+ ctx = self.repository[commit_id]
+ commit = Commit(self, unifromlocal(short(ctx.hex())))
# Extract commit-specific values from a "context" object
- ctx = self.repository.changectx(node)
commit.rev = '%d:%s' % (ctx.rev(), commit.commit)
- commit.branch = ctx.branch()
- commit.author = person(ctx.user())
+ commit.branch = unifromlocal(ctx.branch())
+ commit.author = unifromlocal(person(ctx.user()))
commit.author_date = \
datetime.datetime.fromtimestamp(ctx.date()[0]).strftime('%Y-%m-%d %H:%M:%S')
- commit.logmsg = ctx.description()
+ commit.logmsg = unifromlocal(ctx.description())
# Extract changed files from status against first parent
st = self.repository.status(ctx.p1().node(), ctx.node())
- commit.files = ' '.join(st[0] + st[1] + st[2])
+ commit.files = unifromlocal(b' '.join(st.modified + st.added + st.removed))
return commit
def hg_hook(ui, repo, **kwds):
@@ -629,4 +634,7 @@ if __name__ == "__main__":
for commit in commits:
ship(extractor, commit, not notify)
-#End
+# The following sets edit modes for GNU EMACS
+# Local Variables:
+# mode:python
+# End:
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/maintenancescripts.git
More information about the x2go-commits
mailing list