Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
VersionControl Class Reference
Inheritance diagram for VersionControl:
Collaboration diagram for VersionControl:

Public Member Functions

bool should_add_vcs_url_prefix (cls, str remote_url)
 
Optional[str] get_subdirectory (cls, str location)
 
str get_requirement_revision (cls, str repo_dir)
 
str get_src_requirement (cls, str repo_dir, str project_name)
 
bool is_immutable_rev_checkout (self, str url, str dest)
 
RevOptions make_rev_options (cls, Optional[str] rev=None, Optional[CommandArgs] extra_args=None)
 
Tuple[str, Tuple[Optional[str], Optional[str]]] get_netloc_and_auth (cls, str netloc, str scheme)
 
Tuple[str, Optional[str], AuthInfoget_url_rev_and_auth (cls, str url)
 
Tuple[HiddenText, RevOptionsget_url_rev_options (self, HiddenText url)
 
bool compare_urls (cls, str url1, str url2)
 
None fetch_new (self, str dest, HiddenText url, RevOptions rev_options, int verbosity)
 
None switch (self, str dest, HiddenText url, RevOptions rev_options)
 
None update (self, str dest, HiddenText url, RevOptions rev_options)
 
bool is_commit_id_equal (cls, str dest, Optional[str] name)
 
None obtain (self, str dest, HiddenText url, int verbosity)
 
None unpack (self, str location, HiddenText url, int verbosity)
 
str get_remote_url (cls, str location)
 
str get_revision (cls, str location)
 
str run_command (cls, Union[List[str], CommandArgs] cmd, bool show_stdout=True, Optional[str] cwd=None, 'Literal["raise", "warn", "ignore"]' on_returncode="raise", Optional[Iterable[int]] extra_ok_returncodes=None, Optional[str] command_desc=None, Optional[Mapping[str, Any]] extra_environ=None, Optional[SpinnerInterface] spinner=None, bool log_failed_cmd=True, bool stdout_only=False)
 
bool is_repository_directory (cls, str path)
 
Optional[str] get_repository_root (cls, str location)
 

Static Public Member Functions

List[str] get_base_rev_args (str rev)
 
CommandArgs make_rev_args (Optional[str] username, Optional[HiddenText] password)
 
str normalize_url (str url)
 

Data Fields

 repo_name
 
 name
 
 dirname
 

Static Public Attributes

str name = ""
 
str dirname = ""
 
str repo_name = ""
 
tuple schemes = ()
 
tuple unset_environ = ()
 
Optional default_arg_rev = None
 

Protected Member Functions

bool _is_local_repository (cls, str repo)
 

Detailed Description

Definition at line 274 of file versioncontrol.py.

Member Function Documentation

◆ _is_local_repository()

bool _is_local_repository (   cls,
str  repo 
)
protected
posix absolute paths start with os.path.sep,
win32 ones start with drive (like c:\\folder)

Definition at line 368 of file versioncontrol.py.

368 def _is_local_repository(cls, repo: str) -> bool:
369 """
370 posix absolute paths start with os.path.sep,
371 win32 ones start with drive (like c:\\folder)
372 """
373 drive, tail = os.path.splitdrive(repo)
374 return repo.startswith(os.path.sep) or bool(drive)
375
for i

References i.

Referenced by Bazaar.get_remote_url(), and Mercurial.get_remote_url().

Here is the caller graph for this function:

◆ compare_urls()

bool compare_urls (   cls,
str  url1,
str  url2 
)
Compare two repo URLs for identity, ignoring incidental differences.

Definition at line 460 of file versioncontrol.py.

460 def compare_urls(cls, url1: str, url2: str) -> bool:
461 """
462 Compare two repo URLs for identity, ignoring incidental differences.
463 """
464 return cls.normalize_url(url1) == cls.normalize_url(url2)
465

References VersionControl.normalize_url().

Referenced by VersionControl.obtain().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fetch_new()

None fetch_new (   self,
str  dest,
HiddenText  url,
RevOptions  rev_options,
int   verbosity 
)
Fetch a revision from a repository, in the case that this is the
first fetch from the repository.

Args:
  dest: the directory to fetch the repository to.
  rev_options: a RevOptions object.
  verbosity: verbosity level.

Reimplemented in Bazaar, Mercurial, and Subversion.

Definition at line 466 of file versioncontrol.py.

468 ) -> None:
469 """
470 Fetch a revision from a repository, in the case that this is the
471 first fetch from the repository.
472
473 Args:
474 dest: the directory to fetch the repository to.
475 rev_options: a RevOptions object.
476 verbosity: verbosity level.
477 """
478 raise NotImplementedError
479

Referenced by VersionControl.obtain().

Here is the caller graph for this function:

◆ get_base_rev_args()

List[str] get_base_rev_args ( str  rev)
static
Return the base revision arguments for a vcs command.

Args:
  rev: the name of a revision to install.  Cannot be None.

Reimplemented in Bazaar, Mercurial, and Subversion.

Definition at line 332 of file versioncontrol.py.

332 def get_base_rev_args(rev: str) -> List[str]:
333 """
334 Return the base revision arguments for a vcs command.
335
336 Args:
337 rev: the name of a revision to install. Cannot be None.
338 """
339 raise NotImplementedError
340

◆ get_netloc_and_auth()

Tuple[str, Tuple[Optional[str], Optional[str]]] get_netloc_and_auth (   cls,
str  netloc,
str   scheme 
)
Parse the repository URL's netloc, and return the new netloc to use
along with auth information.

Args:
  netloc: the original repository URL netloc.
  scheme: the repository URL's scheme without the vcs prefix.

This is mainly for the Subversion class to override, so that auth
information can be provided via the --username and --password options
instead of through the URL.  For other subclasses like Git without
such an option, auth information must stay in the URL.

Returns: (netloc, (username, password)).

Reimplemented in Subversion.

Definition at line 377 of file versioncontrol.py.

379 ) -> Tuple[str, Tuple[Optional[str], Optional[str]]]:
380 """
381 Parse the repository URL's netloc, and return the new netloc to use
382 along with auth information.
383
384 Args:
385 netloc: the original repository URL netloc.
386 scheme: the repository URL's scheme without the vcs prefix.
387
388 This is mainly for the Subversion class to override, so that auth
389 information can be provided via the --username and --password options
390 instead of through the URL. For other subclasses like Git without
391 such an option, auth information must stay in the URL.
392
393 Returns: (netloc, (username, password)).
394 """
395 return netloc, (None, None)
396

