hgext/gpg.py
changeset 34501 b0c42fec8dc2
parent 32375 04baab18d60a
child 34502 d54526c257af
equal deleted inserted replaced
34500:6c705bf6a8ff 34501:b0c42fec8dc2
    27 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
    27 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
    28 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
    28 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
    29 # be specifying the version(s) of Mercurial they are tested with, or
    29 # be specifying the version(s) of Mercurial they are tested with, or
    30 # leave the attribute unspecified.
    30 # leave the attribute unspecified.
    31 testedwith = 'ships-with-hg-core'
    31 testedwith = 'ships-with-hg-core'
       
    32 
       
    33 configtable = {}
       
    34 configitem = registrar.configitem(configtable)
       
    35 
       
    36 configitem('gpg', 'cmd',
       
    37     default='gpg',
       
    38 )
    32 
    39 
    33 class gpg(object):
    40 class gpg(object):
    34     def __init__(self, path, key=None):
    41     def __init__(self, path, key=None):
    35         self.path = path
    42         self.path = path
    36         self.key = (key and " --local-user \"%s\"" % key) or ""
    43         self.key = (key and " --local-user \"%s\"" % key) or ""
    89             keys.append(key + [fingerprint])
    96             keys.append(key + [fingerprint])
    90         return keys
    97         return keys
    91 
    98 
    92 def newgpg(ui, **opts):
    99 def newgpg(ui, **opts):
    93     """create a new gpg instance"""
   100     """create a new gpg instance"""
    94     gpgpath = ui.config("gpg", "cmd", "gpg")
   101     gpgpath = ui.config("gpg", "cmd")
    95     gpgkey = opts.get('key')
   102     gpgkey = opts.get('key')
    96     if not gpgkey:
   103     if not gpgkey:
    97         gpgkey = ui.config("gpg", "key", None)
   104         gpgkey = ui.config("gpg", "key", None)
    98     return gpg(gpgpath, gpgkey)
   105     return gpg(gpgpath, gpgkey)
    99 
   106