aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2022-03-25 19:19:51 +0300
committerArthur Zamarin <arthurzam@gmail.com>2022-04-02 20:47:56 +0300
commita621b427372c6161b38a5de249c42ddab8c3063e (patch)
tree561473da2b69107276cea604e07c23757fee72fc
parentCI: add python 3.10 as regular target (diff)
downloadpkgdev-a621b427372c6161b38a5de249c42ddab8c3063e.tar.gz
pkgdev-a621b427372c6161b38a5de249c42ddab8c3063e.tar.bz2
pkgdev-a621b427372c6161b38a5de249c42ddab8c3063e.zip
Improve commit message for new package import
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
-rw-r--r--src/pkgdev/scripts/pkgdev_commit.py5
-rw-r--r--tests/scripts/test_pkgdev_commit.py7
2 files changed, 10 insertions, 2 deletions
diff --git a/src/pkgdev/scripts/pkgdev_commit.py b/src/pkgdev/scripts/pkgdev_commit.py
index bb783a5..3bb9044 100644
--- a/src/pkgdev/scripts/pkgdev_commit.py
+++ b/src/pkgdev/scripts/pkgdev_commit.py
@@ -317,7 +317,10 @@ class PkgSummary(ChangeSummary):
def add(self):
"""Generate summaries for add actions."""
if len(self.existing) == len(self.changes):
- return 'initial import'
+ msg = f"new package, add {', '.join(self.versions)}"
+ if len(self.versions) == 1 or len(msg) <= 50:
+ return msg
+ return 'new package'
elif not self.revbump:
msg = f"add {', '.join(self.versions)}"
if len(self.versions) == 1 or len(msg) <= 50:
diff --git a/tests/scripts/test_pkgdev_commit.py b/tests/scripts/test_pkgdev_commit.py
index ccebb2a..6cb1ff0 100644
--- a/tests/scripts/test_pkgdev_commit.py
+++ b/tests/scripts/test_pkgdev_commit.py
@@ -425,7 +425,12 @@ class TestPkgdevCommit:
# initial package import
repo.create_ebuild('cat/newpkg-0')
- assert commit() == 'cat/newpkg: initial import'
+ assert commit() == 'cat/newpkg: new package, add 0'
+
+ # initial package import, overflowed title truncated
+ for i in range(10):
+ repo.create_ebuild(f'cat/newpkg2-{i}.0.0')
+ assert commit() == 'cat/newpkg2: new package'
# single addition
repo.create_ebuild('cat/pkg-1')