Referenced by VersionControl.get_url_rev_and_auth().

Here is the caller graph for this function:

◆ get_remote_url()

str get_remote_url (   cls,
str  location 
)
Return the url used at location

Raises RemoteNotFoundError if the repository does not have a remote
url configured.

Reimplemented in Bazaar, Mercurial, and Subversion.

Definition at line 611 of file versioncontrol.py.

611 def get_remote_url(cls, location: str) -> str:
612 """
613 Return the url used at location
614
615 Raises RemoteNotFoundError if the repository does not have a remote
616 url configured.
617 """
618 raise NotImplementedError
619

Referenced by VersionControl.get_src_requirement(), and VersionControl.obtain().

Here is the caller graph for this function:

◆ get_repository_root()

Optional[str] get_repository_root (   cls,
str  location 
)
Return the "root" (top-level) directory controlled by the vcs,
or `None` if the directory is not in any.

It is meant to be overridden to implement smarter detection
mechanisms for specific vcs.

This can do more than is_repository_directory() alone. For
example, the Git override checks that Git is actually available.

Reimplemented in Mercurial.

Definition at line 692 of file versioncontrol.py.

692 def get_repository_root(cls, location: str) -> Optional[str]:
693 """
694 Return the "root" (top-level) directory controlled by the vcs,
695 or `None` if the directory is not in any.
696
697 It is meant to be overridden to implement smarter detection
698 mechanisms for specific vcs.
699
700 This can do more than is_repository_directory() alone. For
701 example, the Git override checks that Git is actually available.
702 """
703 if cls.is_repository_directory(location):
704 return location
705 return None

References VersionControl.is_repository_directory().

Here is the call graph for this function:

◆ get_requirement_revision()

str get_requirement_revision (   cls,
str  repo_dir 
)
Return the revision string that should be used in a requirement.

Reimplemented in Mercurial.

Definition at line 301 of file versioncontrol.py.

301 def get_requirement_revision(cls, repo_dir: str) -> str:
302 """
303 Return the revision string that should be used in a requirement.
304 """
305 return cls.get_revision(repo_dir)
306

