Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kernel-scripts
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Gustavo Padovan
kernel-scripts
Commits
715f00a6
Commit
715f00a6
authored
Oct 26, 2020
by
Gustavo Padovan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
backlog-tree: fix patch count + show more info
parent
41ab0ae9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
14 deletions
+30
-14
generate-html-tree.py
generate-html-tree.py
+20
-6
templates/backlog-tree.html.j2
templates/backlog-tree.html.j2
+10
-8
No files found.
generate-html-tree.py
View file @
715f00a6
...
...
@@ -8,8 +8,8 @@ from datetime import datetime
import
jinja2
import
argparse
#
BASE_URL="https://chromium.googlesource.com/chromiumos/third_party/kernel/+/"
BASE_URL
=
"https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id="
BASE_URL
=
"https://chromium.googlesource.com/chromiumos/third_party/kernel/+/"
#
BASE_URL="https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id="
def
classify_commit
(
fs_dict
,
commit
):
diff
=
repo
.
diff
(
commit
[
0
],
commit
[
0
]
+
"^"
)
...
...
@@ -25,14 +25,26 @@ def classify_commit(fs_dict, commit):
if
entry
not
in
partial_dict
.
keys
():
partial_dict
[
entry
]
=
[{},
0
]
partial_dict
[
entry
][
1
]
+=
1
partial_dict
=
partial_dict
[
entry
][
0
]
def
generate_html
(
repo
,
fs_dict
,
title
,
cmd
):
def
count_commits_per_folder
(
fs_structure
):
if
not
isinstance
(
fs_structure
,
dict
):
return
fs_structure
folder_commits
=
[]
for
entry
,
data
in
fs_structure
.
items
():
commits
=
count_commits_per_folder
(
data
[
0
])
fs_structure
[
entry
][
1
]
=
len
(
commits
)
[
folder_commits
.
append
(
x
)
for
x
in
commits
if
x
not
in
folder_commits
]
return
folder_commits
def
generate_html
(
repo
,
fs_dict
,
total_commits
,
title
,
cmd
):
env
=
jinja2
.
Environment
(
loader
=
jinja2
.
FileSystemLoader
(
'{}/templates'
.
format
(
sys
.
path
[
0
])))
template
=
env
.
get_template
(
'backlog-tree.html.j2'
)
return
template
.
render
(
data
=
fs_dict
,
baseurl
=
BASE_URL
,
title
=
title
,
cmdline
=
cmd
,
now
=
datetime
.
now
())
return
template
.
render
(
data
=
fs_dict
,
baseurl
=
BASE_URL
,
t
otal_commits
=
total_commits
,
t
itle
=
title
,
cmdline
=
cmd
,
now
=
datetime
.
now
())
if
__name__
==
"__main__"
:
parser
=
argparse
.
ArgumentParser
()
...
...
@@ -52,9 +64,11 @@ if __name__ == "__main__":
for
line
in
csv
.
reader
(
sys
.
stdin
,
delimiter
=
','
):
classify_commit
(
fs_dict
,
line
)
total_commits
=
count_commits_per_folder
(
fs_dict
)
with
open
(
args
.
output
+
'.json'
,
'w'
)
as
json_file
:
json
.
dump
(
fs_dict
,
json_file
)
html
=
generate_html
(
repo
,
fs_dict
,
args
.
title
,
args
.
cmdline
)
html
=
generate_html
(
repo
,
fs_dict
,
len
(
total_commits
),
args
.
title
,
args
.
cmdline
)
with
open
(
args
.
output
+
'.html'
,
'w'
)
as
html_file
:
html_file
.
write
(
html
)
templates/backlog-tree.html.j2
View file @
715f00a6
...
...
@@ -15,16 +15,16 @@
</head>
{% macro add_commit(commit) -%}
{% if commit | length > 4 %}
<span
class=
"badge badge-primary m-1 p-2"
>
{{ commit[4] }}
</span>
{% endif %}
<a
href=
"{{ baseurl }}{{ commit[0] }}"
>
{{ commit[0] }} - {{ commit[1] }}
</a>
{% if commit[2] != '' %}
{% if commit[2] == 'upstream' %}
<span
class=
"badge badge-pill badge-success m-1 p-2"
>
{% elif commit[2] == 'unmergeable' %}
<span
class=
"badge badge-pill badge-secondary m-1 p-2"
>
{% else %}
<span
class=
"badge badge-pill badge-warning m-1 p-2"
>
{% endif %}
{{ commit[2] }}
</span>
{% endif %}
...
...
@@ -49,6 +49,8 @@
{% endif %}
<p
class=
"text-monospace m-3"
>
Generated on {{ now }}
</p>
<h4
class=
"ml-3 p-2"
>
{{ total_commits }} commits in total
</h4>
<ul>
{% for folder, content in data | dictsort recursive %}
<li>
...
...
@@ -59,7 +61,7 @@
{{folder}}
<span
class=
"badge badge-dark m-1"
>
{{ content[1] }}
</span>
</a>
<span
class=
"badge badge-primary p-1"
style=
"width: {{ content[1] * 1.5 }}px;"
>
</span>
<div
class=
"collapse"
id=
"{{ class_id }}"
>
<div
class=
"collapse
{% if content[0].items is not defined and loop.depth > 1 %}show{% endif %}
"
id=
"{{ class_id }}"
>
{% if content[0].items is defined %}
<ul>
{{ loop(content[0] | dictsort) }}
</ul>
{% else %}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment