hgext/gpg.py
changeset 30945 82f1ef8b4477
parent 29852 d5883fd055c6
child 31423 279cbde7bf3d
equal deleted inserted replaced
30944:48dea083f66d 30945:82f1ef8b4477
    16     cmdutil,
    16     cmdutil,
    17     commands,
    17     commands,
    18     error,
    18     error,
    19     match,
    19     match,
    20     node as hgnode,
    20     node as hgnode,
       
    21     pycompat,
    21     util,
    22     util,
    22 )
    23 )
    23 
    24 
    24 cmdtable = {}
    25 cmdtable = {}
    25 command = cmdutil.command(cmdtable)
    26 command = cmdutil.command(cmdtable)
    42         """ returns of the good and bad signatures"""
    43         """ returns of the good and bad signatures"""
    43         sigfile = datafile = None
    44         sigfile = datafile = None
    44         try:
    45         try:
    45             # create temporary files
    46             # create temporary files
    46             fd, sigfile = tempfile.mkstemp(prefix="hg-gpg-", suffix=".sig")
    47             fd, sigfile = tempfile.mkstemp(prefix="hg-gpg-", suffix=".sig")
    47             fp = os.fdopen(fd, 'wb')
    48             fp = os.fdopen(fd, pycompat.sysstr('wb'))
    48             fp.write(sig)
    49             fp.write(sig)
    49             fp.close()
    50             fp.close()
    50             fd, datafile = tempfile.mkstemp(prefix="hg-gpg-", suffix=".txt")
    51             fd, datafile = tempfile.mkstemp(prefix="hg-gpg-", suffix=".txt")
    51             fp = os.fdopen(fd, 'wb')
    52             fp = os.fdopen(fd, pycompat.sysstr('wb'))
    52             fp.write(data)
    53             fp.write(data)
    53             fp.close()
    54             fp.close()
    54             gpgcmd = ("%s --logger-fd 1 --status-fd 1 --verify "
    55             gpgcmd = ("%s --logger-fd 1 --status-fd 1 --verify "
    55                       "\"%s\" \"%s\"" % (self.path, sigfile, datafile))
    56                       "\"%s\" \"%s\"" % (self.path, sigfile, datafile))
    56             ret = util.filter("", gpgcmd)
    57             ret = util.filter("", gpgcmd)