References Bazaar.get_revision(), Mercurial.get_revision(), Subversion.get_revision(), and VersionControl.get_revision().

Referenced by VersionControl.get_src_requirement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_revision()

str get_revision (   cls,
str  location 
)
Return the current commit id of the files at the given location.

Reimplemented in Bazaar, Mercurial, and Subversion.

Definition at line 621 of file versioncontrol.py.

621 def get_revision(cls, location: str) -> str:
622 """
623 Return the current commit id of the files at the given location.
624 """
625 raise NotImplementedError
626

Referenced by VersionControl.get_requirement_revision().

Here is the caller graph for this function:

◆ get_src_requirement()

str get_src_requirement (   cls,
str  repo_dir,
str  project_name 
)
Return the requirement string to use to redownload the files
currently at the given repository directory.

Args:
  project_name: the (unescaped) project name.

The return value has a form similar to the following:

    {repository_url}@{revision}#egg={project_name}

Definition at line 308 of file versioncontrol.py.

308 def get_src_requirement(cls, repo_dir: str, project_name: str) -> str:
309 """
310 Return the requirement string to use to redownload the files
311 currently at the given repository directory.
312
313 Args:
314 project_name: the (unescaped) project name.
315
316 The return value has a form similar to the following:
317
318 {repository_url}@{revision}#egg={project_name}
319 """
320 repo_url = cls.get_remote_url(repo_dir)
321
322 if cls.should_add_vcs_url_prefix(repo_url):
323 repo_url = f"{cls.name}+{repo_url}"
324
325 revision = cls.get_requirement_revision(repo_dir)
326 subdir = cls.get_subdirectory(repo_dir)
327 req = make_vcs_requirement_url(repo_url, revision, project_name, subdir=subdir)
328
329 return req
330

References Bazaar.get_remote_url(), Mercurial.get_remote_url(), Subversion.get_remote_url(), VersionControl.get_remote_url(), Mercurial.get_requirement_revision(), VersionControl.get_requirement_revision(), Mercurial.get_subdirectory(), VersionControl.get_subdirectory(), pip._internal.vcs.versioncontrol.make_vcs_requirement_url(), Subversion.should_add_vcs_url_prefix(), and VersionControl.should_add_vcs_url_prefix().

Here is the call graph for this function:

◆ get_subdirectory()

Optional[str] get_subdirectory (   cls,
str  location 
)
Return the path to Python project root, relative to the repo root.
Return None if the project root is in the repo root.

Reimplemented in Mercurial.

Definition at line 293 of file versioncontrol.py.

293 def get_subdirectory(cls, location: str) -> Optional[str]:
294 """
295 Return the path to Python project root, relative to the repo root.
296 Return None if the project root is in the repo root.
297 """
298 return None
299

Referenced by VersionControl.get_src_requirement().

Here is the caller graph for this function:

◆ get_url_rev_and_auth()

Tuple[str, Optional[str], AuthInfo] get_url_rev_and_auth (   cls,
str  url 
)
Parse the repository URL to use, and return the URL, revision,
and auth info to use.

Returns: (url, rev, (username, password)).

Reimplemented in Bazaar, and Subversion.

Definition at line 398 of file versioncontrol.py.

398 def get_url_rev_and_auth(cls, url: str) -> Tuple[str, Optional[str], AuthInfo]:
399 """
400 Parse the repository URL to use, and return the URL, revision,
401 and auth info to use.
402
403 Returns: (url, rev, (username, password)).
404 """
405 scheme, netloc, path, query, frag = urllib.parse.urlsplit(url)
406 if "+" not in scheme:
407 raise ValueError(
408 "Sorry, {!r} is a malformed VCS url. "
409 "The format is <vcs>+<protocol>://<url>, "
410 "e.g. svn+http://myrepo/svn/MyApp#egg=MyApp".format(url)
411 )
412 # Remove the vcs prefix.
413 scheme = scheme.split("+", 1)[1]
414 netloc, user_pass = cls.get_netloc_and_auth(netloc, scheme)
415 rev = None
416 if "@" in path:
417 path, rev = path.rsplit("@", 1)
418 if not rev:
419 raise InstallationError(
420 "The URL {!r} has an empty revision (after @) "
421 "which is not supported. Include a revision after @ "
422 "or remove @ from the URL.".format(url)
423 )
424 url = urllib.parse.urlunsplit((scheme, netloc, path, query, ""))
425 return url, rev, user_pass
426

