greenmining 1.2.6__py3-none-any.whl → 1.2.7__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 CHANGED
@@ -8,7 +8,7 @@ from greenmining.gsf_patterns import (
8
8
  is_green_aware,
9
9
  )
10
10
 
11
- __version__ = "1.2.6"
11
+ __version__ = "1.2.7"
12
12
 
13
13
 
14
14
  def fetch_repositories(
@@ -237,8 +237,9 @@ class LocalRepoAnalyzer:
237
237
  self.cleanup_after = cleanup_after
238
238
  self.commit_order = commit_order
239
239
  self.shallow_clone = shallow_clone
240
- # Auto-calculate clone depth: max_commits * 3 to account for merges/skipped commits
241
- self.clone_depth = clone_depth if clone_depth else max(50, max_commits * 3)
240
+ # Auto-calculate clone depth: max_commits * 5 to account for merges/skipped commits
241
+ # and avoid boundary errors where parent commits fall outside the shallow window
242
+ self.clone_depth = clone_depth if clone_depth else max(100, max_commits * 5)
242
243
  self.gsf_patterns = GSF_PATTERNS
243
244
 
244
245
  # Phase 1.3: Private repository support
@@ -559,6 +560,29 @@ class LocalRepoAnalyzer:
559
560
  # Compute process metrics if enabled
560
561
  process_metrics = {}
561
562
  if self.compute_process_metrics and local_path.exists():
563
+ # Unshallow the repo before process metrics — they need full history
564
+ # for metrics like CommitsCount, ContributorsExperience, HistoryComplexity
565
+ if self.shallow_clone:
566
+ colored_print(" Deepening clone for process metrics...", "cyan")
567
+ try:
568
+ import subprocess
569
+
570
+ subprocess.run(
571
+ ["git", "fetch", "--unshallow"],
572
+ cwd=str(local_path),
573
+ capture_output=True,
574
+ text=True,
575
+ check=True,
576
+ timeout=120,
577
+ )
578
+ except subprocess.CalledProcessError:
579
+ # Already unshallowed or not a shallow repo — safe to ignore
580
+ pass
581
+ except subprocess.TimeoutExpired:
582
+ colored_print(
583
+ " Warning: Unshallow timed out, process metrics may be incomplete",
584
+ "yellow",
585
+ )
562
586
  colored_print(" Computing process metrics...", "cyan")
563
587
  process_metrics = self._compute_process_metrics(str(local_path))
564
588
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: greenmining
3
- Version: 1.2.6
3
+ Version: 1.2.7
4
4
  Summary: An empirical Python library for Mining Software Repositories (MSR) in Green IT research
5
5
  Author-email: Adam Bouafia <a.bouafia@student.vu.nl>
6
6
  License: MIT
@@ -1,4 +1,4 @@
1
- greenmining/__init__.py,sha256=FvURFMzA2M-JtfP92RiAaCOVvJjN2qNUuEAQr0SPD4o,4789
1
+ greenmining/__init__.py,sha256=r5vl2wG-r-A7WKeiQ_V_2PghJYc8cAledUXlS2Le-Cg,4789
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=WhSbQGMdkb0D4uLcMKW6xZK77c5AkW-nZf718issap4,11527
28
- greenmining/services/local_repo_analyzer.py,sha256=Ju3UA9LQc2LpIatvpDiKg9aLhQp5HsldsrdWJDU5Rwo,27406
28
+ greenmining/services/local_repo_analyzer.py,sha256=wJWQx-UnUhrmtte0b3shtuNUzvS5-nQlpMKItYVrKNo,28642
29
29
  greenmining/services/reports.py,sha256=QCJZhET3hRkH83htxLkbEP58dE3-7jIZh82Pp60hQcc,23218
30
- greenmining-1.2.6.dist-info/licenses/LICENSE,sha256=M7ma3JHGeiIZIs3ea0HTcFl_wLFPX2NZElUliYs4bCA,1083
31
- greenmining-1.2.6.dist-info/METADATA,sha256=M7yBMY3OIVcZnq3JxIvRe6ncQnnK78_U90ezvN1WyVA,10522
32
- greenmining-1.2.6.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
33
- greenmining-1.2.6.dist-info/top_level.txt,sha256=nreXgXxZIWI-42yQknQ0HXtUrFnzZ8N1ra4Mdy2KcsI,12
34
- greenmining-1.2.6.dist-info/RECORD,,
30
+ greenmining-1.2.7.dist-info/licenses/LICENSE,sha256=M7ma3JHGeiIZIs3ea0HTcFl_wLFPX2NZElUliYs4bCA,1083
31
+ greenmining-1.2.7.dist-info/METADATA,sha256=QasuhsVc6c-uXlMdaKFkQMHOEcnmTkA1U49WGLdJsnY,10522
32
+ greenmining-1.2.7.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
33
+ greenmining-1.2.7.dist-info/top_level.txt,sha256=nreXgXxZIWI-42yQknQ0HXtUrFnzZ8N1ra4Mdy2KcsI,12
34
+ greenmining-1.2.7.dist-info/RECORD,,