Avoid shallow fetches to ADO remotes
This commit is contained in:
Родитель
406fda90e6
Коммит
a5e4252984
|
@ -8,6 +8,7 @@ import logging
|
||||||
import pathlib
|
import pathlib
|
||||||
import re
|
import re
|
||||||
from typing import Any, Iterable, List, Optional, Set, Tuple
|
from typing import Any, Iterable, List, Optional, Set, Tuple
|
||||||
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
import git
|
import git
|
||||||
|
|
||||||
|
@ -157,13 +158,17 @@ class Repo:
|
||||||
remote_sha = output.split()[0]
|
remote_sha = output.split()[0]
|
||||||
|
|
||||||
# No fetch window specified
|
# No fetch window specified
|
||||||
if not since:
|
# Or using Azure DevOps since it doesn't support shallow-since or unshallow
|
||||||
|
if not since or any(
|
||||||
|
urlparse(url).hostname == "msazure.visualstudio.com" for url in remote.urls
|
||||||
|
):
|
||||||
LOGGER.info("Fetching ref %s from remote %s", remote_ref, remote)
|
LOGGER.info("Fetching ref %s from remote %s", remote_ref, remote)
|
||||||
remote.fetch(remote_ref, **kwargs)
|
remote.fetch(remote_ref, **kwargs)
|
||||||
|
|
||||||
# Create tag at FETCH_HEAD to preserve reference locally
|
# Create tag at FETCH_HEAD to preserve reference locally
|
||||||
if local_sha is None or local_sha != remote_sha:
|
if local_sha is None or local_sha != remote_sha:
|
||||||
self.obj.create_tag(local_ref, "FETCH_HEAD", force=True)
|
self.obj.create_tag(local_ref, "FETCH_HEAD", force=True)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# If we have the ref locally, see if the ref is the same to avoid resetting depth
|
# If we have the ref locally, see if the ref is the same to avoid resetting depth
|
||||||
|
|
|
@ -165,7 +165,7 @@ spelling-ignore-words = [
|
||||||
"parsers", "PatchData", "preprocessing",
|
"parsers", "PatchData", "preprocessing",
|
||||||
"repo", "repos",
|
"repo", "repos",
|
||||||
"setuptools", "SHA", "subclassed", "subcommand", "subcommands", "subparsers",
|
"setuptools", "SHA", "subclassed", "subcommand", "subcommands", "subparsers",
|
||||||
"untracked",
|
"unshallow", "untracked",
|
||||||
"virtualenv",
|
"virtualenv",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче