本文整理汇总了Python中git.Git.isRepository方法的典型用法代码示例。如果您正苦于以下问题:Python Git.isRepository方法的具体用法?Python Git.isRepository怎么用?Python Git.isRepository使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类git.Git
的用法示例。
在下文中一共展示了Git.isRepository方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Moodle
# 需要导入模块: from git import Git [as 别名]
# 或者: from git.Git import isRepository [as 别名]
#.........这里部分代码省略.........
if self._dbo == None:
engine = self.get("dbtype")
db = self.get("dbname")
if engine != None and db != None:
try:
self._dbo = DB(engine, C.get("db.%s" % engine))
except:
pass
return self._dbo
def generateBranchName(self, issue, suffix="", version=""):
"""Generates a branch name"""
mdl = re.sub(r"(MDL|mdl)(-|_)?", "", issue)
if version == "":
version = self.get("branch")
args = {"issue": mdl, "version": version}
branch = C.get("wording.branchFormat") % args
if suffix != None and suffix != "":
branch += C.get("wording.branchSuffixSeparator") + suffix
return branch
def get(self, param, default=None):
"""Returns a property of this instance"""
info = self.info()
try:
return info[param]
except:
return default
def git(self):
"""Returns a Git object"""
if self._git == None:
self._git = Git(self.path, C.get("git"))
if not self._git.isRepository():
raise Exception("Could not find the Git repository")
return self._git
def initPHPUnit(self, force=False):
"""Initialise the PHPUnit environment"""
if self.branch_compare(23, "<"):
raise Exception("PHPUnit is only available from Moodle 2.3")
# Set PHPUnit data root
phpunit_dataroot = self.get("dataroot") + "_phpu"
self.updateConfig("phpunit_dataroot", phpunit_dataroot)
if not os.path.isdir(phpunit_dataroot):
os.mkdir(phpunit_dataroot, 0777)
# Set PHPUnit prefix
phpunit_prefix = "phpu_"
self.updateConfig("phpunit_prefix", phpunit_prefix)
result = (None, None, None)
exception = None
try:
if force:
result = self.cli("/admin/tool/phpunit/cli/util.php", args="--drop", stdout=None, stderr=None)
result = self.cli("/admin/tool/phpunit/cli/init.php", stdout=None, stderr=None)
except Exception as exception:
pass
if exception != None or result[0] > 0:
if result[0] == 129:
raise Exception("PHPUnit is not installed on your system")
elif result[0] > 0:
示例2: Moodle
# 需要导入模块: from git import Git [as 别名]
# 或者: from git.Git import isRepository [as 别名]
#.........这里部分代码省略.........
if engine != None and db != None:
try:
self._dbo = DB(engine, C.get('db.%s' % engine))
except:
pass
return self._dbo
def generateBranchName(self, issue, suffix='', version=''):
"""Generates a branch name"""
mdl = re.sub(r'(MDL|mdl)(-|_)?', '', issue)
if version == '':
version = self.get('branch')
args = {
'issue': mdl,
'version': version
}
branch = C.get('wording.branchFormat') % args
if suffix != None and suffix != '':
branch += C.get('wording.branchSuffixSeparator') + suffix
return branch
def get(self, param, default=None):
"""Returns a property of this instance"""
info = self.info()
try:
return info[param]
except:
return default
def git(self):
"""Returns a Git object"""
if self._git == None:
self._git = Git(self.path, C.get('git'))
if not self._git.isRepository():
raise Exception('Could not find the Git repository')
return self._git
def headcommit(self, branch=None):
"""Try to resolve the head commit of branch of this instance"""
if branch == None:
branch = self.currentBranch()
if branch == 'HEAD':
raise Exception('Cannot update the tracker when on detached branch')
smartSearch = C.get('smartHeadCommitSearch')
# Parsing the branch
parsedbranch = parseBranch(branch, C.get('wording.branchRegex'))
if parsedbranch:
issue = 'MDL-%s' % (parsedbranch['issue'])
else:
logging.debug('Cannot smart resolve using the branch %s' % (branch))
smartSearch = False
headcommit = None
try:
# Trying to smart guess the last commit needed
if smartSearch:
commits = self.git().log(since=branch, count=C.get('smartHeadCommitLimit'), format='%s_____%h').split('\n')[:-1]
# Looping over the last commits to find the commit messages that match the MDL-12345.
candidate = None
for commit in commits:
match = getMDLFromCommitMessage(commit) == issue
if not candidate and not match:
示例3: Moodle
# 需要导入模块: from git import Git [as 别名]
# 或者: from git.Git import isRepository [as 别名]
#.........这里部分代码省略.........
if engine != None and db != None:
try:
self._dbo = DB(engine, C.get('db.%s' % engine))
except:
pass
return self._dbo
def generateBranchName(self, issue, suffix='', version=''):
"""Generates a branch name"""
mdl = re.sub(r'(MDL|mdl)(-|_)?', '', issue)
if version == '':
version = self.get('branch')
args = {
'issue': mdl,
'version': version
}
branch = C.get('wording.branchFormat') % args
if suffix != None and suffix != '':
branch += C.get('wording.branchSuffixSeparator') + suffix
return branch
def get(self, param, default=None):
"""Returns a property of this instance"""
info = self.info()
try:
return info[param]
except:
return default
def git(self):
"""Returns a Git object"""
if self._git == None:
self._git = Git(self.path, C.get('git'))
if not self._git.isRepository():
raise Exception('Could not find the Git repository')
return self._git
def initPHPUnit(self, force=False):
"""Initialise the PHPUnit environment"""
if self.branch_compare(23, '<'):
raise Exception('PHPUnit is only available from Moodle 2.3')
# Set PHPUnit data root
phpunit_dataroot = self.get('dataroot') + '_phpu'
self.updateConfig('phpunit_dataroot', phpunit_dataroot)
if not os.path.isdir(phpunit_dataroot):
os.mkdir(phpunit_dataroot, 0777)
# Set PHPUnit prefix
phpunit_prefix = 'phpu_'
self.updateConfig('phpunit_prefix', phpunit_prefix)
result = (None, None, None)
exception = None
try:
if force:
result = self.cli('/admin/tool/phpunit/cli/util.php', args='--drop', stdout=None, stderr=None)
result = self.cli('/admin/tool/phpunit/cli/init.php', stdout=None, stderr=None)
except Exception as exception:
pass
if exception != None or result[0] > 0:
if result[0] == 129:
raise Exception('PHPUnit is not installed on your system')
elif result[0] > 0: