greenmining 1.2.6__py3-none-any.whl → 1.2.8__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.8"
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
@@ -479,7 +480,7 @@ class LocalRepoAnalyzer:
479
480
  clone_parent.mkdir(parents=True, exist_ok=True)
480
481
  local_path = clone_parent / repo_name
481
482
 
482
- # Perform shallow clone manually before PyDriller (much faster!)
483
+ # Perform shallow clone manually, then unshallow for full history
483
484
  if not local_path.exists():
484
485
  import subprocess
485
486
 
@@ -499,14 +500,36 @@ class LocalRepoAnalyzer:
499
500
  capture_output=True,
500
501
  text=True,
501
502
  check=True,
502
- timeout=180,
503
+ timeout=300,
503
504
  )
504
505
  except subprocess.TimeoutExpired:
505
- colored_print(" Clone timeout after 180s", "yellow")
506
+ colored_print(" Clone timeout after 300s", "yellow")
506
507
  raise
507
508
  except subprocess.CalledProcessError as e:
508
509
  colored_print(f" Clone failed: {e.stderr}", "red")
509
510
  raise
511
+
512
+ # Immediately unshallow to get full history for accurate analysis
513
+ # This is still faster than a full clone: shallow clone negotiates
514
+ # objects quickly, then unshallow fetches the remainder incrementally
515
+ if self.shallow_clone:
516
+ colored_print(" Fetching full history...", "cyan")
517
+ try:
518
+ subprocess.run(
519
+ ["git", "fetch", "--unshallow"],
520
+ cwd=str(local_path),
521
+ capture_output=True,
522
+ text=True,
523
+ check=True,
524
+ timeout=300,
525
+ )
526
+ except subprocess.CalledProcessError:
527
+ pass # Already unshallowed or not shallow
528
+ except subprocess.TimeoutExpired:
529
+ colored_print(
530
+ " Warning: Full history fetch timed out, some metrics may be incomplete",
531
+ "yellow",
532
+ )
510
533
  else:
511
534
  colored_print(f" Using existing clone: {local_path}", "cyan")
512
535
 
@@ -556,7 +579,8 @@ class LocalRepoAnalyzer:
556
579
  except Exception:
557
580
  pass
558
581
 
559
- # Compute process metrics if enabled
582
+ # Compute process metrics if enabled (full history already available
583
+ # from the unshallow step that runs right after cloning)
560
584
  process_metrics = {}
561
585
  if self.compute_process_metrics and local_path.exists():
562
586
  colored_print(" Computing process metrics...", "cyan")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: greenmining
3
- Version: 1.2.6
3
+ Version: 1.2.8
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=949lyKXLFKgFLvz0T3o6UuVuGO1kvwdOwPmF1FA65d0,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=n-znklcb0MeN6nGha7pD6PCt7Z8SpN1rcIKthTFrt70,28634
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.8.dist-info/licenses/LICENSE,sha256=M7ma3JHGeiIZIs3ea0HTcFl_wLFPX2NZElUliYs4bCA,1083
31
+ greenmining-1.2.8.dist-info/METADATA,sha256=h-psius6PqVGZdP4_83a2KvLr2SQkT-0t5fDeWduwJc,10522
32
+ greenmining-1.2.8.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
33
+ greenmining-1.2.8.dist-info/top_level.txt,sha256=nreXgXxZIWI-42yQknQ0HXtUrFnzZ8N1ra4Mdy2KcsI,12
34
+ greenmining-1.2.8.dist-info/RECORD,,