def _detect_scm_revision(path): if not path: raise ConanException("Not path supplied") repo_type = SCM.detect_scm(path) if not repo_type: raise ConanException("'{}' repository not detected".format(repo_type)) repo_obj = SCM.availables.get(repo_type)(path) return repo_obj.get_revision(), repo_type, repo_obj.is_pristine()
def _detect_scm_revision(path): if not path: return None, None repo_type = SCM.detect_scm(path) if not repo_type: return None, None repo_obj = SCM.availables.get(repo_type)(path) return repo_obj.get_revision(), repo_type
def test_none(self): r = SCM.detect_scm(folder=tempfile.gettempdir()) self.assertEqual(r, None)
def test_git(self): with mock.patch("conans.client.tools.scm.Git.check_repo", return_value=None): r = SCM.detect_scm(folder=tempfile.gettempdir()) self.assertEqual(r, "git")
def test_none(self): r = SCM.detect_scm(folder=self.folder) self.assertEqual(r, None)
def test_svn(self): with mock.patch("conans.client.tools.scm.SVN.check_repo", return_value=None): r = SCM.detect_scm(folder=self.folder) self.assertEqual(r, "svn")