[IMP] forwardport: move working copy to the cache dir

Working copies were created in tempdir under the assumption that
they're, well, temporary.

However after thinking about it more there are two issues with this:

* tempdirs might not be in the same FS as the cache dir, meaning
  meaning `git clone` can't hardlink the repo objects and has to
  copy them
* tempdirs are often on RAM-backed tmpfs, which is not great when we're
  filling them with multiple GB worth of git repository...
This commit is contained in:
Xavier Morel 2019-09-16 13:16:09 +02:00
parent f8da17994a
commit a1a7d65ebe

View File

@ -522,7 +522,15 @@ More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port
_logger.info("Create working copy to forward-port %s:%d to %s",
self.repository.name, self.number, target_branch.name)
working_copy = source.clone(
cleanup.enter_context(tempfile.TemporaryDirectory()),
cleanup.enter_context(
tempfile.TemporaryDirectory(
prefix='%s:%d-to-%s' % (
self.repository.name,
self.number,
target_branch.name
),
dir=user_cache_dir('forwardport')
)),
branch=target_branch.name
)
project_id = self.repository.project_id