greenmining 1.2.2__py3-none-any.whl → 1.2.4__py3-none-any.whl
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.
- greenmining/__init__.py +8 -1
- greenmining/services/local_repo_analyzer.py +11 -0
- {greenmining-1.2.2.dist-info → greenmining-1.2.4.dist-info}/METADATA +1 -1
- {greenmining-1.2.2.dist-info → greenmining-1.2.4.dist-info}/RECORD +7 -7
- {greenmining-1.2.2.dist-info → greenmining-1.2.4.dist-info}/WHEEL +0 -0
- {greenmining-1.2.2.dist-info → greenmining-1.2.4.dist-info}/licenses/LICENSE +0 -0
- {greenmining-1.2.2.dist-info → greenmining-1.2.4.dist-info}/top_level.txt +0 -0
greenmining/__init__.py
CHANGED
|
@@ -8,7 +8,7 @@ from greenmining.gsf_patterns import (
|
|
|
8
8
|
is_green_aware,
|
|
9
9
|
)
|
|
10
10
|
|
|
11
|
-
__version__ = "1.2.
|
|
11
|
+
__version__ = "1.2.4"
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
def fetch_repositories(
|
|
@@ -73,6 +73,8 @@ def analyze_repositories(
|
|
|
73
73
|
since_date: str = None,
|
|
74
74
|
to_date: str = None,
|
|
75
75
|
cleanup_after: bool = True,
|
|
76
|
+
skip_merges: bool = True,
|
|
77
|
+
commit_order: str = "newest_first",
|
|
76
78
|
):
|
|
77
79
|
# Analyze multiple repositories from URLs.
|
|
78
80
|
# Args:
|
|
@@ -88,6 +90,9 @@ def analyze_repositories(
|
|
|
88
90
|
# github_token: GitHub token for private HTTPS repositories
|
|
89
91
|
# since_date: Analyze commits from this date (YYYY-MM-DD string)
|
|
90
92
|
# to_date: Analyze commits up to this date (YYYY-MM-DD string)
|
|
93
|
+
# cleanup_after: Remove cloned repos after analysis (default True)
|
|
94
|
+
# skip_merges: Skip merge commits (default True)
|
|
95
|
+
# commit_order: "newest_first" (default) or "oldest_first"
|
|
91
96
|
from greenmining.services.local_repo_analyzer import LocalRepoAnalyzer
|
|
92
97
|
|
|
93
98
|
kwargs = {}
|
|
@@ -109,6 +114,8 @@ def analyze_repositories(
|
|
|
109
114
|
ssh_key_path=ssh_key_path,
|
|
110
115
|
github_token=github_token,
|
|
111
116
|
cleanup_after=cleanup_after,
|
|
117
|
+
skip_merges=skip_merges,
|
|
118
|
+
commit_order=commit_order,
|
|
112
119
|
**kwargs,
|
|
113
120
|
)
|
|
114
121
|
|
|
@@ -205,6 +205,7 @@ class LocalRepoAnalyzer:
|
|
|
205
205
|
process_metrics: str = "standard",
|
|
206
206
|
since_date: Optional[datetime] = None,
|
|
207
207
|
to_date: Optional[datetime] = None,
|
|
208
|
+
commit_order: str = "newest_first",
|
|
208
209
|
):
|
|
209
210
|
# Initialize the local repository analyzer.
|
|
210
211
|
# Args:
|
|
@@ -221,6 +222,7 @@ class LocalRepoAnalyzer:
|
|
|
221
222
|
# method_level_analysis: Extract per-method metrics via Lizard
|
|
222
223
|
# include_source_code: Include source code before/after in results
|
|
223
224
|
# process_metrics: "standard" or "full" PyDriller process metrics
|
|
225
|
+
# commit_order: "newest_first" (default) or "oldest_first"
|
|
224
226
|
self.clone_path = clone_path or Path.cwd() / "greenmining_repos"
|
|
225
227
|
self.clone_path.mkdir(parents=True, exist_ok=True)
|
|
226
228
|
self.max_commits = max_commits
|
|
@@ -230,6 +232,7 @@ class LocalRepoAnalyzer:
|
|
|
230
232
|
self.skip_merges = skip_merges
|
|
231
233
|
self.compute_process_metrics = compute_process_metrics
|
|
232
234
|
self.cleanup_after = cleanup_after
|
|
235
|
+
self.commit_order = commit_order
|
|
233
236
|
self.gsf_patterns = GSF_PATTERNS
|
|
234
237
|
|
|
235
238
|
# Phase 1.3: Private repository support
|
|
@@ -459,6 +462,8 @@ class LocalRepoAnalyzer:
|
|
|
459
462
|
}
|
|
460
463
|
if self.to_date:
|
|
461
464
|
repo_config["to"] = self.to_date
|
|
465
|
+
if self.commit_order == "oldest_first":
|
|
466
|
+
repo_config["order"] = "reverse"
|
|
462
467
|
|
|
463
468
|
# Use owner_repo format for unique directory names (avoids collisions
|
|
464
469
|
# when multiple repos share the same name, e.g. open-android/Android
|
|
@@ -639,6 +644,9 @@ class LocalRepoAnalyzer:
|
|
|
639
644
|
colored_print(f"\n[{i}/{len(urls)}] Processing repository...", "cyan")
|
|
640
645
|
try:
|
|
641
646
|
result = self.analyze_repository(url)
|
|
647
|
+
if result.total_commits == 0:
|
|
648
|
+
colored_print(f" Skipping {result.name}: no commits in date range", "yellow")
|
|
649
|
+
continue
|
|
642
650
|
results.append(result)
|
|
643
651
|
except Exception as e:
|
|
644
652
|
colored_print(f" Error analyzing {url}: {e}", "red")
|
|
@@ -656,6 +664,9 @@ class LocalRepoAnalyzer:
|
|
|
656
664
|
url = future_to_url[future]
|
|
657
665
|
try:
|
|
658
666
|
result = future.result()
|
|
667
|
+
if result.total_commits == 0:
|
|
668
|
+
colored_print(f" Skipping {result.name}: no commits in date range", "yellow")
|
|
669
|
+
continue
|
|
659
670
|
results.append(result)
|
|
660
671
|
colored_print(f" Completed: {result.name}", "green")
|
|
661
672
|
except Exception as e:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
greenmining/__init__.py,sha256=
|
|
1
|
+
greenmining/__init__.py,sha256=erfTupwdZ-PlNwj2YygUyEbLT7aNd2zTfTJJ-NMG1wg,4496
|
|
2
2
|
greenmining/__main__.py,sha256=NYOVS7D4w2XDLn6SyXHXPKE5GrNGOeoWSTb_KazgK5c,590
|
|
3
3
|
greenmining/gsf_patterns.py,sha256=UvNJPY3HlAx1SicwUqci40TlLg8lCL0tszSOH4haxQs,55921
|
|
4
4
|
greenmining/utils.py,sha256=-dnLUw9taCzvQ2dk6uc66GAohOFiXJFKs9TLSEPk5kM,2893
|
|
@@ -25,10 +25,10 @@ greenmining/services/commit_extractor.py,sha256=qBM9QpGzPZRmGMFufJ6gP8eWIuufTowL
|
|
|
25
25
|
greenmining/services/data_aggregator.py,sha256=BU_HUb-8c0n0sa_7VZRB8jIVnaVhRLf-E6KA4ASh-08,19427
|
|
26
26
|
greenmining/services/data_analyzer.py,sha256=0XqW-slrnt7RotrHDweOqKtoN8XIA7y6p7s2Jau6cMg,7431
|
|
27
27
|
greenmining/services/github_graphql_fetcher.py,sha256=ZklXdEAc60KeFL83zRYMwW_-2OwMKpfPY7Wrifl0D50,11539
|
|
28
|
-
greenmining/services/local_repo_analyzer.py,sha256=
|
|
28
|
+
greenmining/services/local_repo_analyzer.py,sha256=kmNs6KzW8_hgRdzArqBq2TZ-3Rflh-9Ody0lqYa4Vl4,25915
|
|
29
29
|
greenmining/services/reports.py,sha256=nhJuYiA5tPD_9AjtgSLEnrpW3x15sZXrwIxpxQEBbh0,23219
|
|
30
|
-
greenmining-1.2.
|
|
31
|
-
greenmining-1.2.
|
|
32
|
-
greenmining-1.2.
|
|
33
|
-
greenmining-1.2.
|
|
34
|
-
greenmining-1.2.
|
|
30
|
+
greenmining-1.2.4.dist-info/licenses/LICENSE,sha256=M7ma3JHGeiIZIs3ea0HTcFl_wLFPX2NZElUliYs4bCA,1083
|
|
31
|
+
greenmining-1.2.4.dist-info/METADATA,sha256=2-7qoQ9C6nbcQxXKYG2Dv0BvEMtbX6GecWlSXGPCdOo,10522
|
|
32
|
+
greenmining-1.2.4.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
33
|
+
greenmining-1.2.4.dist-info/top_level.txt,sha256=nreXgXxZIWI-42yQknQ0HXtUrFnzZ8N1ra4Mdy2KcsI,12
|
|
34
|
+
greenmining-1.2.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|