mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 15:35:46 +07:00
[IMP] *: avoid updating (all) branches in cases where that's unnecessary
Partial mitigation of #1065, not complete by any means. Avoiding updating a local ref during staging is probably the most important bit here, we're staging on commits (into a new ref) anyway so it should not be needed, and that avoids conflicts between the staging cron and e.g. the forwardport cron.
This commit is contained in:
parent
4fe3da2f09
commit
447a3e778f
@ -331,11 +331,14 @@ class PullRequests(models.Model):
|
||||
"Forward-porting" if forward else "Back-porting",
|
||||
self.display_name, root.display_name, target_branch.name
|
||||
)
|
||||
fetch = source.with_config(stdout=subprocess.PIPE, stderr=subprocess.STDOUT).fetch()
|
||||
logger.info("Updated cache repo %s:\n%s", source._directory, fetch.stdout.decode())
|
||||
|
||||
head_fetch = source.with_config(stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=False) \
|
||||
.fetch(git.source_url(self.repository), root.head)
|
||||
.fetch(
|
||||
git.source_url(self.repository),
|
||||
f"refs/heads/{target_branch.name}:refs/heads/{target_branch.name}",
|
||||
root.head,
|
||||
no_tags=True,
|
||||
)
|
||||
if head_fetch.returncode:
|
||||
raise ForwardPortError(
|
||||
f"During forward port of {self.display_name}, unable to find "
|
||||
|
@ -263,7 +263,7 @@ class Patch(models.Model):
|
||||
remote,
|
||||
f"+refs/heads/{target.name}:refs/heads/{target.name}",
|
||||
*(p.commit for p in ps),
|
||||
no_tags=True
|
||||
no_tags=True,
|
||||
).returncode:
|
||||
r.fetch(remote, f"+refs/heads/{target.name}:refs/heads/{target.name}", no_tags=True)
|
||||
for p in ps:
|
||||
|
@ -249,12 +249,7 @@ def staging_setup(
|
||||
source = git.get_local(repo)
|
||||
source.fetch(
|
||||
git.source_url(repo),
|
||||
# a full refspec is necessary to ensure we actually fetch the ref
|
||||
# (not just the commit it points to) and update it.
|
||||
# `git fetch $remote $branch` seems to work locally, but it might
|
||||
# be hooked only to "proper" remote-tracking branches
|
||||
# (in `refs/remotes`), it doesn't seem to work here
|
||||
f'+refs/heads/{target.name}:refs/heads/{target.name}',
|
||||
head,
|
||||
*(pr.head for pr in by_repo.get(repo, [])),
|
||||
no_tags=True,
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user