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