Skip to content

Commit 7863b58

Browse files
committed
Merge PR #3 into 18.0
Signed-off-by etobella
2 parents f45f8f5 + f085daf commit 7863b58

139 files changed

Lines changed: 8793 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# generated from manifests external_dependencies
2+
GitPython
3+
github3.py
4+
markdown
5+
pathspec

vcp_git/README.rst

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
=======
2+
Vcp Git
3+
=======
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:086596db3dcb4fa7565fc97cf01ccd22449731243622d4587a1f609eab8bc121
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fversion--control--platform-lightgray.png?logo=github
20+
:target: https://github.com/OCA/version-control-platform/tree/18.0/vcp_git
21+
:alt: OCA/version-control-platform
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/version-control-platform-18-0/version-control-platform-18-0-vcp_git
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/version-control-platform&target_branch=18.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module adds the necessary code to download using git.
32+
33+
It should be parent on git possible origins, like github or gitlab.
34+
35+
**Table of contents**
36+
37+
.. contents::
38+
:local:
39+
40+
Bug Tracker
41+
===========
42+
43+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/version-control-platform/issues>`_.
44+
In case of trouble, please check there if your issue has already been reported.
45+
If you spotted it first, help us to smash it by providing a detailed and welcomed
46+
`feedback <https://github.com/OCA/version-control-platform/issues/new?body=module:%20vcp_git%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
47+
48+
Do not contact contributors directly about support or help with technical issues.
49+
50+
Credits
51+
=======
52+
53+
Authors
54+
-------
55+
56+
* Dixmit
57+
58+
Contributors
59+
------------
60+
61+
- `Dixmit <https://www.dixmit.com>`__
62+
63+
- Enric Tobella
64+
65+
Maintainers
66+
-----------
67+
68+
This module is maintained by the OCA.
69+
70+
.. image:: https://odoo-community.org/logo.png
71+
:alt: Odoo Community Association
72+
:target: https://odoo-community.org
73+
74+
OCA, or the Odoo Community Association, is a nonprofit organization whose
75+
mission is to support the collaborative development of Odoo features and
76+
promote its widespread use.
77+
78+
This module is part of the `OCA/version-control-platform <https://github.com/OCA/version-control-platform/tree/18.0/vcp_git>`_ project on GitHub.
79+
80+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

vcp_git/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models

vcp_git/__manifest__.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2026 Dixmit
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
{
5+
"name": "Vcp Git",
6+
"summary": """Allows to download code from git""",
7+
"version": "18.0.1.0.0",
8+
"license": "AGPL-3",
9+
"author": "Dixmit,Odoo Community Association (OCA)",
10+
"website": "https://github.com/OCA/version-control-platform",
11+
"depends": [
12+
"vcp_management",
13+
],
14+
"external_dependencies": {
15+
"python": ["GitPython"],
16+
},
17+
}

vcp_git/models/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from . import vcp_repository_branch
2+
from . import vcp_platform
3+
from . import vcp_repository

vcp_git/models/vcp_platform.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright 2026 Dixmit
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
import logging
4+
5+
from odoo import models
6+
7+
_logger = logging.getLogger(__name__)
8+
9+
10+
class VcpPlatform(models.Model):
11+
_inherit = "vcp.platform"
12+
13+
def _get_git_url(self, repository):
14+
return getattr(self, f"_get_git_url_{self.kind}")(repository)

vcp_git/models/vcp_repository.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright 2026 Dixmit
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import models
5+
6+
7+
class VcpRepository(models.Model):
8+
_inherit = "vcp.repository"
9+
10+
def _get_git_url(self):
11+
self.ensure_one()
12+
return self.platform_id._get_git_url(self)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright 2026 Dixmit
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
import git
5+
6+
from odoo import models
7+
8+
9+
class VcpRepositoryBranch(models.Model):
10+
_inherit = "vcp.repository.branch"
11+
12+
def _download_code_git(self, local_path):
13+
try:
14+
repo = git.Repo(local_path)
15+
for remote in repo.remotes:
16+
if remote.url == self.repository_id._get_git_url():
17+
remote.fetch(self.branch_id.name)
18+
repo.git.reset("--hard", f"{remote.name}/{self.branch_id.name}")
19+
break
20+
except git.exc.InvalidGitRepositoryError:
21+
# Not cloned yet
22+
repo = git.Repo.clone_from(
23+
self.repository_id._get_git_url(),
24+
local_path,
25+
branch=self.branch_id.name,
26+
depth=1,
27+
)

vcp_git/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"

vcp_git/readme/CONTRIBUTORS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- [Dixmit](https://www.dixmit.com)
2+
- Enric Tobella

0 commit comments

Comments
 (0)