References Subversion.get_netloc_and_auth(), VersionControl.get_netloc_and_auth(), and i.

Referenced by VersionControl.get_url_rev_options().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_url_rev_options()

Tuple[HiddenText, RevOptions] get_url_rev_options (   self,
HiddenText  url 
)
Return the URL and RevOptions object to use in obtain(),
as a tuple (url, rev_options).

Definition at line 436 of file versioncontrol.py.

436 def get_url_rev_options(self, url: HiddenText) -> Tuple[HiddenText, RevOptions]:
437 """
438 Return the URL and RevOptions object to use in obtain(),
439 as a tuple (url, rev_options).
440 """
441 secret_url, rev, user_pass = self.get_url_rev_and_auth(url.secret)
442 username, secret_password = user_pass
443 password: Optional[HiddenText] = None
444 if secret_password is not None:
445 password = hide_value(secret_password)
446 extra_args = self.make_rev_args(username, password)
447 rev_options = self.make_rev_options(rev, extra_args=extra_args)
448
449 return hide_url(secret_url), rev_options
450

References Bazaar.get_url_rev_and_auth(), Subversion.get_url_rev_and_auth(), VersionControl.get_url_rev_and_auth(), i, Subversion.make_rev_args(), VersionControl.make_rev_args(), and VersionControl.make_rev_options().

Referenced by VersionControl.obtain().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_commit_id_equal()

bool is_commit_id_equal (   cls,
str  dest,
Optional[str]  name 
)
Return whether the id of the current commit equals the given name.

Args:
  dest: the repository directory.
  name: a string name.

Reimplemented in Bazaar, Mercurial, and Subversion.

Definition at line 499 of file versioncontrol.py.

499 def is_commit_id_equal(cls, dest: str, name: Optional[str]) -> bool:
500 """
501 Return whether the id of the current commit equals the given name.
502
503 Args:
504 dest: the repository directory.
505 name: a string name.
506 """
507 raise NotImplementedError
508

Referenced by VersionControl.obtain().

Here is the caller graph for this function:

◆ is_immutable_rev_checkout()

bool is_immutable_rev_checkout (   self,
str  url,
str  dest 
)
Return true if the commit hash checked out at dest matches
the revision in url.

Always return False, if the VCS does not support immutable commit
hashes.

This method does not check if there are local uncommitted changes
in dest after checkout, as pip currently has no use case for that.

Definition at line 341 of file versioncontrol.py.

341 def is_immutable_rev_checkout(self, url: str, dest: str) -> bool:
342 """
343 Return true if the commit hash checked out at dest matches
344 the revision in url.
345
346 Always return False, if the VCS does not support immutable commit
347 hashes.
348
349 This method does not check if there are local uncommitted changes
350 in dest after checkout, as pip currently has no use case for that.
351 """
352 return False
353

◆ is_repository_directory()

bool is_repository_directory (   cls,
str  path 
)
Return whether a directory path is a repository directory.

Definition at line 684 of file versioncontrol.py.

684 def is_repository_directory(cls, path: str) -> bool:
685 """
686 Return whether a directory path is a repository directory.
687 """
688 logger.debug("Checking in %s for %s (%s)...", path, cls.dirname, cls.name)
689 return os.path.exists(os.path.join(path, cls.dirname))
690

Referenced by VersionControl.get_repository_root(), and VersionControl.obtain().

Here is the caller graph for this function:

◆ make_rev_args()

CommandArgs make_rev_args ( Optional[str]  username,
Optional[HiddenText]   password 
)
static
Return the RevOptions "extra arguments" to use in obtain().

Reimplemented in Subversion.

Definition at line 428 of file versioncontrol.py.

430 ) -> CommandArgs:
431 """
432 Return the RevOptions "extra arguments" to use in obtain().
433 """
434 return []
435

Referenced by VersionControl.get_url_rev_options().

Here is the caller graph for this function:

◆ make_rev_options()

RevOptions make_rev_options (   cls,
Optional[str]   rev = None,
Optional[CommandArgs]   extra_args = None 
)
Return a RevOptions object.

Args:
  rev: the name of a revision to install.
  extra_args: a list of extra options.

Definition at line 355 of file versioncontrol.py.

