Hi Antonio, On Sun, Nov 27, 2022 at 08:26:24PM -0300, Antonio Terceiro wrote: > Package: git-buildpackage > Version: 0.9.30 > Severity: wishlist > Tags: patch > > This allows one for example to add commands (e.g. `Gbp-Dch: ignore`) to > past commits, without having to rewrite the git history. This is > implemented in the attached patches.
Thanks. That looks like a good idea. One thing I wonder about is if we need a switch for that in case people use git notes for something else already and match gbp's format? I'm leaning towards avoiding yet another switch though - we can add it if it causes trouble. The one thing that would be great to have before appying this would be a test case (e.g. by adding an integration test to tests/component/deb/test_dch.py Cheers, -- Guido > > -- System Information: > Debian Release: bookworm/sid > APT prefers testing-debug > APT policy: (900, 'testing-debug'), (900, 'testing'), (500, > 'unstable-debug'), (500, 'unstable'), (1, 'experimental-debug'), (1, > 'experimental') > Architecture: amd64 (x86_64) > > Kernel: Linux 6.0.0-4-amd64 (SMP w/4 CPU threads; PREEMPT) > Locale: LANG=pt_BR.UTF-8, LC_CTYPE=pt_BR.UTF-8 (charmap=UTF-8), > LANGUAGE=pt_BR:pt:en > Shell: /bin/sh linked to /usr/bin/dash > Init: systemd (via /run/systemd/system) > LSM: AppArmor: enabled > > Versions of packages git-buildpackage depends on: > pn devscripts <none> > ii git 1:2.35.1-1 > ii man-db 2.11.1-1 > ii python3 3.10.6-1 > ii python3-dateutil 2.8.2-1 > ii python3-pkg-resources 65.5.0-1 > ii python3-yaml 6.0-3+b1 > ii sensible-utils 0.0.17 > > Versions of packages git-buildpackage recommends: > ii cowbuilder 0.89 > ii pbuilder 0.231 > ii pristine-tar 1.50 > ii python3-requests 2.28.1+dfsg-1 > ii sbuild 0.84.1 > > Versions of packages git-buildpackage suggests: > pn python3-notify2 <none> > ii sudo 1.9.11p3-2 > ii unzip 6.0-27 > > -- no debconf information > From 6efae4fd4ded2e456634439f388137fa3c52cac6 Mon Sep 17 00:00:00 2001 > From: Antonio Terceiro <terce...@debian.org> > Date: Sun, 27 Nov 2022 13:14:36 -0300 > Subject: [PATCH 1/2] GitCommit.get_commit_info: extract commit notes > > --- > gbp/git/repository.py | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/gbp/git/repository.py b/gbp/git/repository.py > index edbdfe9f..81ae70c9 100644 > --- a/gbp/git/repository.py > +++ b/gbp/git/repository.py > @@ -1712,7 +1712,7 @@ class GitRepository(object): > to the commit it points to. > > @param commitish: the commit-ish to inspect > - @return: the commit's including id, author, email, subject and body > + @return: the commit's including id, author, email, subject, body, > and notes > @rtype: dict > """ > commit_sha1 = self.rev_parse("%s^0" % commitish) > @@ -1744,12 +1744,15 @@ class GitRepository(object): > path = file_fields.pop(0) > files[status].append(path) > > + notes, _, _ = self._git_inout('notes', ['show', commit_sha1], > capture_stderr=True) > + > return {'id': commitish, > 'author': author, > 'committer': committer, > 'subject': fields[6].decode(), > 'patchname': fields[7].decode(), > 'body': fields[8].decode(), > + 'notes': notes.decode(), > 'files': files} > > #{ Patches > -- > 2.35.1 > > From 8db4c62bc1192ecb575d567e5df00ff2f7f0cdee Mon Sep 17 00:00:00 2001 > From: Antonio Terceiro <terce...@debian.org> > Date: Sun, 27 Nov 2022 19:52:46 -0300 > Subject: [PATCH 2/2] dch: also look into commit notes for Gbp-Dch: commands > > This allows one for example to add commands (e.g. `Gbp-Dch: ignore`) to > past commits, without having to rewrite the git history. > --- > docs/manpages/gbp-dch.xml | 10 +++++++--- > gbp/dch.py | 2 +- > 2 files changed, 8 insertions(+), 4 deletions(-) > > diff --git a/docs/manpages/gbp-dch.xml b/docs/manpages/gbp-dch.xml > index bb9574cb..8250488b 100644 > --- a/docs/manpages/gbp-dch.xml > +++ b/docs/manpages/gbp-dch.xml > @@ -569,9 +569,9 @@ > Additional to the above options, the formatting of the commit message > in <filename>debian/changelog</filename> can be modified by special tags > (called Meta Tags) > - given in the git commit message. Meta Tag processing can be activated via > - the <option>--meta</option> option. The tags must start at the first > column of > - a commit message but can appear on any line. > + given in the git commit message or in commit notes. Meta Tag processing > can > + be activated via the <option>--meta</option> option. The tags must start > + at the first column of a commit message but can appear on any line. > They are of the form <option>Tagname</option>: > <replaceable>value</replaceable>. Valid Meta Tags are: > </para> > @@ -650,6 +650,10 @@ > <xref linkend="man.gbp.import.orig"/>, > <xref linkend="man.gbp.conf"/>, > &man.seealso.common; > + <citerefentry> > + <refentrytitle>git-notes</refentrytitle> > + <manvolnum>1</manvolnum> > + </citerefentry>, > <ulink url="https://honk.sigxcpu.org/cl2vcs"> > <citetitle>Cl2vcs</citetitle></ulink>, > </para> > diff --git a/gbp/dch.py b/gbp/dch.py > index d72152ba..0afdeeea 100644 > --- a/gbp/dch.py > +++ b/gbp/dch.py > @@ -106,7 +106,7 @@ def format_changelog_entry(commit_info, options, > last_commit=False): > GitRepository.get_commit_info()). If last_commit is not False, > then this entry is the last one in the series.""" > entry = [commit_info['subject']] > - body = commit_info['body'].splitlines() > + body = commit_info['body'].splitlines() + > commit_info['notes'].splitlines() > commitid = commit_info['id'] > (git_dch_cmds, body) = extract_git_dch_cmds(body, options) > > -- > 2.35.1 >