anybox / anybox.recipe.odoo

Buildout recipe for Odoo >=8. For older versions please use anybox.recipe.openerp
http://docs.anybox.fr/anybox.recipe.odoo/current/
GNU Affero General Public License v3.0
25 stars 63 forks source link

Can't merge remote branch at specific revision #94

Open eLBati opened 7 years ago

eLBati commented 7 years ago

Use case: I have a repository under addons and I want to merge a branch from another repository into it, at a specific revision. This is intended to prevent to silently include unexpected change to the instance.

Example:

addons = [...]
         git http://github.com/OCA/reporting-engine.git parts/reporting-engine da1e961a2787c3672131d881e8792bfb9a6a2ec4 branch=9.0
         [...]

and

merges += git https://github.com/faide/reporting-engine.git parts/reporting-engine 90bd61d3e12270c860c4fcbdf47d6a11801b1242 branch=report_py3o

This configuration is supposed to add changes coming from https://github.com/OCA/reporting-engine/pull/73 at the current state (rev 90bd61d3e12270c860c4fcbdf47d6a11801b1242)

Running buildout, I get

anybox.recipe.openerp.vcs.git: /home/elbati/workspace/odoo/instances/demo9-community/parts/reporting-engine> call ['git', 'pull', '--no-edit', 'https://github.com/faide/reporting-engine.git', '90bd61d3e12270c860c4fcbdf47d6a11801b1242']
error: no such remote ref 90bd61d3e12270c860c4fcbdf47d6a11801b1242
While:
  Updating odoo.

An internal error occurred due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
  File "/home/elbati/workspace/odoo/instances/demo9-community/eggs/zc.buildout-2.5.3-py2.7.egg/zc/buildout/buildout.py", line 1995, in main
    getattr(buildout, command)(args)
  File "/home/elbati/workspace/odoo/instances/demo9-community/eggs/zc.buildout-2.5.3-py2.7.egg/zc/buildout/buildout.py", line 636, in install
    installed_files = self[part]._call(update)
  File "/home/elbati/workspace/odoo/instances/demo9-community/eggs/zc.buildout-2.5.3-py2.7.egg/zc/buildout/buildout.py", line 1410, in _call
    return f()
  File "/home/elbati/workspace/odoo/instances/demo9-community/a.r.openerp/anybox/recipe/openerp/base.py", line 862, in install
    self.retrieve_merges()
  File "/home/elbati/workspace/odoo/instances/demo9-community/a.r.openerp/anybox/recipe/openerp/base.py", line 715, in retrieve_merges
    **options)
  File "/home/elbati/workspace/odoo/instances/demo9-community/a.r.openerp/anybox/recipe/openerp/vcs/__init__.py", line 25, in get_update
    return repo(vcs_type, target_dir, url, **options)(revision)
  File "/home/elbati/workspace/odoo/instances/demo9-community/a.r.openerp/anybox/recipe/openerp/vcs/base.py", line 111, in __call__
    self.get_update(revision)
  File "/home/elbati/workspace/odoo/instances/demo9-community/a.r.openerp/anybox/recipe/openerp/vcs/git.py", line 298, in get_update
    return self.merge(revision)
  File "/home/elbati/workspace/odoo/instances/demo9-community/a.r.openerp/anybox/recipe/openerp/vcs/git.py", line 398, in merge
    self.log_call(cmd)
  File "/home/elbati/workspace/odoo/instances/demo9-community/a.r.openerp/anybox/recipe/openerp/vcs/git.py", line 147, in log_call
    return callwith(cmd, **kw)
  File "/usr/lib/python2.7/subprocess.py", line 541, in check_call
    raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '['git', 'pull', '--no-edit', 'https://github.com/faide/reporting-engine.git', '90bd61d3e12270c860c4fcbdf47d6a11801b1242']' returned non-zero exit status 1

Is this solvable?

Thanks

gracinet commented 7 years ago

If I remember correctly, the way SHA pinning works in the recipe is very inefficient : basically fetching everything, hoping that SHA will then be locally available. It's also been a bit heavy to setup.

You could on the other hand fork that OCA repo on Github (or in any private system that you want), define a branch for that given commit and merge from that.

After all, you won't mind that your branch does not get updates, that's the point, isn't it ?

eLBati commented 7 years ago

Right, we'll follow that workaround, thanks

If there are no plans to handle the case described here, for me this can be closed