git-ember 1.3.1__tar.gz → 1.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {git_ember-1.3.1/src/git_ember.egg-info → git_ember-1.3.2}/PKG-INFO +1 -1
- {git_ember-1.3.1 → git_ember-1.3.2}/pyproject.toml +1 -1
- {git_ember-1.3.1 → git_ember-1.3.2/src/git_ember.egg-info}/PKG-INFO +1 -1
- git_ember-1.3.2/src/gitember/__init__.py +1 -0
- {git_ember-1.3.1 → git_ember-1.3.2}/src/gitember/cli.py +17 -5
- {git_ember-1.3.1 → git_ember-1.3.2}/src/gitember/config.py +10 -7
- {git_ember-1.3.1 → git_ember-1.3.2}/src/gitember/git.py +4 -0
- {git_ember-1.3.1 → git_ember-1.3.2}/src/gitember/render.py +6 -7
- git_ember-1.3.1/src/gitember/__init__.py +0 -1
- {git_ember-1.3.1 → git_ember-1.3.2}/LICENSE +0 -0
- {git_ember-1.3.1 → git_ember-1.3.2}/README.md +0 -0
- {git_ember-1.3.1 → git_ember-1.3.2}/setup.cfg +0 -0
- {git_ember-1.3.1 → git_ember-1.3.2}/src/git_ember.egg-info/SOURCES.txt +0 -0
- {git_ember-1.3.1 → git_ember-1.3.2}/src/git_ember.egg-info/dependency_links.txt +0 -0
- {git_ember-1.3.1 → git_ember-1.3.2}/src/git_ember.egg-info/entry_points.txt +0 -0
- {git_ember-1.3.1 → git_ember-1.3.2}/src/git_ember.egg-info/requires.txt +0 -0
- {git_ember-1.3.1 → git_ember-1.3.2}/src/git_ember.egg-info/top_level.txt +0 -0
- {git_ember-1.3.1 → git_ember-1.3.2}/src/gitember/colors.py +0 -0
- {git_ember-1.3.1 → git_ember-1.3.2}/tests/test_config.py +0 -0
- {git_ember-1.3.1 → git_ember-1.3.2}/tests/test_git.py +0 -0
- {git_ember-1.3.1 → git_ember-1.3.2}/tests/test_render.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.3.2"
|
|
@@ -7,7 +7,12 @@ from pathlib import Path
|
|
|
7
7
|
|
|
8
8
|
from gitember import __version__
|
|
9
9
|
from gitember.colors import get_color_scheme, RESET, LIGHT_GRAY
|
|
10
|
-
from gitember.config import
|
|
10
|
+
from gitember.config import (
|
|
11
|
+
config_file_path,
|
|
12
|
+
ALLOWED_CONFIG_KEYS,
|
|
13
|
+
load_config,
|
|
14
|
+
save_config,
|
|
15
|
+
)
|
|
11
16
|
from gitember.git import (
|
|
12
17
|
run_git_log,
|
|
13
18
|
get_recent_commits,
|
|
@@ -18,7 +23,12 @@ from gitember.git import (
|
|
|
18
23
|
get_default_branch,
|
|
19
24
|
get_streaks,
|
|
20
25
|
)
|
|
21
|
-
from gitember.render import
|
|
26
|
+
from gitember.render import (
|
|
27
|
+
render_grid,
|
|
28
|
+
render_branch_tree,
|
|
29
|
+
calculate_thresholds,
|
|
30
|
+
render_legend,
|
|
31
|
+
)
|
|
22
32
|
|
|
23
33
|
|
|
24
34
|
__all__ = ["main"]
|
|
@@ -125,7 +135,7 @@ def parse_args() -> argparse.Namespace:
|
|
|
125
135
|
"--week-start",
|
|
126
136
|
type=str,
|
|
127
137
|
choices=["sunday", "monday"],
|
|
128
|
-
default=
|
|
138
|
+
default=None,
|
|
129
139
|
help="First day of week: sunday or monday (default: sunday)",
|
|
130
140
|
)
|
|
131
141
|
parser.add_argument(
|
|
@@ -351,9 +361,11 @@ def main() -> None:
|
|
|
351
361
|
)
|
|
352
362
|
print(f" {commit['message']}")
|
|
353
363
|
|
|
354
|
-
print("\n--- Top Contributors ---")
|
|
364
|
+
print("\n--- Top Contributors ---")
|
|
355
365
|
contrib_color = color_scheme.get(2)
|
|
356
|
-
for contrib, count in get_top_contributors(
|
|
366
|
+
for contrib, count in get_top_contributors(
|
|
367
|
+
repo_path, branch=branch, author=author
|
|
368
|
+
):
|
|
357
369
|
print(f" {count:>4} {contrib_color}{contrib}{RESET}")
|
|
358
370
|
|
|
359
371
|
|
|
@@ -33,23 +33,26 @@ def config_file_path() -> Path:
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
ALLOWED_CONFIG_KEYS = {"color", "border", "week_start"}
|
|
36
|
-
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
DEFAULT_CONFIG = {
|
|
39
|
+
"color": "green",
|
|
40
|
+
"border": "=",
|
|
41
|
+
"week_start": "sunday",
|
|
42
|
+
}
|
|
37
43
|
|
|
38
44
|
|
|
39
45
|
def load_config() -> dict:
|
|
40
46
|
"""Load config from file, returning defaults if not exists.
|
|
41
47
|
|
|
42
48
|
Returns:
|
|
43
|
-
Dict with keys: color, border.
|
|
49
|
+
Dict with keys: color, border, week_start.
|
|
44
50
|
"""
|
|
45
51
|
path = config_file_path()
|
|
46
52
|
if not path.exists():
|
|
47
|
-
return
|
|
48
|
-
"color": "green",
|
|
49
|
-
"border": "=",
|
|
50
|
-
}
|
|
53
|
+
return DEFAULT_CONFIG.copy()
|
|
51
54
|
|
|
52
|
-
config =
|
|
55
|
+
config = DEFAULT_CONFIG.copy()
|
|
53
56
|
try:
|
|
54
57
|
text = path.read_text(encoding="utf-8")
|
|
55
58
|
except OSError:
|
|
@@ -441,6 +441,10 @@ def get_streaks(counts: Dict[dt.date, int]) -> Dict[str, Any]:
|
|
|
441
441
|
|
|
442
442
|
Returns:
|
|
443
443
|
Dict with current_streak, longest_streak, longest_streak_end.
|
|
444
|
+
|
|
445
|
+
Note:
|
|
446
|
+
Current streak is limited to the last 30 days. If no commits in the
|
|
447
|
+
past 30 days, current_streak will be 0 regardless of historical activity.
|
|
444
448
|
"""
|
|
445
449
|
if not counts:
|
|
446
450
|
return {"current_streak": 0, "longest_streak": 0, "longest_streak_end": None}
|
|
@@ -40,21 +40,20 @@ def render_legend(
|
|
|
40
40
|
parts = []
|
|
41
41
|
|
|
42
42
|
t = thresholds
|
|
43
|
-
parts.append(f"{color_scheme.get(0)}No commits{RESET}")
|
|
44
43
|
|
|
45
44
|
if t[1] != t[2]:
|
|
46
|
-
label = f"
|
|
45
|
+
label = f" 1-{t[1]}"
|
|
47
46
|
parts.append(f"{color_scheme.get(1)}{block_chars[1]}{label}{RESET}")
|
|
48
47
|
|
|
49
|
-
if t[2] != t[3]:
|
|
50
|
-
label = f"{t[
|
|
48
|
+
if t[2] != t[3] and t[1] != t[2]:
|
|
49
|
+
label = f" {t[1] + 1}-{t[2]}"
|
|
51
50
|
parts.append(f"{color_scheme.get(2)}{block_chars[2]}{label}{RESET}")
|
|
52
51
|
|
|
53
|
-
if t[3] != t[4]:
|
|
54
|
-
label = f"{t[
|
|
52
|
+
if t[3] != t[4] and t[2] != t[3]:
|
|
53
|
+
label = f" {t[2] + 1}-{t[3]}"
|
|
55
54
|
parts.append(f"{color_scheme.get(3)}{block_chars[3]}{label}{RESET}")
|
|
56
55
|
|
|
57
|
-
label = f"{t[
|
|
56
|
+
label = f" {t[3] + 1}+"
|
|
58
57
|
parts.append(f"{color_scheme.get(4)}{block_chars[4]}{label}{RESET}")
|
|
59
58
|
|
|
60
59
|
return " ".join(parts)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.2.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|