half-orm-dev 1.0.0a8__tar.gz → 1.0.0a9__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.
Files changed (79) hide show
  1. {half_orm_dev-1.0.0a8/half_orm_dev.egg-info → half_orm_dev-1.0.0a9}/PKG-INFO +1 -1
  2. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/cli/commands/migrate.py +4 -0
  3. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/migration_manager.py +4 -5
  4. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/release_manager.py +53 -6
  5. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/repo.py +20 -31
  6. half_orm_dev-1.0.0a9/half_orm_dev/version.txt +1 -0
  7. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9/half_orm_dev.egg-info}/PKG-INFO +1 -1
  8. half_orm_dev-1.0.0a8/half_orm_dev/version.txt +0 -1
  9. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/AUTHORS +0 -0
  10. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/LICENSE +0 -0
  11. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/README.md +0 -0
  12. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/__init__.py +0 -0
  13. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/bootstrap_manager.py +0 -0
  14. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/cli/__init__.py +0 -0
  15. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/cli/commands/__init__.py +0 -0
  16. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/cli/commands/apply.py +0 -0
  17. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/cli/commands/bootstrap.py +0 -0
  18. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/cli/commands/check.py +0 -0
  19. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/cli/commands/clone.py +0 -0
  20. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/cli/commands/init.py +0 -0
  21. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/cli/commands/patch.py +0 -0
  22. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/cli/commands/release.py +0 -0
  23. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/cli/commands/restore.py +0 -0
  24. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/cli/commands/revert_migration.py +0 -0
  25. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/cli/commands/set_git_origin.py +0 -0
  26. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/cli/commands/sync.py +0 -0
  27. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/cli/commands/todo.py +0 -0
  28. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/cli/commands/undo.py +0 -0
  29. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/cli/commands/update.py +0 -0
  30. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/cli/commands/upgrade.py +0 -0
  31. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/cli/main.py +0 -0
  32. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/cli_extension.py +0 -0
  33. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/database.py +0 -0
  34. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/decorators.py +0 -0
  35. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/file_executor.py +0 -0
  36. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/hgit.py +0 -0
  37. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/migrations/0/17/1/00_move_to_hop.py +0 -0
  38. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/migrations/0/17/1/01_txt_to_toml.py +0 -0
  39. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/migrations/0/17/4/00_toml_dict_format.py +0 -0
  40. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/migrations/0/17/4/01_add_bootstrap_table.py +0 -0
  41. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/migrations/0/17/4/02_move_patches_to_subdirs.py +0 -0
  42. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/migrations/0/17/5/01_update_pyproject_dependency.py +0 -0
  43. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/migrations/0/18/0/00_add_async_support.py +0 -0
  44. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/migrations/0/18/0/01_update_default_tests.py +0 -0
  45. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/migrations/hop/BREAKING_CHANGES-1.0.0.md +0 -0
  46. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/modules.py +0 -0
  47. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/patch_manager.py +0 -0
  48. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/patch_validator.py +0 -0
  49. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/patches/0/1/0/00_half_orm_meta.database.sql +0 -0
  50. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/patches/0/1/0/01_alter_half_orm_meta.hop_release.sql +0 -0
  51. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/patches/0/1/0/02_half_orm_meta.view.hop_penultimate_release.sql +0 -0
  52. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/patches/log +0 -0
  53. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/patches/sql/half_orm_meta.sql +0 -0
  54. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/release_file.py +0 -0
  55. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/scripts/repair-metadata.py +0 -0
  56. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/templates/.gitignore +0 -0
  57. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/templates/MANIFEST.in +0 -0
  58. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/templates/README +0 -0
  59. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/templates/conftest_template +0 -0
  60. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/templates/git-hooks/pre-commit +0 -0
  61. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/templates/git-hooks/prepare-commit-msg +0 -0
  62. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/templates/init_module_template +0 -0
  63. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/templates/module_stub_template +0 -0
  64. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/templates/module_template_1 +0 -0
  65. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/templates/module_template_2 +0 -0
  66. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/templates/module_template_3 +0 -0
  67. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/templates/pyproject.toml +0 -0
  68. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/templates/relation_test +0 -0
  69. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/templates/sql_adapter +0 -0
  70. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/templates/warning +0 -0
  71. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev/utils.py +0 -0
  72. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev.egg-info/SOURCES.txt +0 -0
  73. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev.egg-info/dependency_links.txt +0 -0
  74. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev.egg-info/entry_points.txt +0 -0
  75. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev.egg-info/requires.txt +0 -0
  76. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/half_orm_dev.egg-info/top_level.txt +0 -0
  77. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/pyproject.toml +0 -0
  78. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/setup.cfg +0 -0
  79. {half_orm_dev-1.0.0a8 → half_orm_dev-1.0.0a9}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: half_orm_dev
3
- Version: 1.0.0a8
3
+ Version: 1.0.0a9
4
4
  Summary: half_orm development Framework.
