Gentoo Archives: gentoo-portage-dev

From: Brian Dolbec <dolsen@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] egencache --update-changelogs: filter merge commit noise (bug 579402)
Date: Sat, 09 Apr 2016 20:23:25
Message-Id: 20160409132227.79ce3feb.dolsen@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH] egencache --update-changelogs: filter merge commit noise (bug 579402) by Zac Medico
1 On Sat, 9 Apr 2016 02:07:31 -0700
2 Zac Medico <zmedico@g.o> wrote:
3
4 > In order to filter out merge commit noise, pass the -m and
5 > --first-parent options to the git commands. According to the
6 > description of these options in the git-log man page, "the output
7 > represents the changes the merge brought into the then-current
8 > branch".
9 >
10 > Suggested-by: Doug Freed <dwfreed@×××.edu>
11 > X-Gentoo-bug: 579402
12 > X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=579402
13 > ---
14 > bin/egencache | 13 ++++++++++---
15 > 1 file changed, 10 insertions(+), 3 deletions(-)
16 >
17 > diff --git a/bin/egencache b/bin/egencache
18 > index 0123d57..9da7103 100755
19 > --- a/bin/egencache
20 > +++ b/bin/egencache
21 > @@ -735,6 +735,9 @@ class _special_filename(_filename_base):
22 > return self.file_name < other.file_name
23 >
24 > class GenChangeLogs(object):
25 > +
26 > + _GIT_LOG_OPTS = ('-m', '--first-parent')
27 > +
28 > def __init__(self, portdb, changelog_output,
29 > changelog_reversed, max_jobs=None, max_load=None):
30 > self.returncode = os.EX_OK
31 > @@ -770,7 +773,8 @@ class GenChangeLogs(object):
32 > os.chdir(os.path.join(self._repo_path, cp))
33 > # Determine whether ChangeLog is up-to-date by
34 > comparing # the newest commit timestamp with the ChangeLog timestamp.
35 > - lmod = self.grab(['git', self._work_tree, 'log',
36 > '--format=%ct', '-1', '.'])
37 > + lmod = self.grab(['git', self._work_tree, 'log']
38 > + + list(self._GIT_LOG_OPTS) +
39 > ['--format=%ct', '-1', '.']) if not lmod:
40 > # This cp has not been added to the repo.
41 > return
42 > @@ -802,7 +806,8 @@ class GenChangeLogs(object):
43 > ''' % (cp, time.strftime('%Y'))))
44 >
45 > # now grab all the commits
46 > - revlist_cmd = ['git', self._work_tree, 'rev-list']
47 > + revlist_cmd = ['git', self._work_tree, 'rev-list'
48 > + ] + list(self._GIT_LOG_OPTS)
49 > if self._changelog_reversed:
50 > revlist_cmd.append('--reverse')
51 > revlist_cmd.extend(['HEAD', '--', '.'])
52 > @@ -810,6 +815,7 @@ class GenChangeLogs(object):
53 >
54 > for c in commits:
55 > # Explaining the arguments:
56 > + # -m --first-parent filters merge commit
57 > noise (`man git-log`) # --name-status to get a list of added/removed
58 > files # --no-renames to avoid getting more complex records on the list
59 > # --format to get the timestamp, author and
60 > commit description @@ -818,7 +824,8 @@ class GenChangeLogs(object):
61 > # -r (recursive) to get per-file changes
62 > # then the commit-id and path.
63 >
64 > - cinfo = self.grab(['git', self._work_tree,
65 > 'diff-tree',
66 > + cinfo = self.grab(['git', self._work_tree,
67 > 'diff-tree']
68 > + + list(self._GIT_LOG_OPTS) +
69 > [ '--name-status',
70 > '--no-renames',
71 > '--format=%ct %cN <%cE>%n%B',
72
73 It looks good to me, but I'd like to hear from Doug first, just to be
74 sure...
75
76 --
77 Brian Dolbec <dolsen>