commitsigs & Mercurial 5.6
Raphaël Gomès
raphael.gomes at octobus.net
Mon Jan 4 14:26:04 UTC 2021
On 1/4/21 2:05 PM, A. Klitzing wrote:
> Hi again,
>
> we tried that patch... looks like old signatures are still valid.
> Should this be equal with previous behaviour of Mercurial?
This looks like it should work.
CCed Pierre-Yves anyway since it's code he wrote and he might disagree.
>
> 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
> _______________________________________________
> Mercurial mailing list
> Mercurial at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial
More information about the Mercurial
mailing list