half-orm-dev 0.17.2a10__py3-none-any.whl → 0.17.2a11__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.
- half_orm_dev/cli/commands/migrate.py +31 -41
- half_orm_dev/cli/main.py +3 -19
- half_orm_dev/cli_extension.py +2 -2
- half_orm_dev/hgit.py +4 -0
- half_orm_dev/repo.py +3 -3
- half_orm_dev/version.txt +1 -1
- {half_orm_dev-0.17.2a10.dist-info → half_orm_dev-0.17.2a11.dist-info}/METADATA +1 -1
- {half_orm_dev-0.17.2a10.dist-info → half_orm_dev-0.17.2a11.dist-info}/RECORD +12 -12
- {half_orm_dev-0.17.2a10.dist-info → half_orm_dev-0.17.2a11.dist-info}/WHEEL +0 -0
- {half_orm_dev-0.17.2a10.dist-info → half_orm_dev-0.17.2a11.dist-info}/licenses/AUTHORS +0 -0
- {half_orm_dev-0.17.2a10.dist-info → half_orm_dev-0.17.2a11.dist-info}/licenses/LICENSE +0 -0
- {half_orm_dev-0.17.2a10.dist-info → half_orm_dev-0.17.2a11.dist-info}/top_level.txt +0 -0
|
@@ -27,6 +27,7 @@ def migrate(verbose: bool) -> None:
|
|
|
27
27
|
• Must be on ho-prod branch
|
|
28
28
|
• Repository must be clean (no uncommitted changes)
|
|
29
29
|
|
|
30
|
+
\b
|
|
30
31
|
Process:
|
|
31
32
|
1. Detects version mismatch between installed half_orm_dev and repository
|
|
32
33
|
2. Applies any migration scripts for intermediate versions
|
|
@@ -34,6 +35,7 @@ def migrate(verbose: bool) -> None:
|
|
|
34
35
|
4. Creates migration commit on ho-prod
|
|
35
36
|
5. Syncs .hop/ directory to all active branches
|
|
36
37
|
|
|
38
|
+
\b
|
|
37
39
|
Examples:
|
|
38
40
|
# After upgrading half_orm_dev
|
|
39
41
|
$ pip install --upgrade half_orm_dev
|
|
@@ -41,11 +43,13 @@ def migrate(verbose: bool) -> None:
|
|
|
41
43
|
⚠️ Migration needed: half_orm_dev 0.17.2 → 0.18.0
|
|
42
44
|
Current branch: ho-prod
|
|
43
45
|
|
|
46
|
+
\b
|
|
44
47
|
Running migrations...
|
|
45
48
|
✓ Applied migration: 0.17.2 → 0.18.0
|
|
46
49
|
✓ Updated .hop/config: hop_version = 0.18.0
|
|
47
50
|
✓ Synced .hop/ to active branches
|
|
48
51
|
|
|
52
|
+
\b
|
|
49
53
|
# View detailed migration info
|
|
50
54
|
$ half_orm dev migrate --verbose
|
|
51
55
|
"""
|
|
@@ -62,25 +66,6 @@ def migrate(verbose: bool) -> None:
|
|
|
62
66
|
installed_version = hop_version()
|
|
63
67
|
config_version = repo._Repo__config.hop_version if hasattr(repo, '_Repo__config') else '0.0.0'
|
|
64
68
|
|
|
65
|
-
# Check if migration is needed
|
|
66
|
-
comparison = repo.compare_versions(installed_version, config_version)
|
|
67
|
-
|
|
68
|
-
if comparison == 0:
|
|
69
|
-
# Versions are equal - no migration needed
|
|
70
|
-
click.echo(f"✓ {utils.Color.green('Repository is up to date')}")
|
|
71
|
-
click.echo(f" Repository version: {config_version}")
|
|
72
|
-
click.echo(f" Installed version: {installed_version}")
|
|
73
|
-
return
|
|
74
|
-
|
|
75
|
-
elif comparison < 0:
|
|
76
|
-
# Installed version is OLDER than repository version
|
|
77
|
-
click.echo(f"⚠️ {utils.Color.red('Installed half_orm_dev is older than repository version')}", err=True)
|
|
78
|
-
click.echo(f"\n Repository version: {config_version}", err=True)
|
|
79
|
-
click.echo(f" Installed version: {installed_version}", err=True)
|
|
80
|
-
click.echo(f"\n Please upgrade half_orm_dev:", err=True)
|
|
81
|
-
click.echo(f" pip install --upgrade half_orm_dev\n", err=True)
|
|
82
|
-
raise click.Abort()
|
|
83
|
-
|
|
84
69
|
# Migration needed (comparison > 0)
|
|
85
70
|
click.echo(f"⚠️ {utils.Color.bold('Migration needed:')}")
|
|
86
71
|
click.echo(f" half_orm_dev {config_version} → {installed_version}")
|
|
@@ -90,29 +75,34 @@ def migrate(verbose: bool) -> None:
|
|
|
90
75
|
click.echo(f" Current branch: {current_branch}")
|
|
91
76
|
click.echo()
|
|
92
77
|
|
|
93
|
-
# Run migrations
|
|
94
|
-
click.echo(f" Running migrations...")
|
|
95
|
-
|
|
96
|
-
try:
|
|
97
|
-
result = repo.run_migrations_if_needed(silent=False)
|
|
98
|
-
|
|
99
|
-
if result['migration_run']:
|
|
100
|
-
click.echo(f"\n✓ {utils.Color.green('Migration completed successfully')}")
|
|
101
|
-
click.echo(f" Updated .hop/config: hop_version = {installed_version}")
|
|
102
78
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
click.echo(f"
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
79
|
+
# Run migrations
|
|
80
|
+
if not click.confirm("Do you want to proceed?", default=False):
|
|
81
|
+
click.echo()
|
|
82
|
+
click.echo("If you want to revert half_orm_dev run:")
|
|
83
|
+
click.echo(f" pip install half-orm-dev=={config_version}")
|
|
84
|
+
else:
|
|
85
|
+
try:
|
|
86
|
+
click.echo(f" Running migrations...")
|
|
87
|
+
result = repo.run_migrations_if_needed(silent=False)
|
|
88
|
+
|
|
89
|
+
if result['migration_run']:
|
|
90
|
+
click.echo(f"\n✓ {utils.Color.green('Migration completed successfully')}")
|
|
91
|
+
click.echo(f" Updated .hop/config: hop_version = {installed_version}")
|
|
92
|
+
|
|
93
|
+
if verbose and result.get('errors'):
|
|
94
|
+
click.echo(f"\n⚠️ Warnings during migration:")
|
|
95
|
+
for error in result['errors']:
|
|
96
|
+
click.echo(f" • {error}")
|
|
97
|
+
|
|
98
|
+
click.echo(f"\n✓ Synced .hop/ to active branches")
|
|
99
|
+
else:
|
|
100
|
+
click.echo(f"✓ {utils.Color.green('Repository is up to date')}")
|
|
101
|
+
|
|
102
|
+
except RepoError as e:
|
|
103
|
+
# Migration failed or branch check failed
|
|
104
|
+
click.echo(utils.Color.red(f"\n❌ {e}"), err=True)
|
|
105
|
+
raise click.Abort()
|
|
116
106
|
|
|
117
107
|
except RepoError as e:
|
|
118
108
|
click.echo(utils.Color.red(f"❌ Error: {e}"), err=True)
|
half_orm_dev/cli/main.py
CHANGED
|
@@ -4,6 +4,7 @@ Main CLI module - Creates and configures the CLI group
|
|
|
4
4
|
|
|
5
5
|
import click
|
|
6
6
|
import functools
|
|
7
|
+
import sys
|
|
7
8
|
from half_orm_dev.repo import Repo, OutdatedHalfORMDevError
|
|
8
9
|
from half_orm import utils
|
|
9
10
|
from .commands import ALL_COMMANDS
|
|
@@ -118,8 +119,9 @@ def create_cli_group():
|
|
|
118
119
|
click.echo(f"\n Your installed version is OLDER than the repository requirement.", err=True)
|
|
119
120
|
click.echo(f" All commands are blocked for safety.", err=True)
|
|
120
121
|
click.echo(f"\n Please upgrade half_orm_dev:", err=True)
|
|
121
|
-
click.echo(f" {utils.Color.bold('pip install --upgrade half_orm_dev')}", err=True)
|
|
122
|
+
click.echo(f" {utils.Color.bold(f'pip install --upgrade half_orm_dev=={error.required_version}')}", err=True)
|
|
122
123
|
click.echo("\n" + "=" * 70 + "\n", err=True)
|
|
124
|
+
sys.exit(1)
|
|
123
125
|
raise click.Abort()
|
|
124
126
|
return f(*args, **kwargs)
|
|
125
127
|
return wrapper
|
|
@@ -132,24 +134,6 @@ def create_cli_group():
|
|
|
132
134
|
cmd.callback = check_version_before_invoke(cmd.callback)
|
|
133
135
|
super().add_command(cmd, name)
|
|
134
136
|
|
|
135
|
-
def resolve_command(self, ctx, args):
|
|
136
|
-
"""Override to show available commands when command not found."""
|
|
137
|
-
try:
|
|
138
|
-
return super().resolve_command(ctx, args)
|
|
139
|
-
except click.UsageError as e:
|
|
140
|
-
if 'No such command' in str(e):
|
|
141
|
-
# Command not found - show available commands
|
|
142
|
-
click.echo(f"\n❌ {str(e)}", err=True)
|
|
143
|
-
click.echo(f"\n{utils.Color.bold('Available commands:')}")
|
|
144
|
-
for cmd_name in hop.available_commands:
|
|
145
|
-
cmd = self.commands.get(cmd_name)
|
|
146
|
-
if cmd:
|
|
147
|
-
help_text = cmd.help or cmd.short_help or ""
|
|
148
|
-
first_line = help_text.split('\n')[0] if help_text else ""
|
|
149
|
-
click.echo(f" • {utils.Color.bold(cmd_name)}: {first_line}")
|
|
150
|
-
click.echo(f"\nTry {utils.Color.bold('half_orm dev <command> --help')} for more information.\n")
|
|
151
|
-
raise
|
|
152
|
-
|
|
153
137
|
@click.group(cls=VersionCheckGroup, invoke_without_command=True)
|
|
154
138
|
@click.pass_context
|
|
155
139
|
@check_version_before_invoke
|
half_orm_dev/cli_extension.py
CHANGED
|
@@ -9,7 +9,7 @@ Generates/Patches/Synchronizes a hop Python package with a PostgreSQL database.
|
|
|
9
9
|
"""
|
|
10
10
|
|
|
11
11
|
import sys
|
|
12
|
-
from half_orm.
|
|
12
|
+
from half_orm.cli import CustomGroup
|
|
13
13
|
from .cli import create_cli_group
|
|
14
14
|
|
|
15
15
|
|
|
@@ -25,7 +25,7 @@ def add_commands(main_group):
|
|
|
25
25
|
dev_group = create_cli_group()
|
|
26
26
|
|
|
27
27
|
# Register it as an extension
|
|
28
|
-
@
|
|
28
|
+
@main_group.group(name='dev', cls=CustomGroup)
|
|
29
29
|
def dev():
|
|
30
30
|
"""halfORM development tools - project management, patches, and database synchronization"""
|
|
31
31
|
pass
|
half_orm_dev/hgit.py
CHANGED
|
@@ -113,6 +113,10 @@ class HGit:
|
|
|
113
113
|
f'Something went wrong initializing git repo in {base_dir}\n{err}\n', exit_code=1)
|
|
114
114
|
return self
|
|
115
115
|
|
|
116
|
+
@property
|
|
117
|
+
def git_repo(self):
|
|
118
|
+
return self.__git_repo
|
|
119
|
+
|
|
116
120
|
@property
|
|
117
121
|
def branch(self):
|
|
118
122
|
"Returns the active branch"
|
half_orm_dev/repo.py
CHANGED
|
@@ -452,7 +452,7 @@ class Repo:
|
|
|
452
452
|
|
|
453
453
|
if not self.hgit or self.hgit.branch != 'ho-prod':
|
|
454
454
|
# Check if working directory is clean
|
|
455
|
-
if self.hgit and self.hgit.
|
|
455
|
+
if self.hgit and self.hgit.git_repo.is_dirty(untracked_files=False):
|
|
456
456
|
config_version = self.__config.hop_version if hasattr(self, '_Repo__config') else '0.0.0'
|
|
457
457
|
raise RepoError(
|
|
458
458
|
f"Repository migration required but working directory has uncommitted changes.\n\n"
|
|
@@ -761,7 +761,7 @@ class Repo:
|
|
|
761
761
|
current_branch = None
|
|
762
762
|
git_repo = None
|
|
763
763
|
try:
|
|
764
|
-
git_repo = self.hgit.
|
|
764
|
+
git_repo = self.hgit.git_repo
|
|
765
765
|
current_branch = git_repo.active_branch.name
|
|
766
766
|
|
|
767
767
|
# Check if working directory is clean
|
|
@@ -1429,7 +1429,7 @@ class Repo:
|
|
|
1429
1429
|
current_branch = None
|
|
1430
1430
|
git_repo = None
|
|
1431
1431
|
try:
|
|
1432
|
-
git_repo = self.hgit.
|
|
1432
|
+
git_repo = self.hgit.git_repo
|
|
1433
1433
|
current_branch = git_repo.active_branch.name
|
|
1434
1434
|
|
|
1435
1435
|
# Check if working directory is clean (only in non-silent mode)
|
half_orm_dev/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.17.2-
|
|
1
|
+
0.17.2-a11
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
half_orm_dev/__init__.py,sha256=0JpUPey1gacxXuIFGcpD2nTGso73fkak72qzTHttAJk,18
|
|
2
|
-
half_orm_dev/cli_extension.py,sha256=
|
|
2
|
+
half_orm_dev/cli_extension.py,sha256=kwX3M11_rwr0pFcqHK_bpI3Pp4ztfTCVz2gLfTmzfeA,1066
|
|
3
3
|
half_orm_dev/database.py,sha256=kQKdkGXXxIvGxKAh01AFOMBLC7NETsJ981qWbD8m7Ho,59994
|
|
4
4
|
half_orm_dev/decorators.py,sha256=JKv_Z_JZUr-s-Vz551temHZhhecPfbvyhTbByRDjVAQ,4901
|
|
5
|
-
half_orm_dev/hgit.py,sha256=
|
|
5
|
+
half_orm_dev/hgit.py,sha256=VdzCCQ__xG1IGJaGq4-rrhbA1bNkDw_dBqkUNIeTONg,58045
|
|
6
6
|
half_orm_dev/migration_manager.py,sha256=9RpciH8nyQrF0xV31kAeaYKkQl24Di1VHt-mAjjHhzM,14854
|
|
7
7
|
half_orm_dev/modules.py,sha256=4jfVb2yboRgb9mcO0sMF-iLigcZFTHEm4VRLN6GQXM4,16796
|
|
8
8
|
half_orm_dev/patch_manager.py,sha256=0GwixfNbzpRMtmUKPazlXn-IESSw_KR6S0qLOy02KKY,100970
|
|
9
9
|
half_orm_dev/patch_validator.py,sha256=QNe1L6k_xwsnrOTcb3vkW2D0LbqrCRcZOGPnVyspVRk,10871
|
|
10
10
|
half_orm_dev/release_file.py,sha256=s-f4ITbZGBzQ5cS1oIp516bCQJQylXON31A615ghIQE,9877
|
|
11
11
|
half_orm_dev/release_manager.py,sha256=W51XzQoiq3UUW9E1mcodUGkxfoTBvz3vXhjBv2mrKag,113286
|
|
12
|
-
half_orm_dev/repo.py,sha256=
|
|
12
|
+
half_orm_dev/repo.py,sha256=8KNub5A9g9DLpl-bNfh6sNBGFZKh8OaS89aukP3X93s,94967
|
|
13
13
|
half_orm_dev/utils.py,sha256=M3yViUFfsO7Cp9MYSoUSkCZ6R9w_4jW45UDZUOT8FhI,1493
|
|
14
|
-
half_orm_dev/version.txt,sha256=
|
|
14
|
+
half_orm_dev/version.txt,sha256=4mNSLHYRTp9iUn9eZqhRqo01PuD3V05YkTxEd5lgjrg,11
|
|
15
15
|
half_orm_dev/cli/__init__.py,sha256=0CbMj8OIhZmglWakK7NhYPn302erUTEg2VHOdm1hRTQ,163
|
|
16
|
-
half_orm_dev/cli/main.py,sha256=
|
|
16
|
+
half_orm_dev/cli/main.py,sha256=cECdUUPexx2vUeCipPnknjq_HmMjdVRwhMxz7A08S8s,11709
|
|
17
17
|
half_orm_dev/cli/commands/__init__.py,sha256=UhWf0AnWqy4gyFo2SJQv8pL_YJ43pE_c9TgopcjzKDg,1490
|
|
18
18
|
half_orm_dev/cli/commands/apply.py,sha256=6Sne5T6DQlPmHzY_9XR6srjAQnDNguB-jbA2IEDnzCk,211
|
|
19
19
|
half_orm_dev/cli/commands/check.py,sha256=UJHGCtrlBz6Gkw1PznuO09__TzQGxR94bDnrH_542AQ,18624
|
|
20
20
|
half_orm_dev/cli/commands/clone.py,sha256=JUDDt-vz_WvGkm5HDFuZ3KZbclLyPaE4h665n8QfEEQ,3989
|
|
21
21
|
half_orm_dev/cli/commands/init.py,sha256=M-iAiBlXkzPHk8eMwXGgq9EfTvMLp9R1q5A5VCQBJ5Q,12549
|
|
22
|
-
half_orm_dev/cli/commands/migrate.py,sha256=
|
|
22
|
+
half_orm_dev/cli/commands/migrate.py,sha256=iEz3DoFX22WwaYDo_WUKaF-pFohaLWoUrDmdLCin2wc,4047
|
|
23
23
|
half_orm_dev/cli/commands/patch.py,sha256=DxFumf_om56nFmgba8_sc_mgU1L6DErqoMiA1vz1320,12784
|
|
24
24
|
half_orm_dev/cli/commands/release.py,sha256=v5dI9ol0phSCKuRVW-bgqkP4w8obq6mlTza3_2Qf0v0,14565
|
|
25
25
|
half_orm_dev/cli/commands/restore.py,sha256=n9SP8n1EQUduvDoA0qxpSUQpphc48X-NovnocyGl98I,236
|
|
@@ -50,9 +50,9 @@ half_orm_dev/templates/sql_adapter,sha256=kAP5y7Qml3DKsbZLUeoVpeXjbQcWltHjkDznED
|
|
|
50
50
|
half_orm_dev/templates/warning,sha256=4hlZ_rRdpmkXxOeRoVd9xnXBARYXn95e-iXrD1f2u7k,490
|
|
51
51
|
half_orm_dev/templates/git-hooks/pre-commit,sha256=-MIAQU3kujzkO8fKcRl7sk-qzbmUsNQJsP005ToUQi8,4592
|
|
52
52
|
half_orm_dev/templates/git-hooks/prepare-commit-msg,sha256=zknOGGoaWKC97zfga2Xl2i_psnNo9MJbrEBuN91eHNw,1070
|
|
53
|
-
half_orm_dev-0.17.
|
|
54
|
-
half_orm_dev-0.17.
|
|
55
|
-
half_orm_dev-0.17.
|
|
56
|
-
half_orm_dev-0.17.
|
|
57
|
-
half_orm_dev-0.17.
|
|
58
|
-
half_orm_dev-0.17.
|
|
53
|
+
half_orm_dev-0.17.2a11.dist-info/licenses/AUTHORS,sha256=eWxqzRdLOt2gX0FMQj_wui03Od3jdlwa8xNe9tl84g0,113
|
|
54
|
+
half_orm_dev-0.17.2a11.dist-info/licenses/LICENSE,sha256=ufhxlSi6mttkGQTsGWrEoB3WA_fCPJ6-k07GSVBgyPw,644
|
|
55
|
+
half_orm_dev-0.17.2a11.dist-info/METADATA,sha256=g7q_mJiSXAC06fy1NjSd4MKm3jqZ_45vzmXqlhZYjmA,41867
|
|
56
|
+
half_orm_dev-0.17.2a11.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
57
|
+
half_orm_dev-0.17.2a11.dist-info/top_level.txt,sha256=M5hEsWfn5Kw0HL-VnNmS6Jw-3cwRyjims5a8cr18eTM,13
|
|
58
|
+
half_orm_dev-0.17.2a11.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|