Fullscreen eingestellt.
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -44,13 +44,13 @@ class Bazaar(VersionControl):
|
||||
display_path(dest),
|
||||
)
|
||||
if verbosity <= 0:
|
||||
flag = "--quiet"
|
||||
flags = ["--quiet"]
|
||||
elif verbosity == 1:
|
||||
flag = ""
|
||||
flags = []
|
||||
else:
|
||||
flag = f"-{'v'*verbosity}"
|
||||
flags = [f"-{'v'*verbosity}"]
|
||||
cmd_args = make_command(
|
||||
"checkout", "--lightweight", flag, rev_options.to_args(), url, dest
|
||||
"checkout", "--lightweight", *flags, rev_options.to_args(), url, dest
|
||||
)
|
||||
self.run_command(cmd_args)
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import pathlib
|
||||
import re
|
||||
import urllib.parse
|
||||
import urllib.request
|
||||
from dataclasses import replace
|
||||
from typing import List, Optional, Tuple
|
||||
|
||||
from pip._internal.exceptions import BadCommand, InstallationError
|
||||
@@ -217,7 +218,7 @@ class Git(VersionControl):
|
||||
|
||||
if sha is not None:
|
||||
rev_options = rev_options.make_new(sha)
|
||||
rev_options.branch_name = rev if is_branch else None
|
||||
rev_options = replace(rev_options, branch_name=(rev if is_branch else None))
|
||||
|
||||
return rev_options
|
||||
|
||||
|
||||
@@ -288,12 +288,12 @@ class Subversion(VersionControl):
|
||||
display_path(dest),
|
||||
)
|
||||
if verbosity <= 0:
|
||||
flag = "--quiet"
|
||||
flags = ["--quiet"]
|
||||
else:
|
||||
flag = ""
|
||||
flags = []
|
||||
cmd_args = make_command(
|
||||
"checkout",
|
||||
flag,
|
||||
*flags,
|
||||
self.get_remote_call_options(),
|
||||
rev_options.to_args(),
|
||||
url,
|
||||
|
||||
@@ -5,13 +5,14 @@ import os
|
||||
import shutil
|
||||
import sys
|
||||
import urllib.parse
|
||||
from dataclasses import dataclass, field
|
||||
from typing import (
|
||||
TYPE_CHECKING,
|
||||
Any,
|
||||
Dict,
|
||||
Iterable,
|
||||
Iterator,
|
||||
List,
|
||||
Literal,
|
||||
Mapping,
|
||||
Optional,
|
||||
Tuple,
|
||||
@@ -37,14 +38,6 @@ from pip._internal.utils.subprocess import (
|
||||
format_command_args,
|
||||
make_command,
|
||||
)
|
||||
from pip._internal.utils.urls import get_url_scheme
|
||||
|
||||
if TYPE_CHECKING:
|
||||
# Literal was introduced in Python 3.8.
|
||||
#
|
||||
# TODO: Remove `if TYPE_CHECKING` when dropping support for Python 3.7.
|
||||
from typing import Literal
|
||||
|
||||
|
||||
__all__ = ["vcs"]
|
||||
|
||||
@@ -58,8 +51,8 @@ def is_url(name: str) -> bool:
|
||||
"""
|
||||
Return true if the name looks like a URL.
|
||||
"""
|
||||
scheme = get_url_scheme(name)
|
||||
if scheme is None:
|
||||
scheme = urllib.parse.urlsplit(name).scheme
|
||||
if not scheme:
|
||||
return False
|
||||
return scheme in ["http", "https", "file", "ftp"] + vcs.all_schemes
|
||||
|
||||
@@ -121,34 +114,22 @@ class RemoteNotValidError(Exception):
|
||||
self.url = url
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class RevOptions:
|
||||
|
||||
"""
|
||||
Encapsulates a VCS-specific revision to install, along with any VCS
|
||||
install options.
|
||||
|
||||
Instances of this class should be treated as if immutable.
|
||||
Args:
|
||||
vc_class: a VersionControl subclass.
|
||||
rev: the name of the revision to install.
|
||||
extra_args: a list of extra options.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
vc_class: Type["VersionControl"],
|
||||
rev: Optional[str] = None,
|
||||
extra_args: Optional[CommandArgs] = None,
|
||||
) -> None:
|
||||
"""
|
||||
Args:
|
||||
vc_class: a VersionControl subclass.
|
||||
rev: the name of the revision to install.
|
||||
extra_args: a list of extra options.
|
||||
"""
|
||||
if extra_args is None:
|
||||
extra_args = []
|
||||
|
||||
self.extra_args = extra_args
|
||||
self.rev = rev
|
||||
self.vc_class = vc_class
|
||||
self.branch_name: Optional[str] = None
|
||||
vc_class: Type["VersionControl"]
|
||||
rev: Optional[str] = None
|
||||
extra_args: CommandArgs = field(default_factory=list)
|
||||
branch_name: Optional[str] = None
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"<RevOptions {self.vc_class.name}: rev={self.rev!r}>"
|
||||
@@ -362,7 +343,7 @@ class VersionControl:
|
||||
rev: the name of a revision to install.
|
||||
extra_args: a list of extra options.
|
||||
"""
|
||||
return RevOptions(cls, rev, extra_args=extra_args)
|
||||
return RevOptions(cls, rev, extra_args=extra_args or [])
|
||||
|
||||
@classmethod
|
||||
def _is_local_repository(cls, repo: str) -> bool:
|
||||
@@ -660,6 +641,8 @@ class VersionControl:
|
||||
log_failed_cmd=log_failed_cmd,
|
||||
stdout_only=stdout_only,
|
||||
)
|
||||
except NotADirectoryError:
|
||||
raise BadCommand(f"Cannot find command {cls.name!r} - invalid PATH")
|
||||
except FileNotFoundError:
|
||||
# errno.ENOENT = no such file or directory
|
||||
# In other words, the VCS executable isn't available
|
||||
|
||||
Reference in New Issue
Block a user