anod.checkout
=============

.. py:module:: anod.checkout


Attributes
----------

.. autoapisummary::

   anod.checkout.logger


Classes
-------

.. autoapisummary::

   anod.checkout.CheckoutManager


Module Contents
---------------

.. py:data:: logger

.. py:class:: CheckoutManager(name: str, working_dir: str, compute_changelog: bool = True)

   Helper class to manage checkouts done by Anod tools.

   When a checkout manager is used in working_dir directory for a repository
   called name. The following structure will be found on disk after an update

       working_dir/name/               The repository checkout
                  /name_checkout.json  A json containing some metadata: name,
                                       url, old_commit, new_commit, revision
                  /name_changelog.json A json containing the list of commit
                                       between two call to update. If this is
                                       the inital checkout or there are no
                                       changes then the file will not be
                                       created


   .. py:attribute:: name


   .. py:attribute:: compute_changelog
      :value: True



   .. py:attribute:: working_dir
      :value: b'.'



   .. py:attribute:: metadata_file


   .. py:attribute:: changelog_file


   .. py:method:: update(vcs: Literal['git'] | Literal['svn'] | Literal['external'], url: str, revision: str | None = None) -> e3.anod.status.ReturnValue

      Update content of the working directory.

      :param vcs: vcs kind
      :param url: repository url, when vcs is external the url is the path
           to the source directory
      :param revision: revision

      Note that when vcs is set to git or svn, the version control ignore
      setting is taken into account. Additionally, when the vcs is
      external and the source directory contains a .git subdirectory then
      git ignore setting is taken into account.



   .. py:method:: update_external(url: str, revision: str | None) -> tuple[e3.anod.status.ReturnValue, str, str]

      Update working dir using a local directory.

      :param url: path to the repository
      :param revision: ignored

      If <url>/.git is a directory then git ls-files will be called to get
      the list of files to ignore.



   .. py:method:: git_remote_name(url: str) -> str
      :staticmethod:


      Return the remote name computed for an url.

      :param url: the git url
      :return: the remote name



   .. py:method:: update_git(url: str, revision: str | None) -> tuple[e3.anod.status.ReturnValue, str | None, str | None]

      Update working dir using a Git repository.

      :param url: git repository url
      :param revision: git revision



   .. py:method:: update_svn(url: str, revision: str | None) -> tuple[e3.anod.status.ReturnValue, str | None, str | None]

      Update working dir using a SVN repository.

      :param url: git repository url
      :param revision: git revision



