Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][l10n_br_base] unf*uck the 16.0 branch #3490

Open
rvalyi opened this issue Nov 14, 2024 · 6 comments
Open

[16.0][l10n_br_base] unf*uck the 16.0 branch #3490

rvalyi opened this issue Nov 14, 2024 · 6 comments
Labels

Comments

@rvalyi
Copy link
Member

rvalyi commented Nov 14, 2024

TLDR : YES, YOU NEED TO CLONE THE OCA/l10n-brazil 16.0 BRANCH AGAIN!

@mileo from KMEE did a bad migration process in #2164 and as a result the first ~550 commits in l10n_br_base were missing. In fact he also screwed even the 15.0 branch in #2194 were some 550 commits were also missing. He tried to experiment with oca-port without understanding it instead of following the process in https://github.com/OCA/maintainer-tools/wiki/Migration-to-version-15.0 and https://github.com/OCA/maintainer-tools/wiki/Migration-to-version-16.0
This resulted in a huge part of the project history that is trashed but more importantly, this screws the git blame code explanations and this prevents tools like oca-port to do their commit porting job properly.

The result is both branches 15.0 and 16.0 have their git history broken in ways it's impossible to fix with a new PR.
The only solution is to force-push new branches. Here in this issue I'm focusing on 16.0 as this is the priority, this is what will be propagated to 17.0 and to 18.0 later so it has to be fixed the sooner the better.