357 ) -> RevOptions:
358 """
359 Return a RevOptions object.
360
361 Args:
362 rev: the name of a revision to install.
363 extra_args: a list of extra options.
364 """
365 return RevOptions(cls, rev, extra_args=extra_args)
366

Referenced by VersionControl.get_url_rev_options().

Here is the caller graph for this function:

◆ normalize_url()

str normalize_url ( str  url)
static
Normalize a URL for comparison by unquoting it and removing any
trailing slash.

Definition at line 452 of file versioncontrol.py.

452 def normalize_url(url: str) -> str:
453 """
454 Normalize a URL for comparison by unquoting it and removing any
455 trailing slash.
456 """
457 return urllib.parse.unquote(url).rstrip("/")
458

References i.

Referenced by VersionControl.compare_urls().

Here is the caller graph for this function:

◆ obtain()

None obtain (   self,
str  dest,
HiddenText  url,
int  verbosity 
)
Install or update in editable mode the package represented by this
VersionControl object.

:param dest: the repository directory in which to install or update.
:param url: the repository URL starting with a vcs prefix.
:param verbosity: verbosity level.

Definition at line 509 of file versioncontrol.py.

509 def obtain(self, dest: str, url: HiddenText, verbosity: int) -> None:
510 """
511 Install or update in editable mode the package represented by this
512 VersionControl object.
513
514 :param dest: the repository directory in which to install or update.
515 :param url: the repository URL starting with a vcs prefix.
516 :param verbosity: verbosity level.
517 """
518 url, rev_options = self.get_url_rev_options(url)
519
520 if not os.path.exists(dest):
521 self.fetch_new(dest, url, rev_options, verbosity=verbosity)
522 return
523
524 rev_display = rev_options.to_display()
525 if self.is_repository_directory(dest):
526 existing_url = self.get_remote_url(dest)
527 if self.compare_urls(existing_url, url.secret):
529 "%s in %s exists, and has correct URL (%s)",
530 self.repo_name.title(),
531 display_path(dest),
532 url,
533 )
534 if not self.is_commit_id_equal(dest, rev_options.rev):
536 "Updating %s %s%s",
537 display_path(dest),
538 self.repo_name,
539 rev_display,
540 )
541 self.update(dest, url, rev_options)
542 else:
543 logger.info("Skipping because already up-to-date.")
544 return
545
547 "%s %s in %s exists with URL %s",
548 self.name,
549 self.repo_name,
550 display_path(dest),
551 existing_url,
552 )
553 prompt = ("(s)witch, (i)gnore, (w)ipe, (b)ackup ", ("s", "i", "w", "b"))
554 else:
556 "Directory %s already exists, and is not a %s %s.",
557 dest,
558 self.name,
559 self.repo_name,
560 )
561 # https://github.com/python/mypy/issues/1174
562 prompt = ("(i)gnore, (w)ipe, (b)ackup ", ("i", "w", "b")) # type: ignore
563
565 "The plan is to install the %s repository %s",
566 self.name,
567 url,
568 )
569 response = ask_path_exists("What to do? {}".format(prompt[0]), prompt[1])
570
571 if response == "a":
572 sys.exit(-1)
573
574 if response == "w":
575 logger.warning("Deleting %s", display_path(dest))
576 rmtree(dest)
577 self.fetch_new(dest, url, rev_options, verbosity=verbosity)
578 return
579
580 if response == "b":
581 dest_dir = backup_dir(dest)
582 logger.warning("Backing up %s to %s", display_path(dest), dest_dir)
583 shutil.move(dest, dest_dir)
584 self.fetch_new(dest, url, rev_options, verbosity=verbosity)
585 return
586
587 # Do nothing if the response is "i".
588 if response == "s":
590 "Switching %s %s to %s%s",
591 self.repo_name,
592 display_path(dest),
593 url,
594 rev_display,
595 )
596 self.switch(dest, url, rev_options)
597

References VersionControl.compare_urls(), Bazaar.fetch_new(), Mercurial.fetch_new(), Subversion.fetch_new(), VersionControl.fetch_new(), Bazaar.get_remote_url(), Mercurial.get_remote_url(), Subversion.get_remote_url(), VersionControl.get_remote_url(), VersionControl.get_url_rev_options(), i, Bazaar.is_commit_id_equal(), Mercurial.is_commit_id_equal(), Subversion.is_commit_id_equal(), VersionControl.is_commit_id_equal(), VersionControl.is_repository_directory(), Bazaar.repo_name, Mercurial.repo_name, Subversion.repo_name, and VersionControl.repo_name.

