sunflowerit / waftlib

Apache License 2.0
7 stars 14 forks source link

Master comment non existing branches #44

Open gfcapalbo opened 9 months ago

gfcapalbo commented 9 months ago

depends on #41 , removes dead merges and puts them in a comment at the end of the yaml. Could not do comment in place because of PyYaml limitations. would have to do indepth mod of the DUmper, and may not even be possible.

rualmel seems to make it possible if this solution is not okay https://copyprogramming.com/howto/how-to-insert-a-comment-line-to-yaml-in-python-using-ruamel-yaml

currently given input:

odoo:                                                                                   
  defaults:                                                                             
    depth: ${WAFT_DEPTH_DEFAULT}                                                        
  remotes:                                                                              
    - origin: https://github.com/odoo/odoo.git  
    - origin: felafel

  target: origin ${ODOO_VERSION}                                                        
  merges:                                                                               
    - origin ${ODOO_VERSION}                                                            

OCA/product-attribute:                                                                  
  defaults:                                                                             
    depth: ${WAFT_DEPTH_DEFAULT}                                                        
  remotes:                                                                              
    origin: https://github.com/OCA/product-attribute.git                                
  target: origin ${ODOO_VERSION}                                                        
  merges:                                                                               
    - origin ${ODOO_VERSION}                                                            

Where "origin felafel" is a branch that does not exist:

odoo:                                                                                   
  defaults:                                                                             
    depth: ${WAFT_DEPTH_DEFAULT}                                                        
  remotes:                                                                              
    origin: https://github.com/odoo/odoo.git                                            
  target: origin ${ODOO_VERSION}                                                        
  merges:                                                                               
    - origin ${ODOO_VERSION}                                                            

OCA/product-attribute:                                                                  
  defaults:                                                                             
    depth: ${WAFT_DEPTH_DEFAULT}                                                        
  remotes:                                                                              
    origin: https://github.com/OCA/product-attribute.git                                
  target: origin ${ODOO_VERSION}                                                        
  merges:                                                                               
    - origin ${ODOO_VERSION}      

# dumped in comment section non-existing merge:  - origin felafel    from repo  odoo , remote: origin:https://github.com/odoo/odoo.git   

Don't know if this addition is useful , but i had an issue so i did it.

Possible problems:

gfcapalbo commented 9 months ago

@thomaspaulb @Hussam-Suleiman let me know if :

  1. this function is a worthwhile one, if i should spend another hour or two hardening the three problem points i found in description.
  2. if i should spend another hour implementing in-place comments instead of "end-of-file dump" by re-implementing with ruamel and dropping YAML
  3. If i should extend this by not only identifying branches that do not exist. But also by identifying branches that have no extra commits if compared to target.
  4. if i should rename script from update_depths to a more generic name, now that it does multiple things.
Hussam-Suleiman commented 9 months ago

In my opinion, if this script can't support all Odoo installation versions we can freeze it until the next waft version.

gfcapalbo commented 9 months ago

In my opinion, if this script can't support all Odoo installation versions we can freeze it until the next waft version.

this message refers to https://github.com/sunflowerit/waftlib/pull/41 ? this is just an addition to that. I respond in that MR.

thomaspaulb commented 9 months ago

I think:

thomaspaulb commented 9 months ago

Meanwhile, @gfcapalbo I would let this rest, and #41 as well, until we make a decision on Waft 2.0

thomaspaulb commented 9 months ago

PS. Also, Waft 2.0 has a separate Python3 for tools, so there, we can also use it for Odoo <=10.0

ddejong-therp commented 9 months ago

Sure, last week ended up being quite filled nevertheless though.

gfcapalbo commented 8 months ago

@thomaspaulb Added a connection check before looking to remove non-existing branches. if the repo cannot be reached, nothing will be done to change the yaml.