otoolbox 0.7.0__tar.gz → 0.7.3__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 (153) hide show
  1. {otoolbox-0.7.0 → otoolbox-0.7.3}/.vscode/launch.json +1 -1
  2. {otoolbox-0.7.0/src/otoolbox.egg-info → otoolbox-0.7.3}/PKG-INFO +1 -1
  3. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/__init__.py +9 -7
  4. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/logger/__init__.py +1 -0
  5. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/repositories/config.py +2 -4
  6. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/repositories/git.py +66 -41
  7. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/unitest/__init__.py +1 -1
  8. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/vscode/__init__.py +0 -1
  9. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/vscode/odoo_conf.py +1 -0
  10. {otoolbox-0.7.0 → otoolbox-0.7.3/src/otoolbox.egg-info}/PKG-INFO +1 -1
  11. {otoolbox-0.7.0 → otoolbox-0.7.3}/.coveragerc +0 -0
  12. {otoolbox-0.7.0 → otoolbox-0.7.3}/.github/workflows/python-package.yml +0 -0
  13. {otoolbox-0.7.0 → otoolbox-0.7.3}/.github/workflows/python-publish.yml +0 -0
  14. {otoolbox-0.7.0 → otoolbox-0.7.3}/.gitignore +0 -0
  15. {otoolbox-0.7.0 → otoolbox-0.7.3}/.logs.txt +0 -0
  16. {otoolbox-0.7.0 → otoolbox-0.7.3}/.pre-commit-config.yaml +0 -0
  17. {otoolbox-0.7.0 → otoolbox-0.7.3}/.pylintrc +0 -0
  18. {otoolbox-0.7.0 → otoolbox-0.7.3}/.pylintrc-mandatory +0 -0
  19. {otoolbox-0.7.0 → otoolbox-0.7.3}/.readthedocs.yml +0 -0
  20. {otoolbox-0.7.0 → otoolbox-0.7.3}/.vscode/otoolbox_debug_runner.py +0 -0
  21. {otoolbox-0.7.0 → otoolbox-0.7.3}/.vscode/settings.json +0 -0
  22. {otoolbox-0.7.0 → otoolbox-0.7.3}/.vscode/tasks.json +0 -0
  23. {otoolbox-0.7.0 → otoolbox-0.7.3}/AUTHORS.rst +0 -0
  24. {otoolbox-0.7.0 → otoolbox-0.7.3}/CHANGELOG.rst +0 -0
  25. {otoolbox-0.7.0 → otoolbox-0.7.3}/CONTRIBUTING.rst +0 -0
  26. {otoolbox-0.7.0 → otoolbox-0.7.3}/LICENSE +0 -0
  27. {otoolbox-0.7.0 → otoolbox-0.7.3}/LICENSE.txt +0 -0
  28. {otoolbox-0.7.0 → otoolbox-0.7.3}/README.rst +0 -0
  29. {otoolbox-0.7.0 → otoolbox-0.7.3}/bin/customer-common +0 -0
  30. {otoolbox-0.7.0 → otoolbox-0.7.3}/bin/customer-config +0 -0
  31. {otoolbox-0.7.0 → otoolbox-0.7.3}/bin/customer-info +0 -0
  32. {otoolbox-0.7.0 → otoolbox-0.7.3}/bin/customer-init +0 -0
  33. {otoolbox-0.7.0 → otoolbox-0.7.3}/bin/customer-shell +0 -0
  34. {otoolbox-0.7.0 → otoolbox-0.7.3}/bin/customer-update +0 -0
  35. {otoolbox-0.7.0 → otoolbox-0.7.3}/bin/customer-update-submodule +0 -0
  36. {otoolbox-0.7.0 → otoolbox-0.7.3}/bin/otoolbox-commit +0 -0
  37. {otoolbox-0.7.0 → otoolbox-0.7.3}/bin/otoolbox-common +0 -0
  38. {otoolbox-0.7.0 → otoolbox-0.7.3}/bin/otoolbox-doctor +0 -0
  39. {otoolbox-0.7.0 → otoolbox-0.7.3}/bin/otoolbox-doctor.bat +0 -0
  40. {otoolbox-0.7.0 → otoolbox-0.7.3}/bin/otoolbox-init-tests +0 -0
  41. {otoolbox-0.7.0 → otoolbox-0.7.3}/bin/otoolbox-pre-commit +0 -0
  42. {otoolbox-0.7.0 → otoolbox-0.7.3}/bin/otoolbox-pull +0 -0
  43. {otoolbox-0.7.0 → otoolbox-0.7.3}/bin/otoolbox-push +0 -0
  44. {otoolbox-0.7.0 → otoolbox-0.7.3}/bin/otoolbox-push-shielded +0 -0
  45. {otoolbox-0.7.0 → otoolbox-0.7.3}/bin/otoolbox-repo-add-all +0 -0
  46. {otoolbox-0.7.0 → otoolbox-0.7.3}/bin/otoolbox-repo-init +0 -0
  47. {otoolbox-0.7.0 → otoolbox-0.7.3}/bin/otoolbox-sync-shielded +0 -0
  48. {otoolbox-0.7.0 → otoolbox-0.7.3}/bin/otoolbox-tests-by-repo +0 -0
  49. {otoolbox-0.7.0 → otoolbox-0.7.3}/docs/Makefile +0 -0
  50. {otoolbox-0.7.0 → otoolbox-0.7.3}/docs/_static/.gitignore +0 -0
  51. {otoolbox-0.7.0 → otoolbox-0.7.3}/docs/authors.rst +0 -0
  52. {otoolbox-0.7.0 → otoolbox-0.7.3}/docs/changelog.rst +0 -0
  53. {otoolbox-0.7.0 → otoolbox-0.7.3}/docs/conf.py +0 -0
  54. {otoolbox-0.7.0 → otoolbox-0.7.3}/docs/contributing.rst +0 -0
  55. {otoolbox-0.7.0 → otoolbox-0.7.3}/docs/help-repo.txt +0 -0
  56. {otoolbox-0.7.0 → otoolbox-0.7.3}/docs/index.rst +0 -0
  57. {otoolbox-0.7.0 → otoolbox-0.7.3}/docs/license.rst +0 -0
  58. {otoolbox-0.7.0 → otoolbox-0.7.3}/docs/readme.rst +0 -0
  59. {otoolbox-0.7.0 → otoolbox-0.7.3}/docs/requirements.txt +0 -0
  60. {otoolbox-0.7.0 → otoolbox-0.7.3}/pyproject.toml +0 -0
  61. {otoolbox-0.7.0 → otoolbox-0.7.3}/setup.cfg +0 -0
  62. {otoolbox-0.7.0 → otoolbox-0.7.3}/setup.py +0 -0
  63. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/__init__.py +0 -0
  64. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/addons/README.rst +0 -0
  65. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/addons/__init__.py +0 -0
  66. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/addons/config.py +0 -0
  67. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/addons/constants.py +0 -0
  68. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/copilot/README.rst +0 -0
  69. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/copilot/__init__.py +0 -0
  70. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/copilot/copilot_utils.py +0 -0
  71. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/copilot/data/agents/Odoo_17_Backend.agent.md +0 -0
  72. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/copilot/data/agents/Odoo_18_Backend.agent.md +0 -0
  73. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/copilot/data/agents/Odoo_19_Backend.agent.md +0 -0
  74. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/copilot/data/copilot-instructions.md +0 -0
  75. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/docker/README.rst +0 -0
  76. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/docker/docker-compose.yml +0 -0
  77. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/help/README.rst +0 -0
  78. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/help/__init__.py +0 -0
  79. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/help/data/README.rst +0 -0
  80. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/help/data/docs/00-file-and-folders.md +0 -0
  81. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/help/data/docs/01-global-style.md +0 -0
  82. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/help/data/docs/02-odoo-patterns.md +0 -0
  83. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/help/data/docs/03-testing-and-validation.md +0 -0
  84. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/help/data/docs/04-security-and-secrets.md +0 -0
  85. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/help/data/docs/05-oca-contributing-reference.md +0 -0
  86. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/help/data/docs/06-odoo-test-framework-guid.md +0 -0
  87. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/help/data/docs/07-odoonix-guidline.md +0 -0
  88. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/help/data/docs/08-copilot-instructions-guideline.md +0 -0
  89. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/help/data/docs/09-team-playbook.md +0 -0
  90. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/help/help_utils.py +0 -0
  91. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/logger/README.rst +0 -0
  92. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/repositories/README.rst +0 -0
  93. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/repositories/__init__.py +0 -0
  94. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/repositories/constants.py +0 -0
  95. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/repositories/data/repositories.csv +0 -0
  96. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/repositories/data/repositories.json +0 -0
  97. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/repositories/display.py +0 -0
  98. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/repositories/util.py +0 -0
  99. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/ubuntu/README.rst +0 -0
  100. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/ubuntu/__init__.py +0 -0
  101. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/ubuntu/bin/bulk-add-repos +0 -0
  102. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/ubuntu/bin/bulk-commit +0 -0
  103. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/ubuntu/bin/bulk-common +0 -0
  104. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/ubuntu/bin/bulk-init-tests +0 -0
  105. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/ubuntu/bin/bulk-pre-commit +0 -0
  106. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/ubuntu/bin/bulk-pull +0 -0
  107. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/ubuntu/bin/bulk-push +0 -0
  108. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/ubuntu/bin/bulk-push-shielded +0 -0
  109. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/ubuntu/bin/bulk-repo-add-all +0 -0
  110. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/ubuntu/bin/bulk-repo-init +0 -0
  111. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/ubuntu/bin/bulk-sync-shielded +0 -0
  112. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/ubuntu/bin/bulk-tests-by-repo +0 -0
  113. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/ubuntu/bin/customer-common +0 -0
  114. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/ubuntu/bin/customer-config +0 -0
  115. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/ubuntu/bin/customer-info +0 -0
  116. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/ubuntu/bin/customer-init +0 -0
  117. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/ubuntu/bin/customer-shell +0 -0
  118. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/ubuntu/bin/customer-update +0 -0
  119. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/ubuntu/bin/customer-update-submodule +0 -0
  120. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/ubuntu/bin/ubuntu-install-apps +0 -0
  121. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/ubuntu/bin/ubuntu-office-conf +0 -0
  122. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/unitest/data/ODOO_TEST_FRAMEWORK_GUIDE.md +0 -0
  123. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/unitest/data/conftest.py +0 -0
  124. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/unitest/data/pytest.ini +0 -0
  125. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/unitest/unitest_utils.py +0 -0
  126. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/vscode/README.rst +0 -0
  127. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/vscode/data/odools.toml +0 -0
  128. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/vscode/data/requirements.txt +0 -0
  129. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/vscode/data/workspace.json +0 -0
  130. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/vscode/dev_env.py +0 -0
  131. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/vscode/extensions.py +0 -0
  132. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/vscode/odools_conf.py +0 -0
  133. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/workspace/README.rst +0 -0
  134. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/addons/workspace/__init__.py +0 -0
  135. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/banner.txt +0 -0
  136. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/base.py +0 -0
  137. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/constants.py +0 -0
  138. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/environment.py +0 -0
  139. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox/utils.py +0 -0
  140. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox.egg-info/SOURCES.txt +0 -0
  141. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox.egg-info/dependency_links.txt +0 -0
  142. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox.egg-info/entry_points.txt +0 -0
  143. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox.egg-info/not-zip-safe +0 -0
  144. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox.egg-info/requires.txt +0 -0
  145. {otoolbox-0.7.0 → otoolbox-0.7.3}/src/otoolbox.egg-info/top_level.txt +0 -0
  146. {otoolbox-0.7.0 → otoolbox-0.7.3}/tests/test_addons.py +0 -0
  147. {otoolbox-0.7.0 → otoolbox-0.7.3}/tests/test_conftest.py +0 -0
  148. {otoolbox-0.7.0 → otoolbox-0.7.3}/tests/test_copilot_utils.py +0 -0
  149. {otoolbox-0.7.0 → otoolbox-0.7.3}/tests/test_doctor_script_packaging.py +0 -0
  150. {otoolbox-0.7.0 → otoolbox-0.7.3}/tests/test_repositories_config.py +0 -0
  151. {otoolbox-0.7.0 → otoolbox-0.7.3}/tests/test_repositories_git.py +0 -0
  152. {otoolbox-0.7.0 → otoolbox-0.7.3}/tests/test_utils.py +0 -0
  153. {otoolbox-0.7.0 → otoolbox-0.7.3}/tox.ini +0 -0