Referenced by VersionControl.unpack().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ run_command()

str run_command (   cls,
Union[List[str], CommandArgs]  cmd,
bool   show_stdout = True,
Optional[str]   cwd = None,
'Literal["raise", "warn", "ignore"]'   on_returncode = "raise",
Optional[Iterable[int]]   extra_ok_returncodes = None,
Optional[str]   command_desc = None,
Optional[Mapping[str, Any]]   extra_environ = None,
Optional[SpinnerInterface]   spinner = None,
bool   log_failed_cmd = True,
bool   stdout_only = False 
)
Run a VCS subcommand
This is simply a wrapper around call_subprocess that adds the VCS
command name, and checks that the VCS is available

Definition at line 628 of file versioncontrol.py.

640 ) -> str:
641 """
642 Run a VCS subcommand
643 This is simply a wrapper around call_subprocess that adds the VCS
644 command name, and checks that the VCS is available
645 """
646 cmd = make_command(cls.name, *cmd)
647 if command_desc is None:
648 command_desc = format_command_args(cmd)
649 try:
650 return call_subprocess(
651 cmd,
652 show_stdout,
653 cwd,
654 on_returncode=on_returncode,
655 extra_ok_returncodes=extra_ok_returncodes,
656 command_desc=command_desc,
657 extra_environ=extra_environ,
658 unset_environ=cls.unset_environ,
659 spinner=spinner,
660 log_failed_cmd=log_failed_cmd,
661 stdout_only=stdout_only,
662 )
663 except FileNotFoundError:
664 # errno.ENOENT = no such file or directory
665 # In other words, the VCS executable isn't available
666 raise BadCommand(
667 f"Cannot find command {cls.name!r} - do you have "
668 f"{cls.name!r} installed and in your PATH?"
669 )
670 except PermissionError:
671 # errno.EACCES = Permission denied
672 # This error occurs, for instance, when the command is installed
673 # only for another user. So, the current user don't have
674 # permission to call the other user command.
675 raise BadCommand(
676 f"No permission to execute {cls.name!r} - install it "
677 f"locally, globally (ask admin), or check your PATH. "
678 f"See possible solutions at "
679 f"https://pip.pypa.io/en/latest/reference/pip_freeze/"
680 f"#fixing-permission-denied."
681 )
682

References MunitParameterEnum.name, MunitParameter.name, MunitTest.name, MunitArgument_.name, Command.name, ConfigOptionParser.name, TransformedHit.name, _PackageInfo.name, InvalidWheel.name, BaseEntryPoint.name(), BasePath.name(), EntryPoint.name, InstallationCandidate.name, VcsInfo.name, ArchiveInfo.name, DirInfo.name, LinkHash.name, Wheel.name, LazyZipOverHTTP.name(), FrozenRequirement.name, InstallationResult.name, InstallRequirement.name(), InstallRequirement.name, Requirement.name(), Candidate.name(), _InstallRequirementBackedCandidate.name(), _InstallRequirementBackedCandidate.name, AlreadyInstalledCandidate.name, AlreadyInstalledCandidate.name(), ExtrasCandidate.name(), RequiresPythonCandidate.name(), ExplicitRequirement.name(), SpecifierRequirement.name(), RequiresPythonRequirement.name(), UnsatisfiableRequirement.name(), Bazaar.name, Mercurial.name, Subversion.name, VcsSupport.name, VersionControl.name, CodingStateMachineDict.name, Language.name, _Cache.name, Distribution.name, InstalledDistribution.name, EggInfoDistribution.name, LegacyMetadata.name, Metadata.name, ResourceBase.name, ExportEntry.name, Matcher.name, LinuxDistribution.name(), Formatter.name, BBCodeFormatter.name, GroffFormatter.name, HtmlFormatter.name, ImageFormatter.name, GifImageFormatter.name, JpgImageFormatter.name, BmpImageFormatter.name, IRCFormatter.name, LatexFormatter.name, NullFormatter.name, RawTokenFormatter.name, TestcaseFormatter.name, PangoMarkupFormatter.name, RtfFormatter.name, SvgFormatter.name, TerminalFormatter.name, Terminal256Formatter.name, TerminalTrueColorFormatter.name, Lexer.name, PythonLexer.name, Python2Lexer.name, _PythonConsoleLexerBase.name, PythonConsoleLexer.name, PythonTracebackLexer.name, Python2TracebackLexer.name, CythonLexer.name, DgLexer.name, NumPyLexer.name, ParserElement.name(), EditablePartial.name(), ElementState.name, LookupDict.name, Color.name, Emoji.name, Splitter.name, RowSplitter.name, ColumnSplitter.name, Layout.name, Tag.name, StockKeepingUnit.name, _Reader.name(), Frame.name, _LazyDescr.name, _SixMetaPathImporter.name, Encoding.name, and VersionControl.unset_environ.

