commitsigs & Mercurial 5.6

A. Klitzing aklitzing at gmail.com
Mon Jan 4 13:05:37 UTC 2021


Hi again,

we tried that patch... looks like old signatures are still valid.
Should this be equal with previous behaviour of Mercurial?

diff --git a/hgrc/commitsigs.py b/hgrc/commitsigs.py
--- a/hgrc/commitsigs.py
+++ b/hgrc/commitsigs.py
@@ -67,6 +67,14 @@ try:
except (ImportError, AttributeError):
    command = cmdutil.command(cmdtable)

+try:
+    from mercurial.metadata import ChangingFiles
+except ImportError:
+    supportChangingFiles = False
+else:
+    supportChangingFiles = True
+
+
CONFIG = {
    b'scheme': b'gnupg',
    b'gnupg.path': b'gpg',
@@ -215,6 +223,15 @@ def chash(manifest, files, desc, p1, p2,
    if extra:
        extra = changelog.encodeextra(extra)
        parseddate = b'%s %s' % (parseddate, extra)
+
+    if supportChangingFiles and isinstance(files, ChangingFiles):
+        fileList = set(files.added)
+        fileList.update(files.merged)
+        fileList.update(files.removed)
+        fileList.update(files.salvaged)
+        fileList.update(files.touched)
+        files = list(fileList)
+
    l = [hex(manifest), user, parseddate] + sorted(files) + [b'', desc]
    text = b'\n'.join(l)
    return revlog_hash(text, p1, p2)


Best regards
   André Klitzing



More information about the Mercurial mailing list