So basically we will need to force push the new 16.0-mig-l10n_br_base in place of the current 16.0 branch (it's backed up in 16.0-backup )

Here is the process I used to reconstruct 16.0-mig-l10n_br_base (yup it took me 2 days to fix your newest shit in the project @mileo and it's far from being the first big shit you did in the project, I hope won't force me to detail it again)

# First we will create a new clone were we will remove the commits in l10n_br_base using git filter-repo:
git clone https://github.com/OCA/l10n-brazil.git -b 16.0 l10n-brazil-clean; cd l10n-brazil-clean

# we will now use the https://github.com/newren/git-filter-repo git extension
# remove the broken commits in l10n_br_base and setup/l10n_br_base:
git filter-repo --path l10n_br_base --invert-paths --force
git filter-repo --path setup/l10n_br_base --invert-paths -–force

# Now we will re-do the migration process properly and cherry-picks the missing v16 commits:
cd to a NORMAL  https://github.com/OCA/l10n-brazil.git clone with the branches 14.0 and 16.0:

# we will get the list of commits for the 16.0 and the 14.0 branches to compare them later:
git checkout 16.0
git log --reverse --format="%H, %s" -- l10n_br_base > commits_l10n_br_base16.csv
git checkout 14.0
git log --reverse --format="%H, %s" -- l10n_br_base > commits_l10n_br_base14.csv

# delete the broken 16.0 branch:
git branch -D 16.0
# import the cleaned 16.0 branch from the clone cleaned with git filter-repo previously:
git fetch <PATH_TO_CLEANED_CLONE> 16.0:16.0

# now do the migration dance again (see https://github.com/OCA/maintainer-tools/wiki/Migration-to-version-16.0)

export module="l10n_br_base"
git checkout -b 16.0-mig-$module 16.0
git format-patch --keep-subject --stdout origin/16.0..14.0 -- $module | git am -3 --keep

now use the following script to list the commits that were present exclusively in the former 16.0 branch so we can replace them with git cherry-pick:

import csv

# Paths to the CSV files
file_14 = "commits_l10n_br_base14.csv"
file_16 = "commits_l10n_br_base16.csv"

# Read commit messages from the 14.0 branch
commits_14_messages = set()
with open(file_14, 'r') as f14:
    reader = csv.reader(f14)
    for row in reader:
        sha1, message = row[0], row[1]
        commits_14_messages.add(message.strip())

# Read and compare commit messages from the 16.0 branch
with open(file_16, 'r') as f16:
    reader = csv.reader(f16)
    for row in reader:
        sha1, message = row[0], row[1].strip()
        if message not in commits_14_messages:
            print(f"git cherry-pick {sha1}  # {message}")


# It should give this list: (here I added ** manually to highlight the commits with manual conflict resolution)

git cherry-pick 4f34397bf3b92ddc7eae09df7fd42d48d15a2c92  # [ADD] setup.py
git cherry-pick 2a092080ffaf624cb6f0f43a8e3faa88e7225008  # ** [MIG][l10n_br_base] bump module version 15.0.1.0.0
git cherry-pick 9cdac97a0cec25e54b935aa331435ec6a5dcaa22  # [MIG] To new assets format
git cherry-pick a761a4775032ed11df9bda271043e7611c2c1749  # [REF] l10n_br_base res.config view
git cherry-pick f0cbb3081763faaf8567a9f0a3699a329d907768  # [MIG][l10n_br_base] bump module version
git cherry-pick 5eb7130757efe70dad8e82a8b2b433b617c6250d  # [MIG] base_address_city merged with base_address_extended
git cherry-pick 85b50515100a6eabae44d8a3b1d3aab7062832c8  # [REM] l10n_br_base transalation hook
git cherry-pick 8b7070b563044fb52aba906d492aa92de1421656  # [ADD] Street number
git cherry-pick 015002a123230ba4cbbe3e0f9960446c6c4fa88b  # [REF] Address format
git cherry-pick a4fc6f4e7bba29a67c91525935a05e5487668898  # [REF] Partner Fields size
git cherry-pick a1e63dabba96b9ddd9c6d133f09284d770f4f873  # [IMP] Partner street for Brazilian partners and others
git cherry-pick 0c705dc04a2c91c98c5974165fe78816b03077d2  # [ADD] street_name to res.company
git cherry-pick 6ef521eaf1500168a711856c39ce3799e09983f7  # remove warnings: db odoo.tools.convert: HTML field 'signature' is declared as type=xml
git cherry-pick 4f1e578aaf011f555cb9ff2984562efa39ed5f56  # ** remove warning: The model odoo.addons.l10n_br_base.models.res_partner_pix is not overriding the create method in batch
git cherry-pick 7da8a5ff225af78ddc932053904a9ff1b18e2a88  # ** l10n_br_base: removed warning: Deprecated class SavepointCase has been merged into TransactionCase
git cherry-pick 5730c462fd218454a5fc52558aa2d0e6388baf8a  # l10n_br_base 16.0.1.0.1
git cherry-pick b0b532e8ca811ec9ae10f015ac82cd5eb688f27b  # ** [REF] l10n_br_base: Solve Warning dict-like access to the return value of validate_email is deprecated.
git cherry-pick 7d33c04b41e78fd91c93a2de7eb5d7503664c692  # l10n_br_base 16.0.1.1.0
git cherry-pick c09799698e4e69c09342384723b103323d1f8312  # [FIX] l10n_br_base: Rename assets_backend file to avoid error.
git cherry-pick 9eab9d062e55810aac782c4d396944bc1a5a5f08  # Merge PR #2649 into 16.0
git cherry-pick d3337b938590247dd8911b53a2d7c9ac39c1366f  # l10n_br_base 16.0.1.2.0
git cherry-pick 23efe31f66854041166d75ac5842279b21be3c56  # [IMP] l10n_br_base unaccent=False
git cherry-pick 05ad0d7cb2104147dcb1f253a7f5309227de2fc9  # ** [FIX] l10n_br_base partner view
git cherry-pick 2149e132d3f35459479a5e673e0c625fd8138a5d  # Merge PR #3110 into 16.0
git cherry-pick ddd5a987a954a73da77698257193ba0bbcc5f9af  # [FIX] l10n_br_base: Remove old migration file
git cherry-pick 0ae984478b43cf1e3254c230a3aaaa9511047ed6  # Merge PR #3227 into 16.0
git cherry-pick 63b23fdc0c16d884783323dbcd369e21607448f1  # [FIX] l10n_br_base: get address view
git cherry-pick 00a930c32f004d1cbccd3d78262ff3ec72361cfe  # ** copier update repository
git cherry-pick 1928665cc236605ca924006d886d6e1510e1dd07  # [FIX] equal Estadual Inscription detection
git cherry-pick c805988a16c2ffd44dade4ca77d3e0ac0ed122fc  # [FIX] l10n_br_base: form padding 0

# skip the 1st commit ([ADD] setup.py) and replay the other commits. Fix the conflicts when they occur and continue (there were some 6 conflicting commits to fix)

# it's done. Complain about KMEE and try to go back to a normal life.

@renatonlima @marcelsavegnago @antoniospneto can can you please review 16.0-mig-l10n_br_base carefully so we can force push it into the new 16.0 branch?

If you compare it with the current 16.0 branch, you should only see differences in l10n_br_base due to these missing commits: #3487

After we do the replace, all the 16.0 clones will need to be done again on all machines and all PR to the 16.0 branch will need to be reconstructed from new clones and cherry-picking the commits in the former PRs. 16.0 is the top priority, but eventually we fix the 15.0 branch after that. (yup thank once again for your great initiatives in the project @mileo what would we do without you I wonder)

@rvalyi
Copy link
Member Author

rvalyi commented Nov 14, 2024

reparem nos ~500+ commits que tavam faltando na branch 16.0:

2024-11-14_20-14

2024-11-14_20-15

@rvalyi
Copy link
Member Author

rvalyi commented Nov 15, 2024

@renatonlima @marcelsavegnago @antoniospneto eu acabei de dar um force push na nova branch 16.0 16.0-mig-l10n_br_base porque tinha um pequeno problema de pre-commit no arquivo requirements.txt, eu apenas tive que acertar as external_dependencies no commit "git cherry-pick 2a09208 # [MIG][l10n_br_base] bump module version 15.0.1.0.0"

Com isso ao rodar os testes eu peguei um novo warning que provavelmente vem da presencia agora do PR de refator do CNPJ/vat #2718 do @marcelsavegnago que agora ficou presente nessa bova branch 16.0. Eu ainda não analisei a criticidade disso...

Segue o warning:

2024-11-15 15:16:10,414 29304 INFO odoo16 odoo.modules.registry: module l10n_br_base: creating or updating database tables
2024-11-15 15:16:10,533 29304 WARNING odoo16 py.warnings: /home/rvalyi/DEV/odoo16/odoo/src/odoo/fields.py:798: UserWarning: Field res.partner.vat should be declared with recursive=True
  File "/home/rvalyi/DEV/odoo16/odoo/bin/odoo", line 7, in <module>
    exec(compile(f.read(), __file__, 'exec'))
  File "/home/rvalyi/DEV/odoo16/odoo/src/setup/odoo", line 8, in <module>
    odoo.cli.main()
  File "/home/rvalyi/DEV/odoo16/odoo/src/odoo/cli/command.py", line 66, in main
    o.run(args)
  File "/home/rvalyi/DEV/odoo16/odoo/src/odoo/cli/server.py", line 180, in run
    main(args)
  File "/home/rvalyi/DEV/odoo16/odoo/src/odoo/cli/server.py", line 173, in main
    rc = odoo.service.server.start(preload=preload, stop=stop)
  File "/home/rvalyi/DEV/odoo16/odoo/src/odoo/service/server.py", line 1399, in start
    rc = server.run(preload, stop)
  File "/home/rvalyi/DEV/odoo16/odoo/src/odoo/service/server.py", line 579, in run
    rc = preload_registries(preload)
  File "/home/rvalyi/DEV/odoo16/odoo/src/odoo/service/server.py", line 1299, in preload_registries
    registry = Registry.new(dbname, update_module=update_module)
  File "/home/rvalyi/DEV/odoo16/odoo/lib/python3.11/site-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "/home/rvalyi/DEV/odoo16/odoo/src/odoo/tools/func.py", line 87, in locked
    return func(inst, *args, **kwargs)
  File "/home/rvalyi/DEV/odoo16/odoo/src/odoo/modules/registry.py", line 90, in new
    odoo.modules.load_modules(registry, force_demo, status, update_module)
  File "/home/rvalyi/DEV/odoo16/odoo/src/odoo/modules/loading.py", line 484, in load_modules
    processed_modules += load_marked_modules(cr, graph,
  File "/home/rvalyi/DEV/odoo16/odoo/src/odoo/modules/loading.py", line 372, in load_marked_modules
    loaded, processed = load_module_graph(
  File "/home/rvalyi/DEV/odoo16/odoo/src/odoo/modules/loading.py", line 208, in load_module_graph
    registry.init_models(cr, model_names, {'module': package.name}, new_install)
  File "/home/rvalyi/DEV/odoo16/odoo/src/odoo/modules/registry.py", line 542, in init_models
    func()
  File "/home/rvalyi/DEV/odoo16/odoo/src/odoo/addons/base/models/ir_model.py", line 47, in mark_modified
    records.modified(fnames)
  File "/home/rvalyi/DEV/odoo16/odoo/src/odoo/models.py", line 6076, in modified
    todo = [self._modified([self._fields[fname] for fname in fnames], create)]
  File "/home/rvalyi/DEV/odoo16/odoo/src/odoo/models.py", line 6127, in _modified
    tree = self.pool.get_trigger_tree(fields, select=select)
  File "/home/rvalyi/DEV/odoo16/odoo/src/odoo/modules/registry.py", line 346, in get_trigger_tree
    trees = [
  File "/home/rvalyi/DEV/odoo16/odoo/src/odoo/modules/registry.py", line 349, in <listcomp>
    if field in self._field_triggers
  File "/home/rvalyi/DEV/odoo16/odoo/src/odoo/tools/func.py", line 28, in __get__
    value = self.fget(obj)
  File "/home/rvalyi/DEV/odoo16/odoo/src/odoo/modules/registry.py", line 443, in _field_triggers
    dependencies = list(field.resolve_depends(self))
  File "/home/rvalyi/DEV/odoo16/odoo/src/odoo/fields.py", line 798, in resolve_depends
    warnings.warn(f"Field {self} should be declared with recursive=True")

@marcelsavegnago
Copy link
Member

@rvalyi nós da Escodoo não temos nenhum projeto na 1.0 e portanto o impacto seria em algum PR nossa mas não vejo problema.

@rvalyi
Copy link
Member Author

rvalyi commented Nov 26, 2024

Pessoal, eu acabei de dar um force push no 16.0-mig-l10n_br_base onde eu atualizei a branch com os ultimos commits/merges que teve na 16.0 nos ultimos dias.

A unica diferença que tem com a v16 é equivalente ao diff desse PR #3500 e nisso podem ver que os testes estão passando apesar daquele warning. Nisso seria bom sim fazer o force push nas branches 15.0 e 16.0 para destravar o projeto de vez e inclusive as migrações para as versões superiores tb.

@antoniospneto
Copy link
Contributor

Por parte da Engenere, estamos de acordo. Temos algumas PRs de migração em andamento, mas podemos refazê-las sem problema após o rebase.

@rvalyi
Copy link
Member Author

rvalyi commented Nov 28, 2024

@marcelsavegnago @antoniospneto @mbcosta @mileo @DiegoParadeda @douglascstd fizemos o force push da branch 16.0 ontem então.

Nisso o Github fechou automaticamente os PR's em curso que usavam a branch 16.0 com o historico quebrado como base, se trata desses PR's na 16.0:

Alguns desses PRs eram coisas de racsunho mesmo, mas a maioria vai ter que ser re-criado sim. No caso basta o author re-criar o PR fazer cherry-pick dos commits do PR em cima de um novo fork da 16.0 com o histórico consertado.

Ai pessoal, qdo vc não entende como algo funciona, por favor não vem bancar o sabichão e fazer besteira no projeto e prejudicar geral neh. @mileo se trata no mínimo da segunda vez que vc nos obriga a fazer um force push com suas cagadas no projeto e não tou contanto aqui seu fork tosco, sem continuidade nem teste de 2016 que deve ter matado fácil uns 30% da comunidade que te seguiu. Não vai dar para passar pano sempre não o recado ta dado valeu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants