summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hgsshsign/__init__.py20
-rw-r--r--hgsshsign/_meta.py2
-rw-r--r--hgsshsign/tests/__init__.py0
-rw-r--r--hgsshsign/tests/itest_all.py24
4 files changed, 40 insertions, 6 deletions
diff --git a/hgsshsign/__init__.py b/hgsshsign/__init__.py
index b52dcc3..bd612df 100644
--- a/hgsshsign/__init__.py
+++ b/hgsshsign/__init__.py
@@ -6,9 +6,8 @@ SSH Key Signing
6@organization: American Greetings Interactive 6@organization: American Greetings Interactive
7@date: May 03, 2010 7@date: May 03, 2010
8""" 8"""
9
10
11import os 9import os
10import sys
12import binascii 11import binascii
13 12
14from hgsshsign._meta import __version__ 13from hgsshsign._meta import __version__
@@ -26,7 +25,14 @@ class SSHAuthority(object):
26 import hgsshsign.keys as keys 25 import hgsshsign.keys as keys
27 from hgsshsign.keymanifest import KeyManifest 26 from hgsshsign.keymanifest import KeyManifest
28 27
29 public_key = absolute_path(ui.config("sshsign", "public_key")) 28 try:
29 public_key = absolute_path(ui.config("sshsign", "public_key"))
30
31 except TypeError:
32 raise util.Abort(
33 _("You must define sshsign.public_key in your hgrc")), \
34 None, sys.exc_info()[2]
35
30 public_key = keys.PublicKey.from_file(public_key) 36 public_key = keys.PublicKey.from_file(public_key)
31 37
32 manifest_file = ui.config("sshsign", "manifest_file") 38 manifest_file = ui.config("sshsign", "manifest_file")
@@ -151,13 +157,15 @@ def sign(ui, repo, *revs, **opts):
151 raise util.Abort(str(inst)) 157 raise util.Abort(str(inst))
152 158
153 159
160NAME = 'sshsign'
154cmdtable = { 161cmdtable = {
155 "sshsign": 162 NAME:
156 (sign, 163 (sign,
157 [('l', 'local', None, _('make the signature local')), 164 [('l', 'local', None, _('make the signature local')),
158 ('f', 'force', None, _('sign even if the sigfile is modified')), 165 ('f', 'force', None, _('sign even if the sigfile is modified')),
159 ('', 'no-commit', None, _('do not commit the sigfile after signing')), 166 ('', 'no-commit', None,
167 _('do not commit the sigfile after signing')),
160 ('m', 'message', '', _('commit message')), 168 ('m', 'message', '', _('commit message')),
161 ] + commands.commitopts2, 169 ] + commands.commitopts2,
162 _('hg sign [OPTION]... [REVISION]...')), 170 _('hg %s [OPTION]... [REVISION]...' % NAME)),
163} 171}
diff --git a/hgsshsign/_meta.py b/hgsshsign/_meta.py
index 53bc8be..2df5e4b 100644
--- a/hgsshsign/_meta.py
+++ b/hgsshsign/_meta.py
@@ -14,4 +14,6 @@ SETUP_ARGS = dict(
14 install_requires=[ 14 install_requires=[
15 "M2Crypto", 15 "M2Crypto",
16 ], 16 ],
17 test_suite='hgsshsign.tests.itest_all',
18 zip_safe=True,
17) 19)
diff --git a/hgsshsign/tests/__init__.py b/hgsshsign/tests/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/hgsshsign/tests/__init__.py
diff --git a/hgsshsign/tests/itest_all.py b/hgsshsign/tests/itest_all.py
new file mode 100644
index 0000000..79645ad
--- /dev/null
+++ b/hgsshsign/tests/itest_all.py
@@ -0,0 +1,24 @@
1# vim:filetype=python:fileencoding=utf-8
2import sys
3import unittest
4
5
6class TestHgSSHSign(unittest.TestCase):
7
8 def setUp(self):
9 pass
10
11 def tearDown(self):
12 pass
13
14 def test_sign_simple_case(self):
15 pass
16
17
18def tests():
19 unittest.main()
20 return 0
21
22
23if __name__ == '__main__':
24 sys.exit(tests())