OpenQuizz
Une application de gestion des contenus pédagogiques
VersionControl Class Reference
Inheritance diagram for VersionControl:

Public Member Functions

def should_add_vcs_url_prefix (cls, remote_url)
 
def get_subdirectory (cls, location)
 
def get_requirement_revision (cls, repo_dir)
 
def get_src_requirement (cls, repo_dir, project_name)
 
def is_immutable_rev_checkout (self, url, dest)
 
def make_rev_options (cls, rev=None, extra_args=None)
 
def get_netloc_and_auth (cls, netloc, scheme)
 
def get_url_rev_and_auth (cls, url)
 
def get_url_rev_options (self, url)
 
def compare_urls (cls, url1, url2)
 
def fetch_new (self, dest, url, rev_options)
 
def switch (self, dest, url, rev_options)
 
def update (self, dest, url, rev_options)
 
def is_commit_id_equal (cls, dest, name)
 
def obtain (self, dest, url)
 
def unpack (self, location, url)
 
def get_remote_url (cls, location)
 
def get_revision (cls, location)
 
def run_command (cls, cmd, show_stdout=True, cwd=None, on_returncode='raise', extra_ok_returncodes=None, command_desc=None, extra_environ=None, spinner=None, log_failed_cmd=True, stdout_only=False)
 
def is_repository_directory (cls, path)
 
def get_repository_root (cls, location)
 

Static Public Member Functions

def get_base_rev_args (rev)
 
def make_rev_args (username, password)
 
def normalize_url (url)
 

Static Public Attributes

 name
 
 dirname
 
 repo_name
 
 schemes
 
 unset_environ
 
 default_arg_rev
 

Member Function Documentation

◆ compare_urls()

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

◆ fetch_new()

def fetch_new (   self,
  dest,
  url,
  rev_options 
)
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.

Reimplemented in Subversion, Git, Mercurial, and Bazaar.

◆ get_base_rev_args()

def get_base_rev_args (   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 Git, Subversion, Mercurial, and Bazaar.

◆ get_netloc_and_auth()

def get_netloc_and_auth (   cls,
  netloc,
  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.

◆ get_remote_url()

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

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

Reimplemented in Git, Subversion, Mercurial, and Bazaar.

◆ get_repository_root()

def get_repository_root (   cls,
  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 Git, and Mercurial.

◆ get_requirement_revision()

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

Reimplemented in Mercurial.

◆ get_revision()

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

Reimplemented in Mercurial, Bazaar, and Subversion.

◆ get_src_requirement()

def get_src_requirement (   cls,
  repo_dir,
  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}

◆ get_subdirectory()

def get_subdirectory (   cls,
  location 
)
Return the path to setup.py, relative to the repo root.
Return None if setup.py is in the repo root.

Reimplemented in Git, and Mercurial.

◆ get_url_rev_and_auth()

def get_url_rev_and_auth (   cls,
  url 
)
Parse the repository URL to use, and return the URL, revision,
and auth info to use.

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

Reimplemented in Git, Subversion, and Bazaar.

◆ get_url_rev_options()

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

◆ is_commit_id_equal()

def is_commit_id_equal (   cls,
  dest,
  name 
)
Return whether the id of the current commit equals the given name.

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

Reimplemented in Git, Subversion, Mercurial, and Bazaar.

◆ is_immutable_rev_checkout()

def is_immutable_rev_checkout (   self,
  url,
  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.

Reimplemented in Git.

◆ is_repository_directory()

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

◆ make_rev_args()

def make_rev_args (   username,
  password 
)
static
Return the RevOptions "extra arguments" to use in obtain().

Reimplemented in Subversion.

◆ make_rev_options()

def make_rev_options (   cls,
  rev = None,
  extra_args = None 
)
Return a RevOptions object.

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

◆ normalize_url()

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

◆ obtain()

def obtain (   self,
  dest,
  url 
)
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.

◆ run_command()

def run_command (   cls,
  cmd,
  show_stdout = True,
  cwd = None,
  on_returncode = 'raise',
  extra_ok_returncodes = None,
  command_desc = None,
  extra_environ = None,
  spinner = None,
  log_failed_cmd = True,
  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

◆ should_add_vcs_url_prefix()

def should_add_vcs_url_prefix (   cls,
  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.

◆ switch()

def switch (   self,
  dest,
  url,
  rev_options 
)
Switch the repo at ``dest`` to point to ``URL``.

Args:
  rev_options: a RevOptions object.

Reimplemented in Subversion, Git, Mercurial, and Bazaar.

◆ unpack()

def unpack (   self,
  location,
  url 
)
Clean up current location and download the url repository
(and vcs infos) into location

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

◆ update()

def update (   self,
  dest,
  url,
  rev_options 
)
Update an already-existing repo to the given ``rev_options``.

Args:
  rev_options: a RevOptions object.

Reimplemented in Subversion, Git, Mercurial, and Bazaar.

Field Documentation

◆ default_arg_rev

default_arg_rev
static

◆ dirname

dirname
static

◆ name

name
static

◆ repo_name

repo_name
static

◆ schemes

schemes
static

◆ unset_environ

unset_environ
static

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