Patchwork [1,of,6] gpg: accept '--edit' like other commands creating new changeset

login
register
mail settings
Submitter Katsunori FUJIWARA
Date May 31, 2014, 3:26 p.m.
Message ID <d383633a89d3f181c0b2.1401549971@feefifofum>
Download mbox | patch
Permalink /patch/4906/
State Accepted
Headers show

Comments

Katsunori FUJIWARA - May 31, 2014, 3:26 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1401548912 -32400
#      Sun Jun 01 00:08:32 2014 +0900
# Node ID d383633a89d3f181c0b20ba84140fbef92f2c75f
# Parent  9c35f3a8cac48b9404ee8dbbda18467f6123b82f
gpg: accept '--edit' like other commands creating new changeset

After this patch, users can invoke editor for the commit message by
'--edit' option regardless of '--message'.

Patch

diff --git a/hgext/gpg.py b/hgext/gpg.py
--- a/hgext/gpg.py
+++ b/hgext/gpg.py
@@ -204,6 +204,7 @@ 
            _('the key id to sign with'), _('ID')),
           ('m', 'message', '',
            _('commit message'), _('TEXT')),
+          ('e', 'edit', False, _('invoke editor on commit messages')),
          ] + commands.commitopts2,
          _('hg sign [OPTION]... [REV]...'))
 def sign(ui, repo, *revs, **opts):
@@ -276,7 +277,8 @@ 
                              % hgnode.short(n)
                              for n in nodes])
     try:
-        repo.commit(message, opts['user'], opts['date'], match=msigs)
+        repo.commit(message, opts['user'], opts['date'], match=msigs,
+                    editor=cmdutil.getcommiteditor(**opts))
     except ValueError, inst:
         raise util.Abort(str(inst))
 
diff --git a/tests/test-gpg.t b/tests/test-gpg.t
--- a/tests/test-gpg.t
+++ b/tests/test-gpg.t
@@ -16,8 +16,17 @@ 
 
   $ hg sigs
 
-  $ hg sign 0
+  $ HGEDITOR=cat hg sign -e 0
   signing 0:e63c23eaa88a
+  Added signature for changeset e63c23eaa88a
+  
+  
+  HG: Enter commit message.  Lines beginning with 'HG:' are removed.
+  HG: Leave message empty to abort commit.
+  HG: --
+  HG: user: test
+  HG: branch 'default'
+  HG: added .hgsigs
 
   $ hg sigs
   hgtest                             0:e63c23eaa88ae77967edcf4ea194d31167c478b0