Show More
@@ -6,10 +6,13 b'' | |||||
6 | '''commands to sign and verify changesets''' |
|
6 | '''commands to sign and verify changesets''' | |
7 |
|
7 | |||
8 | import os, tempfile, binascii |
|
8 | import os, tempfile, binascii | |
9 | from mercurial import util, commands, match |
|
9 | from mercurial import util, commands, match, cmdutil | |
10 | from mercurial import node as hgnode |
|
10 | from mercurial import node as hgnode | |
11 | from mercurial.i18n import _ |
|
11 | from mercurial.i18n import _ | |
12 |
|
12 | |||
|
13 | cmdtable = {} | |||
|
14 | command = cmdutil.command(cmdtable) | |||
|
15 | ||||
13 | class gpg(object): |
|
16 | class gpg(object): | |
14 | def __init__(self, path, key=None): |
|
17 | def __init__(self, path, key=None): | |
15 | self.path = path |
|
18 | self.path = path | |
@@ -135,6 +138,7 b' def getkeys(ui, repo, mygpg, sigdata, co' | |||||
135 | validkeys.append((key[1], key[2], key[3])) |
|
138 | validkeys.append((key[1], key[2], key[3])) | |
136 | return validkeys |
|
139 | return validkeys | |
137 |
|
140 | |||
|
141 | @command("sigs", [], _('hg sigs')) | |||
138 | def sigs(ui, repo): |
|
142 | def sigs(ui, repo): | |
139 | """list signed changesets""" |
|
143 | """list signed changesets""" | |
140 | mygpg = newgpg(ui) |
|
144 | mygpg = newgpg(ui) | |
@@ -159,6 +163,7 b' def sigs(ui, repo):' | |||||
159 | r = "%5d:%s" % (rev, hgnode.hex(repo.changelog.node(rev))) |
|
163 | r = "%5d:%s" % (rev, hgnode.hex(repo.changelog.node(rev))) | |
160 | ui.write("%-30s %s\n" % (keystr(ui, k), r)) |
|
164 | ui.write("%-30s %s\n" % (keystr(ui, k), r)) | |
161 |
|
165 | |||
|
166 | @command("sigcheck", [], _('hg sigcheck REVISION')) | |||
162 | def check(ui, repo, rev): |
|
167 | def check(ui, repo, rev): | |
163 | """verify all the signatures there may be for a particular revision""" |
|
168 | """verify all the signatures there may be for a particular revision""" | |
164 | mygpg = newgpg(ui) |
|
169 | mygpg = newgpg(ui) | |
@@ -191,6 +196,16 b' def keystr(ui, key):' | |||||
191 | else: |
|
196 | else: | |
192 | return user |
|
197 | return user | |
193 |
|
198 | |||
|
199 | @command("sign", | |||
|
200 | [('l', 'local', None, _('make the signature local')), | |||
|
201 | ('f', 'force', None, _('sign even if the sigfile is modified')), | |||
|
202 | ('', 'no-commit', None, _('do not commit the sigfile after signing')), | |||
|
203 | ('k', 'key', '', | |||
|
204 | _('the key id to sign with'), _('ID')), | |||
|
205 | ('m', 'message', '', | |||
|
206 | _('commit message'), _('TEXT')), | |||
|
207 | ] + commands.commitopts2, | |||
|
208 | _('hg sign [OPTION]... [REVISION]...')) | |||
194 | def sign(ui, repo, *revs, **opts): |
|
209 | def sign(ui, repo, *revs, **opts): | |
195 | """add a signature for the current or given revision |
|
210 | """add a signature for the current or given revision | |
196 |
|
211 | |||
@@ -272,19 +287,3 b' def node2txt(repo, node, ver):' | |||||
272 | else: |
|
287 | else: | |
273 | raise util.Abort(_("unknown signature version")) |
|
288 | raise util.Abort(_("unknown signature version")) | |
274 |
|
289 | |||
275 | cmdtable = { |
|
|||
276 | "sign": |
|
|||
277 | (sign, |
|
|||
278 | [('l', 'local', None, _('make the signature local')), |
|
|||
279 | ('f', 'force', None, _('sign even if the sigfile is modified')), |
|
|||
280 | ('', 'no-commit', None, _('do not commit the sigfile after signing')), |
|
|||
281 | ('k', 'key', '', |
|
|||
282 | _('the key id to sign with'), _('ID')), |
|
|||
283 | ('m', 'message', '', |
|
|||
284 | _('commit message'), _('TEXT')), |
|
|||
285 | ] + commands.commitopts2, |
|
|||
286 | _('hg sign [OPTION]... [REVISION]...')), |
|
|||
287 | "sigcheck": (check, [], _('hg sigcheck REVISION')), |
|
|||
288 | "sigs": (sigs, [], _('hg sigs')), |
|
|||
289 | } |
|
|||
290 |
|
General Comments 0
You need to be logged in to leave comments.
Login now