[UPD] add repo_diff_manifest_production in documentation release.md
- add bold color in bash - add default manifest - fix print color
This commit is contained in:
parent
7d704b7910
commit
1bf8d7da9f
7 changed files with 79 additions and 16 deletions
5
Makefile
5
Makefile
|
|
@ -360,6 +360,11 @@ repo_configure_group_code_generator:
|
|||
repo_show_status:
|
||||
./.venv/repo forall -pc "git status -s"
|
||||
|
||||
# Show divergence between actual repository and production manifest
|
||||
.PHONY: repo_diff_manifest_production
|
||||
repo_diff_manifest_production:
|
||||
./script/git_show_code_diff_repo_manifest.py
|
||||
|
||||
# Show git diff for all repo from last tag version release
|
||||
.PHONY: repo_diff_from_last_version
|
||||
repo_diff_from_last_version:
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@ git diff v#.#.#..HEAD
|
|||
|
||||
Simplification tools:
|
||||
```bash
|
||||
# Show all divergence repository with production
|
||||
make repo_diff_manifest_production
|
||||
# Short version with statistique
|
||||
make repo_diff_stat_from_last_version
|
||||
# Long version
|
||||
|
|
|
|||
4
poetry.lock
generated
4
poetry.lock
generated
|
|
@ -191,6 +191,7 @@ uvloop = ["uvloop (>=0.15.2)"]
|
|||
reference = "93c10bf9ebccf8d7cc686b0b9579f2e5e41c5328"
|
||||
type = "git"
|
||||
url = "https://github.com/psf/black.git"
|
||||
|
||||
[[package]]
|
||||
category = "main"
|
||||
description = "Interactive plots and applications in the browser from Python"
|
||||
|
|
@ -1774,6 +1775,7 @@ whichcraft = "*"
|
|||
reference = "455ac91d2d6d651bf67ec8eae7dae516f11b1dec"
|
||||
type = "git"
|
||||
url = "https://github.com/oca/pylint-odoo.git"
|
||||
|
||||
[[package]]
|
||||
category = "main"
|
||||
description = "Utilities and helpers for writing Pylint plugins"
|
||||
|
|
@ -2970,7 +2972,7 @@ python-versions = "*"
|
|||
version = "4.4.28"
|
||||
|
||||
[metadata]
|
||||
content-hash = "8f717dd4d3138e704720a02bc6ca7efb301108825e0cfc0dcd16c2a8d3822b6c"
|
||||
content-hash = "8de9276db75ff5d36eae0441c17e9c88134de99323ae57b2c09d8ded790012af"
|
||||
lock-version = "1.0"
|
||||
python-versions = "^3.7.7"
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ retrying
|
|||
xmltodict
|
||||
openupgradelib
|
||||
unidiff
|
||||
colorama
|
||||
|
||||
# For OSX
|
||||
cython
|
||||
|
|
|
|||
|
|
@ -54,9 +54,7 @@ def get_config():
|
|||
def get_master_password():
|
||||
try:
|
||||
# _logger.info("You have 5 secondes to add master password...")
|
||||
pa = getpass.getpass(
|
||||
prompt="\nEnter master password... "
|
||||
)
|
||||
pa = getpass.getpass(prompt="\nEnter master password... ")
|
||||
return pa
|
||||
except getpass.GetPassWarning:
|
||||
_logger.error("Password echoed, danger!")
|
||||
|
|
|
|||
|
|
@ -4,7 +4,10 @@ import sys
|
|||
import argparse
|
||||
import logging
|
||||
from git import Repo
|
||||
from git.exc import GitCommandError
|
||||
from git.exc import GitCommandError, NoSuchPathError
|
||||
from colorama import Fore
|
||||
from colorama import Style
|
||||
from collections import defaultdict
|
||||
|
||||
new_path = os.path.normpath(os.path.join(os.path.dirname(__file__), ".."))
|
||||
sys.path.append(new_path)
|
||||
|
|
@ -30,7 +33,7 @@ def get_config():
|
|||
parser.add_argument(
|
||||
"-m",
|
||||
"--manifest",
|
||||
required=True,
|
||||
default="./default.xml",
|
||||
help="The manifest to compare with actual code.",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
|
@ -47,6 +50,7 @@ def main():
|
|||
default_branch_name = default_remote.get(
|
||||
"@revision", git_tool.default_branch
|
||||
)
|
||||
dct_result = defaultdict(int)
|
||||
i = 0
|
||||
total = len(dct_project)
|
||||
for name, project in dct_project.items():
|
||||
|
|
@ -54,12 +58,18 @@ def main():
|
|||
path = project.get("@path")
|
||||
print(f"{i}/{total} - {path}")
|
||||
branch_name = project.get("@revision", default_branch_name)
|
||||
organization = project.get("@remote")
|
||||
if not organization:
|
||||
print(f"ERROR missing @remote on project {path}.")
|
||||
organization = project.get("@remote", git_tool.default_project_name)
|
||||
|
||||
try:
|
||||
git_repo = Repo(path)
|
||||
except NoSuchPathError:
|
||||
print(
|
||||
f"{Fore.YELLOW}Warning{Style.RESET_ALL} missing project"
|
||||
f" {path}."
|
||||
)
|
||||
dct_result["WARNING"] += 1
|
||||
continue
|
||||
|
||||
git_repo = Repo(path)
|
||||
value = git_repo.git.branch("--show-current")
|
||||
if not value:
|
||||
# TODO maybe need to check divergence with local branch and not remote branch
|
||||
|
|
@ -69,19 +79,60 @@ def main():
|
|||
f"{organization}/{branch_name}"
|
||||
)
|
||||
except GitCommandError:
|
||||
print("ERROR Something wrong with this repo.")
|
||||
# Cannot get information
|
||||
if branch_name == commit_head:
|
||||
print(
|
||||
f"{Fore.GREEN}PASS{Style.RESET_ALL} Not on specified"
|
||||
" branch, no divergence"
|
||||
)
|
||||
dct_result["PASS"] += 1
|
||||
else:
|
||||
print(
|
||||
f"{Fore.RED}ERROR{Style.RESET_ALL} manifest revision"
|
||||
f" is {branch_name} and commit {commit_head}."
|
||||
)
|
||||
dct_result["ERROR"] += 1
|
||||
continue
|
||||
if commit_branch != commit_head:
|
||||
print("WARNING Not on specified branch, got a divergence.")
|
||||
print(
|
||||
f"{Fore.YELLOW}WARNING{Style.RESET_ALL} Not on specified"
|
||||
" branch, got a divergence."
|
||||
)
|
||||
dct_result["WARNING"] += 1
|
||||
else:
|
||||
print("PASS Not on specified branch, no divergence.")
|
||||
print(
|
||||
f"{Fore.GREEN}PASS{Style.RESET_ALL} Not on specified"
|
||||
" branch, no divergence"
|
||||
)
|
||||
dct_result["PASS"] += 1
|
||||
elif branch_name != value:
|
||||
print(
|
||||
f"ERROR, manifest revision is {branch_name} and actual"
|
||||
f" revision is {value}."
|
||||
f"{Fore.RED}ERROR{Style.RESET_ALL} manifest revision is"
|
||||
f" {branch_name} and actual revision is {value}."
|
||||
)
|
||||
dct_result["ERROR"] += 1
|
||||
else:
|
||||
print("PASS")
|
||||
print(f"{Fore.GREEN}PASS{Style.RESET_ALL}")
|
||||
dct_result["PASS"] += 1
|
||||
|
||||
str_result = ""
|
||||
if dct_result["PASS"]:
|
||||
str_result += (
|
||||
f"{Fore.GREEN}PASS: {dct_result['PASS']}{Style.RESET_ALL}"
|
||||
)
|
||||
if dct_result["WARNING"]:
|
||||
if str_result:
|
||||
str_result += " "
|
||||
str_result += (
|
||||
f"{Fore.YELLOW}WARNING: {dct_result['WARNING']}{Style.RESET_ALL}"
|
||||
)
|
||||
if dct_result["ERROR"]:
|
||||
if str_result:
|
||||
str_result += " "
|
||||
str_result += (
|
||||
f"{Fore.RED}ERROR: {dct_result['ERROR']}{Style.RESET_ALL}"
|
||||
)
|
||||
print(str_result)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
|
|
@ -1,9 +1,13 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
BOLD='\033[1m' # Black
|
||||
|
||||
LAST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
|
||||
./.venv/repo forall -pc "git diff --stat ERPLibre/${LAST_TAG}..HEAD"
|
||||
|
||||
echo ""
|
||||
echo -e "${BOLD}project /${Color_Off}"
|
||||
|
||||
# For actual repo
|
||||
git diff --stat ${LAST_TAG}..HEAD
|
||||
|
|
|
|||
Loading…
Reference in a new issue