commit:     ee0e2cb118d696ff3412f262c677c95bc8b56e6c
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 26 18:58:57 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Wed Oct 26 19:04:57 2022 +0000
URL:        
https://gitweb.gentoo.org/proj/pkgcore/pkgdev.git/commit/?id=ee0e2cb1

commit: mention `-e` as nice option

Even though just passing `-e` works (as it is just passed to git), many
users don't know the existence of this option, so now I publish it in
help.

Closes: https://bugs.gentoo.org/846785
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 completion/bash/pkgdev              |  1 +
 completion/zsh/_pkgdev              |  1 +
 doc/man/pkgdev                      |  1 +
 src/pkgdev/scripts/pkgdev_commit.py | 10 ++++++++++
 tests/scripts/test_pkgdev_commit.py |  4 +++-
 5 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/completion/bash/pkgdev b/completion/bash/pkgdev
index da54326..1408292 100644
--- a/completion/bash/pkgdev
+++ b/completion/bash/pkgdev
@@ -75,6 +75,7 @@ _pkgdev() {
                 --signoff
                 -m --message
                 -M --message-template
+                -e --edit
                 -u --update
                 -a --all
             "

diff --git a/completion/zsh/_pkgdev b/completion/zsh/_pkgdev
index db43883..f2c95bc 100644
--- a/completion/zsh/_pkgdev
+++ b/completion/zsh/_pkgdev
@@ -50,6 +50,7 @@ case $state in
           '--signoff[add a Signed-off-by trailer]' \
           \*{--message,-m}'[specify commit message]:message' \
           {'(--message-template)-M','(-M)--message-template'}'[use commit 
message template from specified file]:template:_files' \
+          {'(--edit)-e','(-e)--edit'}'[force edit of commit]' \
           {'(--update)-u','(-u)--update'}'[stage all changed files]' \
           {'(--all)-a','(-a)--all'}'[stage all changed/new/removed files]' \
           && ret=0

diff --git a/doc/man/pkgdev b/doc/man/pkgdev
new file mode 120000
index 0000000..81edde3
--- /dev/null
+++ b/doc/man/pkgdev
@@ -0,0 +1 @@
+/home/arthur/src/pkgcore/pkgdev/doc/generated/pkgdev
\ No newline at end of file

diff --git a/src/pkgdev/scripts/pkgdev_commit.py 
b/src/pkgdev/scripts/pkgdev_commit.py
index 0cdf232..98f09d1 100644
--- a/src/pkgdev/scripts/pkgdev_commit.py
+++ b/src/pkgdev/scripts/pkgdev_commit.py
@@ -45,6 +45,8 @@ class ArgumentParser(cli.ArgumentParser):
             args.append('-v')
         if namespace.signoff:
             args.append('--signoff')
+        if namespace.edit:
+            args.append('--edit')
         namespace.commit_args = args
         return namespace, []
 
@@ -161,6 +163,14 @@ msg_actions.add_argument(
     """)
 msg_actions.add_argument('-F', '--file', help=argparse.SUPPRESS)
 msg_actions.add_argument('-t', '--template', help=argparse.SUPPRESS)
+msg_actions.add_argument(
+    '-e', '--edit', action='store_true',
+    help='force edit of commit',
+    docs="""
+        The message taken from command line with -m, and from automatically
+        generated one are usually used as the commit log message unmodified.
+        This option lets you further edit the message taken from these sources.
+    """)
 
 add_actions = commit_opts.add_mutually_exclusive_group()
 add_actions.add_argument(

diff --git a/tests/scripts/test_pkgdev_commit.py 
b/tests/scripts/test_pkgdev_commit.py
index efc9491..7b2eb61 100644
--- a/tests/scripts/test_pkgdev_commit.py
+++ b/tests/scripts/test_pkgdev_commit.py
@@ -84,6 +84,8 @@ class TestPkgdevCommitParseArgs:
                     ('--dry-run', '--dry-run'),
                     ('-v', '-v'),
                     ('--verbose', '-v'),
+                    ('-e', '--edit'),
+                    ('--edit', '--edit'),
                     ):
                 options, _ = tool.parse_args(['commit', opt])
                 assert expected in options.commit_args
@@ -94,7 +96,7 @@ class TestPkgdevCommitParseArgs:
         repo.create_ebuild('cat/pkg-0')
         git_repo.add_all('cat/pkg-0', commit=False)
         with chdir(repo.location):
-            for opt in ('--author="A U Thor <[email protected]>"', '-e'):
+            for opt in ('--author="A U Thor <[email protected]>"', '-p'):
                 options, _ = tool.parse_args(['commit', opt])
             assert options.commit_args == [opt]
 

Reply via email to