prospector/git/git.py
def clone(self, shallow=None, skip_existing=False):
        """
        Clones the specified repository checking out the default branch in a subdir of output_folder.
        Shallow=true speeds up considerably the operation, but gets no history.
        """
        if shallow:
            self._shallow_clone = shallow

        if not self._url:
            _logger.error("Invalid url specified.")
            sys.exit(-1)

        # TODO rearrange order of checks
        if os.path.isdir(os.path.join(self._path, ".git")):
            if skip_existing:
                _logger.debug(f"Skipping fetch of {self._url} in {self._path}")
            else:
                _logger.debug(
                    f"\nFound repo {self._url} in {self._path}.\nFetching...."
                )

                self._exec.run(["git", "fetch", "--progress", "--all", "--tags"])
                # , cwd=self._path, timeout=self._exec_timeout)
            return

        if os.path.exists(self._path):
            _logger.debug(
                "Folder {} exists but it contains no git repository.".format(self._path)
            )
            return

        os.makedirs(self._path)

        _logger.debug(f"Cloning {self._url} (shallow={self._shallow_clone})")

        if not self._exec.run(["git", "init"], ignore_output=True):
            _logger.error(f"Failed to initialize repository in {self._path}")

        try:
            self._exec.run(
                ["git", "remote", "add", "origin", self._url], ignore_output=True
            )
            #  , cwd=self._path)
        except Exception as ex:
            _logger.error(f"Could not update remote in {self._path}", exc_info=True)
            shutil.rmtree(self._path)
            raise ex

        try:
            if self._shallow_clone:
                self._exec.run(["git", "fetch", "--depth", "1"])  # , cwd=self._path)
                # sh.git.fetch('--depth', '1', 'origin', _cwd=self._path)
            else:
                # sh.git.fetch('--all', '--tags', _cwd=self._path)
                self._exec.run(
                    ["git", "fetch", "--progress", "--all", "--tags"]
                )  # , cwd=self._path)
                # self._exec.run_l(['git', 'fetch', '--tags'], cwd=self._path)
        except Exception as ex:
            _logger.error(
                f"Could not fetch {self._url} (shallow={str(self._shallow_clone)}) in {self._path}",
                exc_info=True,
            )
            shutil.rmtree(self._path)
            raise ex

        Clones the specified repository checking out the default branch in a subdir of output_folder.
        Shallow=true speeds up considerably the operation, but gets no history.
        
Clones the specified repository checking out the default branch in a subdir of output_folder.
Shallow=true speeds up considerably the operation, but gets no history.
Clones the specified repository checking out the default branch in a subdir of output_folder . Shallow = true speeds up considerably the operation but gets no history .
def clone(self, shallow=None, skip_existing=False):
        if shallow:
            self._shallow_clone = shallow
        if not self._url:
            _logger.error("Invalid url specified.")
            sys.exit(-1)
        if os.path.isdir(os.path.join(self._path, ".git")):
            if skip_existing:
                _logger.debug(f"Skipping fetch of {self._url} in {self._path}")
            else:
                _logger.debug(
                    f"\nFound repo {self._url} in {self._path}.\nFetching...."
                )
                self._exec.run(["git", "fetch", "--progress", "--all", "--tags"])
            return
        if os.path.exists(self._path):
            _logger.debug(
                "Folder {} exists but it contains no git repository.".format(self._path)
            )
            return
        os.makedirs(self._path)
        _logger.debug(f"Cloning {self._url} (shallow={self._shallow_clone})")
        if not self._exec.run(["git", "init"], ignore_output=True):
            _logger.error(f"Failed to initialize repository in {self._path}")
        try:
            self._exec.run(
                ["git", "remote", "add", "origin", self._url], ignore_output=True
            )
        except Exception as ex:
            _logger.error(f"Could not update remote in {self._path}", exc_info=True)
            shutil.rmtree(self._path)
            raise ex
        try:
            if self._shallow_clone:
                self._exec.run(["git", "fetch", "--depth", "1"])  
            else:
                self._exec.run(
                    ["git", "fetch", "--progress", "--all", "--tags"]
                )  
        except Exception as ex:
            _logger.error(
                f"Could not fetch {self._url} (shallow={str(self._shallow_clone)}) in {self._path}",
                exc_info=True,
            )
            shutil.rmtree(self._path)
            raise ex
def clone ( self , shallow = None , skip_existing = False ) : if shallow : self . _shallow_clone = shallow if not self . _url : _logger . error ( "Invalid url specified." ) sys . exit ( - 1 ) if os . path . isdir ( os . path . join ( self . _path , ".git" ) ) : if skip_existing : _logger . debug ( f"Skipping fetch of {self._url} in {self._path}" ) else : _logger . debug ( f"\nFound repo {self._url} in {self._path}.\nFetching...." ) self . _exec . run ( [ "git" , "fetch" , "--progress" , "--all" , "--tags" ] ) return if os . path . exists ( self . _path ) : _logger . debug ( "Folder {} exists but it contains no git repository." . format ( self . _path ) ) return os . makedirs ( self . _path ) _logger . debug ( f"Cloning {self._url} (shallow={self._shallow_clone})" ) if not self . _exec . run ( [ "git" , "init" ] , ignore_output = True ) : _logger . error ( f"Failed to initialize repository in {self._path}" ) try : self . _exec . run ( [ "git" , "remote" , "add" , "origin" , self . _url ] , ignore_output = True ) except Exception as ex : _logger . error ( f"Could not update remote in {self._path}" , exc_info = True ) shutil . rmtree ( self . _path ) raise ex try : if self . _shallow_clone : self . _exec . run ( [ "git" , "fetch" , "--depth" , "1" ] ) else : self . _exec . run ( [ "git" , "fetch" , "--progress" , "--all" , "--tags" ] ) except Exception as ex : _logger . error ( f"Could not fetch {self._url} (shallow={str(self._shallow_clone)}) in {self._path}" , exc_info = True , ) shutil . rmtree ( self . _path ) raise ex
Clones the specified repository checking out the default branch in a subdir of output_folder.
Clones the specified repository checking out the default branch in a subdir of output_folder .
"""
        Clones the specified repository checking out the default branch in a subdir of output_folder.
        Shallow=true speeds up considerably the operation, but gets no history.
        """ # TODO rearrange order of checks # , cwd=self._path, timeout=self._exec_timeout) #  , cwd=self._path) # , cwd=self._path) # sh.git.fetch('--depth', '1', 'origin', _cwd=self._path) # sh.git.fetch('--all', '--tags', _cwd=self._path) # , cwd=self._path) # self._exec.run_l(['git', 'fetch', '--tags'], cwd=self._path)
self
shallow
skip_existing