@@ -30,7 +30,7 @@
30
30
  "repo list",
31
31
  "repo sync-shielded",
32
32
  "run init --tags 'odoonix/connector'",
33
- "repo add 'odoonix/sms'",
33
+ "repo add 'odoonix/social'",
34
34
  "repo add 'odoonix/product'",
35
35
  "repo add 'odoo/design-themes'",
36
36
  ],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: otoolbox
3
- Version: 0.7.0
3
+ Version: 0.7.3
4
4
  Summary: Utilities for Odoo from Odoonix
5
5
  Home-page: https://odoonix.com/apps/otoolbox
6
6
  Author: Odoonix
@@ -193,13 +193,15 @@ def command_run(
193
193
  Run step processors on resources which are filterd by tags.
194
194
  """
195
195
  tags = tags if isinstance(tags, List) else []
196
- env.context.update({
197
- "tags": tags,
198
- "step": steps,
199
- "ssh_auth": ssh_auth,
200
- "git_repositories_policy": git_repositories_policy,
201
- "git_repositories_root": git_repositories_root
202
- })
196
+ env.context.update(
197
+ {
198
+ "tags": tags,
199
+ "step": steps,
200
+ "ssh_auth": ssh_auth,
201
+ "git_repositories_policy": git_repositories_policy,
202
+ "git_repositories_root": git_repositories_root,
203
+ }
204
+ )
203
205
 
204
206
  result = (
205
207
  env.resources.filter(lambda resource: resource.has_tag(*tags))
@@ -8,6 +8,7 @@ Resources:
8
8
 
9
9
  NOTE: logger must be configured via the .env or command line arguments
10
10
  """
11
+
11
12
  import os
12
13
  import logging
13
14
  import sys
@@ -43,7 +43,7 @@ def _add_repo_to_resources(item):
43
43
  "title": item.get("repository"),
44
44
  "description": """Automaticaly added resources from git.""",
45
45
  "init": [
46
- git.git_add_safe_directory,
46
+ git.git_add_safe_directory,
47
47
  git.git_clone,
48
48
  git.git_worktree_prune,
49
49
  git.git_worktree_create,
@@ -59,9 +59,7 @@ def _add_repo_to_resources(item):
59
59
  git.git_pull,
60
60
  utils.touch_dir,
61
61
  ],
62
- "destroy": [
63
- utils.delete_dir
64
- ],
62
+ "destroy": [utils.delete_dir],
65
63
  "verify": [
66
64
  utils.is_dir,
67
65
  utils.is_readable,
@@ -80,13 +80,13 @@ def _get_repo_path(context: Resource):
80
80
  repo_path = env.get_workspace_path(context.path)
81
81
  else:
82
82
  git_repositories_root = env.get_env_variable("GIT_REPOSITORIES_ROOT")
83
- assert git_repositories_root, "Root path of repositories is required set GIT_REPOSITORIES_ROOT"
84
- repo_path = env.get_workspace_path(
85
- git_repositories_root,
86
- context.path
87
- )
83
+ assert (
84
+ git_repositories_root
85
+ ), "Root path of repositories is required set GIT_REPOSITORIES_ROOT"
86
+ repo_path = env.get_workspace_path(git_repositories_root, context.path)
88
87
  return repo_path
89
88
 
89
+
90
90
  def _is_git_repository(repository_path):
91
91
  if not os.path.isdir(repository_path):
92
92
  return False
@@ -128,8 +128,28 @@ def _get_branch_name_from_path(path):
128
128
  )
129
129
  if result.returncode:
130
130
  raise RuntimeError(result.stderr)
131
- return next((line.strip() for line in result.stdout.splitlines() if line.strip()), "")
131
+ return next(
132
+ (line.strip() for line in result.stdout.splitlines() if line.strip()), ""
133
+ )
132
134
 
135
+ def _is_git_repository_main(repository_path):
136
+ if not os.path.isdir(repository_path):
137
+ return False
138
+
139
+ git_path = os.path.join(repository_path, ".git")
140
+ if not os.path.isdir(git_path):
141
+ return False
142
+
143
+ try:
144
+ result = subprocess.run(
145
+ ["git", "-C", str(repository_path), "rev-parse", "--is-inside-work-tree"],
146
+ capture_output=True,
147
+ text=True,
148
+ check=True,
149
+ )
150
+ return result.stdout.strip() == "true"
151
+ except subprocess.CalledProcessError:
152
+ return False
133
153
 
134
154
  ######################################################################################
135
155
  # Resource Processors #
@@ -137,6 +157,7 @@ def _get_branch_name_from_path(path):
137
157
  # must be a git repository. #
138
158
  ######################################################################################
139
159
 
160
+
140
161
  def git_link_to_repositoires_root(context: Resource):
141
162
  # Get root path
142
163
  path_root = env.get_env_variable("GIT_REPOSITORIES_ROOT", "~/Repositories")
@@ -152,7 +173,12 @@ def git_link_to_repositoires_root(context: Resource):
152
173
  assert branch_name, "Branch name is required"
153
174
 
154
175
  # if repo_path is in path_root then return sucess
155
- if _is_path_in_root(repo_path, path_root):
176
+ c_repo_path = _get_repo_path(context)
177
+ if (
178
+ _is_path_in_root(c_repo_path, path_root)
179
+ and not _is_git_repository_main(repo_path)
180
+ and _is_git_repository_main(repository_root_path)
181
+ ):
156
182
  return PROCESS_SUCCESS, _get_branch_name(context=context)
157
183
 
158
184
  if not _is_git_repository(repo_path):
@@ -173,17 +199,23 @@ def git_link_to_repositoires_root(context: Resource):
173
199
  random_branch_name = _create_random_branch_name()
174
200
  _run_git(["checkout", "-B", random_branch_name], cwd=repository_root_path)
175
201
 
176
- context_path = env.get_workspace_path(context.path)
177
- if not _is_git_repository(context_path):
178
- _run_git(
179
- [
180
- "worktree",
181
- "add",
182
- context_path,
183
- f"origin/{branch_name}",
184
- ],
185
- cwd=repository_root_path,
186
- )
202
+ shutil.rmtree(repo_path)
203
+ _run_git(
204
+ [
205
+ "worktree",
206
+ "prune",
207
+ ],
208
+ cwd=repository_root_path,
209
+ )
210
+ _run_git(
211
+ [
212
+ "worktree",
213
+ "add",
214
+ repo_path,
215
+ f"origin/{branch_name}",
216
+ ],
217
+ cwd=repository_root_path,
218
+ )
187
219
 
188
220
  return PROCESS_SUCCESS, _get_branch_name(context=context)
189
221
 
@@ -193,22 +225,19 @@ def git_worktree_create(context: Resource):
193
225
  git_repository_policy = env.get_env_variable("GIT_REPOSITORIES_POLICY")
194
226
  assert git_repository_policy, "Policy is required"
195
227
  if git_repository_policy == "standalone":
196
- _logger.debug("Repository policy is standalone, using single worktree for each repo")
228
+ _logger.debug(
229
+ "Repository policy is standalone, using single worktree for each repo"
230
+ )
197
231
  return PROCESS_SUCCESS, _get_branch_name(context=context)
198
-
232
+
199
233
  # Load path (root repository and workspace)
200
234
  git_repositories_root = env.get_env_variable("GIT_REPOSITORIES_ROOT")
201
235
  assert git_repositories_root, "Policy is required"
202
- git_repository_root = env.get_workspace_path(
203
- git_repositories_root,
204
- context.path
205
- )
206
- context_path = env.get_workspace_path(
207
- context.path
208
- )
236
+ git_repository_root = env.get_workspace_path(git_repositories_root, context.path)
237
+ context_path = env.get_workspace_path(context.path)
209
238
 
210
- repo_path = _get_repo_path(context)
211
- context_pat = env.get_workspace_path(context.path)
239
+ # repo_path = _get_repo_path(context)
240
+ # context_pat = env.get_workspace_path(context.path)
212
241
 
213
242
  if _is_git_repository(context_path):
214
243
  return PROCESS_SUCCESS, _get_branch_name(context=context)
@@ -217,13 +246,13 @@ def git_worktree_create(context: Resource):
217
246
  )
