# HG changeset patch # User Matt Harbison # Date 1692563538 14400 # Node ID 181936ad069a0d958a6605b996158b60a0dc0a5e # Parent 28c0fcff24e52a5af3257be05d1bc6c1fe1f386b gpg: fix an UnboundLocalError whenever using --force It looks like this has been broke for almost a decade, since 9c89ac99690e. diff -r 28c0fcff24e5 -r 181936ad069a hgext/gpg.py --- a/hgext/gpg.py Thu Aug 10 19:00:19 2023 +0100 +++ b/hgext/gpg.py Sun Aug 20 16:32:18 2023 -0400 @@ -339,8 +339,9 @@ repo.vfs.append(b"localsigs", sigmessage) return + msigs = match.exact([b'.hgsigs']) + if not opts[b"force"]: - msigs = match.exact([b'.hgsigs']) if any(repo.status(match=msigs, unknown=True, ignored=True)): raise error.Abort( _(b"working copy of .hgsigs is changed "), diff -r 28c0fcff24e5 -r 181936ad069a tests/test-gpg.t --- a/tests/test-gpg.t Thu Aug 10 19:00:19 2023 +0100 +++ b/tests/test-gpg.t Sun Aug 20 16:32:18 2023 -0400 @@ -54,4 +54,21 @@ e63c23eaa88a is signed by: hgtest +The signature is different each time, so avoid signing the previous signature so +that the cset hashes are unchanging. + $ hg up -q '.^' + + $ HGEDITOR=cat hg sign -f -e . + gpg: error retrieving key fingerprint from card: Invalid name (?) + signing 0:e63c23eaa88a + Added signature for changeset e63c23eaa88a + + + HG: Enter commit message. Lines beginning with 'HG:' are removed. + HG: Leave message empty to abort commit. + HG: -- + HG: user: test + HG: branch 'default' + HG: added .hgsigs + $ cd ..