Referenced by Subversion._get_svn_url_rev(), Subversion.call_vcs_version(), Bazaar.fetch_new(), Mercurial.fetch_new(), Subversion.fetch_new(), Bazaar.get_remote_url(), Mercurial.get_remote_url(), Mercurial.get_repository_root(), Mercurial.get_requirement_revision(), Bazaar.get_revision(), Mercurial.get_revision(), Mercurial.get_subdirectory(), PackageIndex.sign_file(), Bazaar.switch(), Mercurial.switch(), Subversion.switch(), Bazaar.update(), Mercurial.update(), Subversion.update(), and PackageIndex.verify_signature().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ should_add_vcs_url_prefix()

bool should_add_vcs_url_prefix (   cls,
str  remote_url 
)
Return whether the vcs prefix (e.g. "git+") should be added to a
repository's remote url when used in a requirement.

Reimplemented in Subversion.

Definition at line 285 of file versioncontrol.py.

285 def should_add_vcs_url_prefix(cls, remote_url: str) -> bool:
286 """
287 Return whether the vcs prefix (e.g. "git+") should be added to a
288 repository's remote url when used in a requirement.
289 """
290 return not remote_url.lower().startswith(f"{cls.name}:")
291

References i.

Referenced by VersionControl.get_src_requirement().

Here is the caller graph for this function:

◆ switch()

None switch (   self,
str  dest,
HiddenText  url,
RevOptions  rev_options 
)
Switch the repo at ``dest`` to point to ``URL``.

Args:
  rev_options: a RevOptions object.

Reimplemented in Bazaar, Mercurial, and Subversion.

Definition at line 480 of file versioncontrol.py.

480 def switch(self, dest: str, url: HiddenText, rev_options: RevOptions) -> None:
481 """
482 Switch the repo at ``dest`` to point to ``URL``.
483
484 Args:
485 rev_options: a RevOptions object.
486 """
487 raise NotImplementedError
488

◆ unpack()

None unpack (   self,
str  location,
HiddenText  url,
int  verbosity 
)
Clean up current location and download the url repository
(and vcs infos) into location

:param url: the repository URL starting with a vcs prefix.
:param verbosity: verbosity level.

Definition at line 598 of file versioncontrol.py.

598 def unpack(self, location: str, url: HiddenText, verbosity: int) -> None:
599 """
600 Clean up current location and download the url repository
601 (and vcs infos) into location
602
603 :param url: the repository URL starting with a vcs prefix.
604 :param verbosity: verbosity level.
605 """
606 if os.path.exists(location):
607 rmtree(location)
608 self.obtain(location, url=url, verbosity=verbosity)
609

References i, Environment.obtain(), and VersionControl.obtain().

Here is the call graph for this function:

◆ update()

None update (   self,
str  dest,
HiddenText  url,
RevOptions  rev_options 
)
Update an already-existing repo to the given ``rev_options``.

Args:
  rev_options: a RevOptions object.

Reimplemented in Bazaar, Mercurial, and Subversion.

Definition at line 489 of file versioncontrol.py.

489 def update(self, dest: str, url: HiddenText, rev_options: RevOptions) -> None:
490 """
491 Update an already-existing repo to the given ``rev_options``.
492
493 Args:
494 rev_options: a RevOptions object.
495 """
496 raise NotImplementedError
497

Referenced by Progress.increment(), Progress.open(), Progress.start(), Progress.stop(), Progress.track(), and Progress.wrap_file().

Here is the caller graph for this function:

Field Documentation

◆ default_arg_rev

