Debian Codegraph @

tests/test-gpg.t

raw
1 #require gpg
2
3 Test the GPG extension
4
5 $ cat <<EOF >> $HGRCPATH
6 > [extensions]
7 > gpg=
8 >
9 > [gpg]
10 > cmd=gpg --no-permission-warning --no-secmem-warning --no-auto-check-trustdb
11 > EOF
12 $ GNUPGHOME="$TESTTMP/gpg"; export GNUPGHOME
13 $ cp -R "$TESTDIR/gpg" "$GNUPGHOME"
14
15 Start gpg-agent, which is required by GnuPG v2
16
17 #if gpg21
18 $ gpg-connect-agent -q --subst /serverpid '/echo ${get serverpid}' /bye \
19 > >> $DAEMON_PIDS
20 #endif
21
22 and migrate secret keys
23
24 #if gpg2
25 $ gpg --no-permission-warning --no-secmem-warning --list-secret-keys \
26 > > /dev/null 2>&1
27 #endif
28
29 $ hg init r
30 $ cd r
31 $ echo foo > foo
32 $ hg ci -Amfoo
33 adding foo
34
35 $ hg sigs
36
37 $ HGEDITOR=cat hg sign -e 0
38 gpg: error retrieving key fingerprint from card: Invalid name (?)
39 signing 0:e63c23eaa88a
40 Added signature for changeset e63c23eaa88a
41
42
43 HG: Enter commit message. Lines beginning with 'HG:' are removed.
44 HG: Leave message empty to abort commit.
45 HG: --
46 HG: user: test
47 HG: branch 'default'
48 HG: added .hgsigs
49
50 $ hg sigs
51 hgtest 0:e63c23eaa88ae77967edcf4ea194d31167c478b0
52
53 $ hg sigcheck 0
54 e63c23eaa88a is signed by:
55 hgtest
56
57 The signature is different each time, so avoid signing the previous signature so
58 that the cset hashes are unchanging.
59 $ hg up -q '.^'
60
61 $ HGEDITOR=cat hg sign -f -e .
62 gpg: error retrieving key fingerprint from card: Invalid name (?)
63 signing 0:e63c23eaa88a
64 Added signature for changeset e63c23eaa88a
65
66
67 HG: Enter commit message. Lines beginning with 'HG:' are removed.
68 HG: Leave message empty to abort commit.
69 HG: --
70 HG: user: test
71 HG: branch 'default'
72 HG: added .hgsigs
73
74 $ cd ..