diff options
author | Christopher Phang <christopher.phang@codethink.co.uk> | 2016-09-26 13:48:05 +0000 |
---|---|---|
committer | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2016-09-26 16:36:18 +0000 |
commit | 5cdb8bb57135ed9829bb55b16a781e713adc2154 (patch) | |
tree | 79f7a5fd69d532ce1f38f896eb770575a2c512f1 /morphlib | |
parent | a3d3e81914b4bcb157ce862e15196294ac943b52 (diff) | |
download | morph-5cdb8bb57135ed9829bb55b16a781e713adc2154.tar.gz |
The clone_into functions were deprecated from commit
014a029ade9a045a839ca86c35690b218098ea33, but
functions in baserock-import still depend on these functions.
Change-Id: I7362e1ae70bf86677b0019248ca8538912507b51
Diffstat (limited to 'morphlib')
-rw-r--r-- | morphlib/git.py | 6 | ||||
-rw-r--r-- | morphlib/gitdir.py | 3 |
2 files changed, 9 insertions, 0 deletions
diff --git a/morphlib/git.py b/morphlib/git.py index 5f2ca7f6..063ec0e7 100644 --- a/morphlib/git.py +++ b/morphlib/git.py @@ -264,6 +264,12 @@ def is_valid_sha1(ref): return len(ref) == 40 and all(x in string.hexdigits for x in ref) +def clone_into(runcmd, srcpath, targetpath, ref=None): + '''Clones a repo in srcpath into targetpath, optionally directly at ref.''' + if ref is None: + runcmd(['git', 'clone', srcpath, targetpath]) + else: + runcmd(['git', 'clone', '-b', ref, srcpath, targetpath]) def gitcmd(runcmd, *args, **kwargs): '''Run git commands safely''' diff --git a/morphlib/gitdir.py b/morphlib/gitdir.py index f1286b25..0189ccb6 100644 --- a/morphlib/gitdir.py +++ b/morphlib/gitdir.py @@ -484,6 +484,9 @@ class GitDirectory(object): # Exact error is logged already by the runcmd() function. raise NoGitRepoError(self.dirname) + def clone_into(self, dst, ref=None): #pragma: no cover + morphlib.git.clone_into(cliapp.runcmd, self.dirname, dst, ref=ref) + def checkout(self, branch_name): # pragma: no cover '''Check out a git branch.''' morphlib.git.gitcmd(self._runcmd, 'checkout', branch_name) |