Optional default_arg_rev = None
static

Definition at line 282 of file versioncontrol.py.

◆ dirname [1/2]

◆ dirname [2/2]

◆ name [1/2]

str name = ""
static

Definition at line 275 of file versioncontrol.py.

Referenced by AlreadyInstalledCandidate.__eq__(), Distribution.__eq__(), ExportEntry.__eq__(), _LazyDescr.__get__(), Distribution.__hash__(), ElementState.__init__(), Requirement.__init__(), LinkHash.__post_init__(), InstallationCandidate.__repr__(), Distribution.__repr__(), Metadata.__repr__(), ExportEntry.__repr__(), Encoding.__repr__(), Color.__rich_repr__(), Layout.__rich_repr__(), InstallationCandidate.__str__(), InstalledDistribution.__str__(), EggInfoDistribution.__str__(), Requirement.__str__(), ParserElement.__str__(), Tag.__str__(), _SixMetaPathImporter._add_module(), Matcher._check_compatible(), InstallRequirement._get_archive_name(), Wheel._get_extensions(), _SixMetaPathImporter._get_module(), ConfigOptionParser._get_ordered_configuration_items(), Distribution._get_requirements(), _Cache.add(), InstallRequirement.archive(), LinkHash.as_dict(), LinkHash.as_hashes(), Wheel.build(), _Cache.clear(), Wheel.filename(), Layout.get(), InstallRequirement.get_dist(), InstalledDistribution.get_distinfo_file(), RequirementCommand.get_requirements(), Wheel.get_wheel_metadata(), InstallRequirement.install(), Wheel.install(), SpecifierRequirement.is_satisfied_by(), LinuxDistribution.linux_distribution(), Wheel.metadata(), Distribution.name_and_version(), InstallRequirement.prepare_metadata(), Distribution.provides(), Metadata.provides(), VcsSupport.register(), VersionControl.run_command(), InstallRequirement.uninstall(), Wheel.update(), and Wheel.verify().

◆ name [2/2]

name

Definition at line 548 of file versioncontrol.py.

Referenced by AlreadyInstalledCandidate.__eq__(), Distribution.__eq__(), ExportEntry.__eq__(), _LazyDescr.__get__(), Distribution.__hash__(), ElementState.__init__(), Requirement.__init__(), LinkHash.__post_init__(), InstallationCandidate.__repr__(), Distribution.__repr__(), Metadata.__repr__(), ExportEntry.__repr__(), Encoding.__repr__(), Color.__rich_repr__(), Layout.__rich_repr__(), InstallationCandidate.__str__(), InstalledDistribution.__str__(), EggInfoDistribution.__str__(), Requirement.__str__(), ParserElement.__str__(), Tag.__str__(), _SixMetaPathImporter._add_module(), Matcher._check_compatible(), InstallRequirement._get_archive_name(), Wheel._get_extensions(), _SixMetaPathImporter._get_module(), ConfigOptionParser._get_ordered_configuration_items(), Distribution._get_requirements(), _Cache.add(), InstallRequirement.archive(), LinkHash.as_dict(), LinkHash.as_hashes(), Wheel.build(), _Cache.clear(), Wheel.filename(), Layout.get(), InstallRequirement.get_dist(), InstalledDistribution.get_distinfo_file(), RequirementCommand.get_requirements(), Wheel.get_wheel_metadata(), InstallRequirement.install(), Wheel.install(), SpecifierRequirement.is_satisfied_by(), LinuxDistribution.linux_distribution(), Wheel.metadata(), Distribution.name_and_version(), InstallRequirement.prepare_metadata(), Distribution.provides(), Metadata.provides(), VcsSupport.register(), VersionControl.run_command(), InstallRequirement.uninstall(), Wheel.update(), and Wheel.verify().

◆ repo_name [1/2]

str repo_name = ""
static

Definition at line 277 of file versioncontrol.py.

Referenced by VersionControl.obtain().

◆ repo_name [2/2]

repo_name

Definition at line 538 of file versioncontrol.py.

Referenced by VersionControl.obtain().

◆ schemes

tuple schemes = ()
static

Definition at line 279 of file versioncontrol.py.

◆ unset_environ

tuple unset_environ = ()
static

Definition at line 281 of file versioncontrol.py.

Referenced by VersionControl.run_command().


The documentation for this class was generated from the following file: