aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2022-10-26 21:58:57 +0300
committerArthur Zamarin <arthurzam@gentoo.org>2022-10-26 22:04:57 +0300
commitee0e2cb118d696ff3412f262c677c95bc8b56e6c (patch)
tree22d9c233678607fb4766e5ab225afc19778fdd2b
parentcommit: don't show disable for targets that are no-op (diff)
downloadpkgdev-ee0e2cb118d696ff3412f262c677c95bc8b56e6c.tar.gz
pkgdev-ee0e2cb118d696ff3412f262c677c95bc8b56e6c.tar.bz2
pkgdev-ee0e2cb118d696ff3412f262c677c95bc8b56e6c.zip
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@gentoo.org>
-rw-r--r--completion/bash/pkgdev1
-rw-r--r--completion/zsh/_pkgdev1
l---------doc/man/pkgdev1
-rw-r--r--src/pkgdev/scripts/pkgdev_commit.py10
-rw-r--r--tests/scripts/test_pkgdev_commit.py4
5 files changed, 16 insertions, 1 deletions
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 <author@example.com>"', '-e'):
+ for opt in ('--author="A U Thor <author@example.com>"', '-p'):
options, _ = tool.parse_args(['commit', opt])
assert options.commit_args == [opt]