5
5
  Author-email: Joël Maïzi <joel.maizi@collorg.org>
6
6
  License-Expression: GPL-3.0-or-later
@@ -134,6 +134,10 @@ def migrate(verbose: bool) -> None:
134
134
  click.echo(f" • {error}")
135
135
 
136
136
  click.echo(f"\n✓ Synced .hop/ to active branches")
137
+
138
+ deleted = result.get('orphaned_staged_deleted', [])
139
+ if deleted:
140
+ click.echo(f"✓ Deleted {len(deleted)} orphaned ho-staged branch(es)")
137
141
  else:
138
142
  click.echo(f"✓ {utils.Color.green('Repository is up to date')}")
139
143
 
@@ -476,8 +476,8 @@ class MigrationManager:
476
476
 
477
477
  patch_branches = [b['name'] for b in branches_status.get('patch_branches', [])]
478
478
  release_branches = [b['name'] for b in branches_status.get('release_branches', [])]
479
- staged_branches = [b['name'] for b in branches_status.get('staged_branches', [])]
480
- active_branches = release_branches + patch_branches + staged_branches
479
+ # ho-staged/* branches are frozen after merge — excluded from sync checks
480
+ active_branches = release_branches + patch_branches
481
481
 
482
482
  blocked = []
483
483
  for branch in active_branches:
@@ -549,9 +549,8 @@ class MigrationManager:
549
549
 
550
550
  patch_branches = [b['name'] for b in branches_status.get('patch_branches', [])]
551
551
  release_branches = [b['name'] for b in branches_status.get('release_branches', [])]
552
- staged_branches = [b['name'] for b in branches_status.get('staged_branches', [])]
553
- # ho-prod first, then active branches
554
- all_branches = ['ho-prod'] + release_branches + patch_branches + staged_branches
552
+ # ho-staged/* branches are frozen after merge — excluded from module regeneration
553
+ all_branches = ['ho-prod'] + release_branches + patch_branches
555
554
 
556
555
  for branch in all_branches:
557
556
  try:
@@ -2768,13 +2768,17 @@ class ReleaseManager:
2768
2768
  print(f"Warning: Failed to delete release branch {release_branch}: {e}", file=sys.stderr)
2769
2769
 
2770
2770
  # Delete ho-staged/X branches for all patches that were in this release.
2771
- # These were created by merge_patch (renamed from ho-patch/X) and are no
2772
- # longer needed once the release reaches production.
2771
+ # At this point the X.Y.Z-patches.toml is already gone (replaced by
2772
+ # X.Y.Z.txt during production promotion), so we read the .txt file.
2773
2773
  version = release_branch.replace('ho-release/', '')
2774
- release_file = ReleaseFile(version, self._releases_dir)
2775
- if release_file.exists():
2776
- staged_patch_ids = release_file.get_patches(status="staged")
2777
- for patch_id in staged_patch_ids:
2774
+ prod_txt = Path(self._releases_dir) / f"{version}.txt"
2775
+ if prod_txt.exists():
2776
+ patch_ids = [
2777
+ line.strip()
2778
+ for line in prod_txt.read_text(encoding='utf-8').splitlines()
2779
+ if line.strip()
2780
+ ]
2781
+ for patch_id in patch_ids:
2778
2782
  staged_branch = f"ho-staged/{patch_id}"
2779
2783
  try:
2780
2784
  if self._repo.hgit.branch_exists(staged_branch):
@@ -2786,6 +2790,49 @@ class ReleaseManager:
2786
2790
 
2787
2791
  return deleted_branches
2788
2792
 
2793
+ def cleanup_orphaned_staged_branches(self) -> list:
2794
+ """Delete every ho-staged/* branch whose patch ID is in any .txt release file.
2795
+
2796
+ A ho-staged/* branch is orphaned when its release has been promoted to
2797
+ production (the patch ID appears in a X.Y.Z.txt file) but the branch
2798
+ was never cleaned up — e.g. due to an interrupted promotion.
2799
+
2800
+ Returns:
2801
+ List of deleted branch names.
2802
+ """
2803
+ releases_dir = Path(self._releases_dir)
2804
+ git_repo = self._repo.hgit._HGit__git_repo
2805
+
2806
+ # Collect all patch IDs that are in production (.txt files)
2807
+ prod_patch_ids: set = set()
2808
+ for txt_file in releases_dir.glob("*.txt"):
2809
+ for line in txt_file.read_text(encoding='utf-8').splitlines():
2810
+ patch_id = line.strip()
2811
+ if patch_id:
2812
+ prod_patch_ids.add(patch_id)
2813
+
2814
+ if not prod_patch_ids:
2815
+ return []
2816
+
2817
+ deleted = []
2818
+ for branch in list(git_repo.branches):
2819
+ if not branch.name.startswith('ho-staged/'):
2820
+ continue
2821
+ patch_id = branch.name[len('ho-staged/'):]
2822
+ if patch_id not in prod_patch_ids:
2823
+ continue
2824
+ try:
2825
+ self._repo.hgit.delete_local_branch(branch.name)
2826
+ self._repo.hgit.delete_remote_branch(branch.name)
2827
+ deleted.append(branch.name)
2828
+ except Exception as e:
2829
+ print(
2830
+ f"Warning: Failed to delete orphaned {branch.name}: {e}",
2831
+ file=sys.stderr,
2832
+ )
2833
+
2834
+ return deleted
2835
+
2789
2836
  @with_dynamic_branch_lock(lambda self: "ho-prod")