218
247
  result = utils.call_process_safe(
219
248
  [
220
- GIT_COMMAND,
221
- "worktree",
249
+ GIT_COMMAND,
250
+ "worktree",
222
251
  "add",
223
- context_path, # repository path
224
- "origin/" + branch_name
252
+ context_path, # repository path
253
+ "origin/" + branch_name,
225
254
  ],
226
- cwd=git_repository_root, # root repository
255
+ cwd=git_repository_root, # root repository
227
256
  )
228
257
 
229
258
  if result.returncode:
@@ -235,11 +264,7 @@ def git_worktree_prune(context: Resource):
235
264
  """Remove a git worktree for the given branch."""
236
265
  cwd = _get_repo_path(context)
237
266
  result = utils.call_process_safe(
238
- [
239
- GIT_COMMAND,
240
- "worktree",
241
- "prune"
242
- ],
267
+ [GIT_COMMAND, "worktree", "prune"],
243
268
  cwd=cwd,
244
269
  )
245
270
 
@@ -255,7 +280,7 @@ def git_clone(context: Resource):
255
280
  if _is_git_repository(repo_path):
256
281
  _logger.debug("Repository exist")
257
282
  return PROCESS_SUCCESS, "Repository is ready, create a new worktree"
258
-
283
+
259
284
  # Clone
