Skip to content

Commit

Permalink
!squash projects.git.obtain: Start moving over, needs logging in real…
Browse files Browse the repository at this point in the history
… time
  • Loading branch information
tony committed May 29, 2022
1 parent b7b96e0 commit 71184e6
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions libvcs/projects/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
from typing import Dict, Optional, TypedDict, Union
from urllib import parse as urlparse

from libvcs.cmd.git import Git

from .. import exc
from .base import BaseProject, VCSLocation, convert_pip_url as base_convert_pip_url

Expand Down Expand Up @@ -300,24 +302,26 @@ def set_remotes(self, overwrite: bool = False):

def obtain(self, *args, **kwargs):
"""Retrieve the repository, clone if doesn't exist."""
self.ensure_dir()

url = self.url
clone_kwargs = {}

cmd = ["clone", "--progress"]
if self.git_shallow:
cmd.extend(["--depth", "1"])
clone_kwargs["depth"] = 1
if self.tls_verify:
cmd.extend(["-c", "http.sslVerify=false"])
cmd.extend([url, self.dir])
clone_kwargs["c"] = "http.sslVerify=false"

self.log.info("Cloning.")
self.run(cmd, log_in_real_time=True)

git = Git(dir=self.dir)

# Needs to log to std out, e.g. log_in_real_time
git.clone(url=self.url, progress=True, make_parents=True, **clone_kwargs)

self.log.info("Initializing submodules.")

self.run(["submodule", "init"], log_in_real_time=True)
cmd = ["submodule", "update", "--recursive", "--init"]
self.run(cmd, log_in_real_time=True)
self.run(
["submodule", "update", "--recursive", "--init"], log_in_real_time=True
)

self.set_remotes(overwrite=True)

Expand Down

0 comments on commit 71184e6

Please sign in to comment.