hgext/gpg.py
branchstable
changeset 23048 ee5f834077be
parent 22683 f1872fdc1c3c
child 23877 7cc77030c557
equal deleted inserted replaced
22843:b6531d806de8 23048:ee5f834077be
   251     # write it
   251     # write it
   252     if opts['local']:
   252     if opts['local']:
   253         repo.opener.append("localsigs", sigmessage)
   253         repo.opener.append("localsigs", sigmessage)
   254         return
   254         return
   255 
   255 
   256     msigs = match.exact(repo.root, '', ['.hgsigs'])
   256     if not opts["force"]:
   257     s = repo.status(match=msigs, unknown=True, ignored=True)[:6]
   257         msigs = match.exact(repo.root, '', ['.hgsigs'])
   258     if util.any(s) and not opts["force"]:
   258         if util.any(repo.status(match=msigs, unknown=True, ignored=True)):
   259         raise util.Abort(_("working copy of .hgsigs is changed "
   259             raise util.Abort(_("working copy of .hgsigs is changed "),
   260                            "(please commit .hgsigs manually "
   260                              hint=_("please commit .hgsigs manually"))
   261                            "or use --force)"))
       
   262 
   261 
   263     sigsfile = repo.wfile(".hgsigs", "ab")
   262     sigsfile = repo.wfile(".hgsigs", "ab")
   264     sigsfile.write(sigmessage)
   263     sigsfile.write(sigmessage)
   265     sigsfile.close()
   264     sigsfile.close()
   266 
   265 
   275         # we don't translate commit messages
   274         # we don't translate commit messages
   276         message = "\n".join(["Added signature for changeset %s"
   275         message = "\n".join(["Added signature for changeset %s"
   277                              % hgnode.short(n)
   276                              % hgnode.short(n)
   278                              for n in nodes])
   277                              for n in nodes])
   279     try:
   278     try:
       
   279         editor = cmdutil.getcommiteditor(editform='gpg.sign', **opts)
   280         repo.commit(message, opts['user'], opts['date'], match=msigs,
   280         repo.commit(message, opts['user'], opts['date'], match=msigs,
   281                     editor=cmdutil.getcommiteditor(**opts))
   281                     editor=editor)
   282     except ValueError, inst:
   282     except ValueError, inst:
   283         raise util.Abort(str(inst))
   283         raise util.Abort(str(inst))
   284 
   284 
   285 def shortkey(ui, key):
   285 def shortkey(ui, key):
   286     if len(key) != 16:
   286     if len(key) != 16: