[FIX] script git show code diff repo manifest: better support

- support when different branch same commit
- show warning instead error when the branch is different, but it's push
This commit is contained in:
Mathieu Benoit 2021-07-16 18:56:58 -04:00
parent 3cf91837d6
commit 0bb92995f2
2 changed files with 31 additions and 6 deletions

View file

@ -6,7 +6,13 @@ Before starting, validate [manifest/default.dev.xml](../manifest/default.dev.xml
## Clean environment before generate new release
Be sure all files are commit and push, this will erase everything in addons.
Before clean, check if existing file not committed, not pushed or in stash.
```bash
./.venv/repo forall -pc "git stash list"
./script/git_show_code_diff_repo_manifest.py
```
This will erase everything in addons. Useful before create docker, manifest and do a release.
```bash
./script/clean_repo_manifest.sh

View file

@ -106,11 +106,30 @@ def main():
)
dct_result["PASS"] += 1
elif branch_name != value:
print(
f"{Fore.RED}ERROR{Style.RESET_ALL} manifest revision is"
f" {branch_name} and actual revision is {value}."
)
dct_result["ERROR"] += 1
value_hash = git_repo.git.rev_parse(value)
if git_repo.git.rev_parse(branch_name) == value_hash:
print(
f"{Fore.GREEN}PASS{Style.RESET_ALL} Not same branch, no"
" divergence"
)
dct_result["PASS"] += 1
else:
# Check if the new branch is pushed
commit_branch = git_repo.git.rev_parse(
f"{organization}/{value}"
)
if commit_branch == value_hash:
print(
f"{Fore.YELLOW}WARNING{Style.RESET_ALL} New branch"
f" '{value}', divergence, but it's push on remote."
)
dct_result["WARNING"] += 1
else:
print(
f"{Fore.RED}ERROR{Style.RESET_ALL} manifest revision"
f" is {branch_name} and actual revision is {value}."
)
dct_result["ERROR"] += 1
else:
print(f"{Fore.GREEN}PASS{Style.RESET_ALL}")
dct_result["PASS"] += 1