comparison hgext/gpg.py @ 19442:33c72f054e16

gpg: getkeys() removes unused returning value "err"
author Wei, Elson <elson.wei@gmail.com>
date Fri, 12 Jul 2013 10:10:46 +0800
parents 8b312c080adb
children 2a7fd31ac548
comparison
equal deleted inserted replaced
19441:8b312c080adb 19442:33c72f054e16
46 os.unlink(f) 46 os.unlink(f)
47 except OSError: 47 except OSError:
48 pass 48 pass
49 keys = [] 49 keys = []
50 key, fingerprint = None, None 50 key, fingerprint = None, None
51 err = ""
52 for l in ret.splitlines(): 51 for l in ret.splitlines():
53 # see DETAILS in the gnupg documentation 52 # see DETAILS in the gnupg documentation
54 # filter the logger output 53 # filter the logger output
55 if not l.startswith("[GNUPG:]"): 54 if not l.startswith("[GNUPG:]"):
56 continue 55 continue
68 l.startswith("BADSIG")): 67 l.startswith("BADSIG")):
69 if key is not None: 68 if key is not None:
70 keys.append(key + [fingerprint]) 69 keys.append(key + [fingerprint])
71 key = l.split(" ", 2) 70 key = l.split(" ", 2)
72 fingerprint = None 71 fingerprint = None
73 if err:
74 return err, []
75 if key is not None: 72 if key is not None:
76 keys.append(key + [fingerprint]) 73 keys.append(key + [fingerprint])
77 return err, keys 74 return keys
78 75
79 def newgpg(ui, **opts): 76 def newgpg(ui, **opts):
80 """create a new gpg instance""" 77 """create a new gpg instance"""
81 gpgpath = ui.config("gpg", "cmd", "gpg") 78 gpgpath = ui.config("gpg", "cmd", "gpg")
82 gpgkey = opts.get('key') 79 gpgkey = opts.get('key')
118 prefix = "%s:%d" % (fn, ln) 115 prefix = "%s:%d" % (fn, ln)
119 node = hgnode.bin(node) 116 node = hgnode.bin(node)
120 117
121 data = node2txt(repo, node, version) 118 data = node2txt(repo, node, version)
122 sig = binascii.a2b_base64(sig) 119 sig = binascii.a2b_base64(sig)
123 err, keys = mygpg.verify(data, sig) 120 keys = mygpg.verify(data, sig)
124 if err:
125 ui.warn("%s:%d %s\n" % (fn, ln , err))
126 return None
127 121
128 validkeys = [] 122 validkeys = []
129 # warn for expired key and/or sigs 123 # warn for expired key and/or sigs
130 for key in keys: 124 for key in keys:
131 if key[0] == "BADSIG": 125 if key[0] == "BADSIG":