mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 23:45:44 +07:00
[REM] runbot_merge: check_visibility
Its sole use was removed with the switch to local staging, but I missed removing it. Closes #625 as there is no need to update it to v2 smart protocol.
This commit is contained in:
parent
b0b609ebe7
commit
73e4ac6066
@ -11,7 +11,6 @@ from itertools import takewhile
|
||||
from operator import itemgetter
|
||||
from typing import Dict, Union, Optional, Literal, Callable, Iterator, Tuple, List, TypeAlias
|
||||
|
||||
import requests
|
||||
from werkzeug.datastructures import Headers
|
||||
|
||||
from odoo import api, models, fields
|
||||
@ -264,23 +263,6 @@ def stage_batches(branch: Branch, batched_prs: List[PullRequests], staging_state
|
||||
)
|
||||
return staged
|
||||
|
||||
def check_visibility(repo: Repository, branch_name: str, expected_head: str, token: str):
|
||||
""" Checks the repository actual to see if the new / expected head is
|
||||
now visible
|
||||
"""
|
||||
# v1 protocol provides URL for ref discovery: https://github.com/git/git/blob/6e0cc6776106079ed4efa0cc9abace4107657abf/Documentation/technical/http-protocol.txt#L187
|
||||
# for more complete client this is also the capabilities discovery and
|
||||
# the "entry point" for the service
|
||||
url = 'https://github.com/{}.git/info/refs?service=git-upload-pack'.format(repo.name)
|
||||
with requests.get(url, stream=True, auth=(token, '')) as resp:
|
||||
if not resp.ok:
|
||||
return False
|
||||
for head, ref in parse_refs_smart(resp.raw.read):
|
||||
if ref != ('refs/heads/' + branch_name):
|
||||
continue
|
||||
return head == expected_head
|
||||
return False
|
||||
|
||||
|
||||
refline = re.compile(rb'([\da-f]{40}) ([^\0\n]+)(\0.*)?\n?')
|
||||
ZERO_REF = b'0'*40
|
||||
|
Loading…
Reference in New Issue
Block a user