2790
2837
  def promote_to_rc(self) -> dict:
2791
2838
  """
@@ -544,6 +544,14 @@ class Repo:
544
544
  result['migration_run'] = True
545
545
  result['errors'] = migration_result.get('errors', [])
546
546
 
547
+ # Clean up orphaned ho-staged/* branches (patch IDs in .txt = already in production)
548
+ if hasattr(self, 'release_manager'):
549
+ try:
550
+ deleted = self.release_manager.cleanup_orphaned_staged_branches()
551
+ result['orphaned_staged_deleted'] = deleted
552
+ except Exception:
553
+ result['orphaned_staged_deleted'] = []
554
+
547
555
  # Log success if not silent
548
556
  if not silent:
549
557
  if migration_result.get('migrations_applied'):
@@ -638,9 +646,8 @@ class Repo:
638
646
  patch_branches = [b['name'] for b in branches_status.get('patch_branches', [])]
639
647
  release_branches = [b['name'] for b in branches_status.get('release_branches', [])]
640
648
 
641
- # All branches = ho-prod + release branches + patch branches + staged branches
642
- staged_branches = [b['name'] for b in branches_status.get('staged_branches', [])]
643
- all_branches = ['ho-prod'] + release_branches + patch_branches + staged_branches
649
+ # ho-staged/* branches are frozen after merge excluded from sync
650
+ all_branches = ['ho-prod'] + release_branches + patch_branches
644
651
 
645
652
  # Filter release branches to avoid syncing to future versions
646
653
  # Extract version from source branch if it's a release branch
@@ -1520,28 +1527,8 @@ class Repo:
1520
1527
  result = repo.check_and_update(force_check=True)
1521
1528
  """
1522
1529
 
1523
- # Check cache (only if not forced and silent mode)
1524
- cache_file = Path(self.__base_dir) / '.git' / '.half_orm_check_cache'
1525
- cache_hit = False
1526
1530
 
1527
- if silent and not force_check and cache_file.exists():
1528
- try:
1529
- last_check = float(cache_file.read_text().strip())
1530
- # Check once per day (86400 seconds)
1531
- if time.time() - last_check < 86400:
1532
- cache_hit = True
1533
- return {
1534
- 'hooks': {'installed': False, 'action': 'skipped'},
1535
- 'branches': {},
1536
- 'cache_hit': True
1537
- }
1538
- except (ValueError, IOError):
1539
- pass
1540
-
1541
- # Perform checks
1542
- result = {
1543
- 'cache_hit': False
1544
- }
1531
+ result = {}
1545
1532
 
1546
1533
  # 0. Update ho-prod from remote and fetch all branches
1547
1534
  # This ensures we have the latest hop_version and branch status
@@ -1716,19 +1703,21 @@ class Repo:
1716
1703
 
1717
1704
  result['stale_branches'] = stale_branches_result
1718
1705
 
1706
+ # 3b. Delete orphaned ho-staged/* branches (patch in a .txt = already in production)
1707
+ orphaned_staged_deleted = []
1708
+ if not dry_run and hasattr(self, 'release_manager'):
1709
+ try:
1710
+ orphaned_staged_deleted = self.release_manager.cleanup_orphaned_staged_branches()
1711
+ except Exception:
1712
+ pass # Best effort
1713
+ result['orphaned_staged_deleted'] = orphaned_staged_deleted
1714
+
1719
1715
  # 4. Check version (only for explicit checks, not silent)
1720
1716
  if not silent:
1721
1717
  result['version'] = self._check_version_update()
1722
1718
  else:
1723
1719
  result['version'] = None
1724
1720
 
1725
- # Update cache
1726
- if not dry_run and silent:
1727
- try:
1728
- cache_file.write_text(str(time.time()))
1729
- except IOError:
1730
- pass # Best effort
1731
-
1732
1721
  return result
1733
1722
 
1734
1723
  def _validate_package_name(self, package_name):
@@ -0,0 +1 @@
1
+ 1.0.0-a9
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: half_orm_dev
3
- Version: 1.0.0a8
3
+ Version: 1.0.0a9
4
4
  Summary: half_orm development Framework.
5
5
  Author-email: Joël Maïzi <joel.maizi@collorg.org>
6
6
  License-Expression: GPL-3.0-or-later
@@ -1 +0,0 @@
1
- 1.0.0-a8
File without changes
File without changes
File without changes
File without changes
File without changes