260
285
  folder = Path(repo_path)
261
286
  organization_path = folder.parent
@@ -265,7 +290,7 @@ def git_clone(context: Resource):
265
290
  [
266
291
  GIT_COMMAND,
267
292
  "clone",
268
- # Clone main branch.
293
+ # Clone main branch.
269
294
  # "--branch",
270
295
  # branch_name,
271
296
  (
@@ -13,7 +13,7 @@ Tags: unitest
13
13
 
14
14
  import typer
15
15
  import dotenv
16
-
16
+ import os
17
17
 
18
18
  from otoolbox import env
19
19
  from otoolbox import utils
@@ -13,7 +13,6 @@ ensuring a seamless development experience in Odoo projects.
13
13
 
14
14
  import subprocess
15
15
  import dotenv
16
-
17
16
  import typer
18
17
  # from typing_extensions import Annotated
19
18
 
@@ -1,4 +1,5 @@
1
1
  import json
2
+ import os
2
3
 
3
4
  from otoolbox import env
4
5
  from otoolbox.base import Resource
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: otoolbox
3
- Version: 0.7.0
3
+ Version: 0.7.3
4
4
  Summary: Utilities for Odoo from Odoonix
5
5
  Home-page: https://odoonix.com/apps/otoolbox
6
6
  Author: Odoonix
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes