コード例 #1
0
def updateRepo(repo):
    '''Updates a repository. Returns False if missing; returns True if successful; raises an exception if updating fails.'''
    assert os.path.isdir(repo)
    repoType = typeOfRepo(repo)

    if repoType == 'hg':
        sps.timeSubprocess(['hg', 'pull', '-u'],
                           ignoreStderr=True,
                           combineStderr=True,
                           cwd=repo,
                           vb=True)
        sps.timeSubprocess(['hg', 'log', '-r', 'default'], cwd=repo, vb=True)
    elif repoType == 'git':
        # Ignore exit codes so the loop can continue retrying up to number of counts.
        gitenv = deepcopy(os.environ)
        if sps.isWin:
            gitenv[
                'GIT_SSH_COMMAND'] = "~/../../mozilla-build/msys/bin/ssh.exe -F ~/.ssh/config"
        sps.timeSubprocess([GITBINARY, 'fetch'],
                           env=gitenv,
                           ignoreStderr=True,
                           combineStderr=True,
                           ignoreExitCode=True,
                           cwd=repo,
                           vb=True)
        sps.timeSubprocess([GITBINARY, 'merge', '--ff-only', 'origin/master'],
                           ignoreStderr=True,
                           combineStderr=True,
                           ignoreExitCode=True,
                           cwd=repo,
                           vb=True)
    else:
        raise Exception('Unknown repository type: ' + repoType)

    return True
コード例 #2
0
def updateRepo(repo):
    '''Updates a repository. Returns False if missing; returns True if successful; raises an exception if updating fails.'''
    assert os.path.isdir(repo)
    repoType = typeOfRepo(repo)

    if repoType == 'hg':
        sps.timeSubprocess(['hg', 'pull', '-u'],
                           ignoreStderr=True, combineStderr=True, cwd=repo, vb=True)
        sps.timeSubprocess(['hg', 'log', '-r', 'default'], cwd=repo, vb=True)
    elif repoType == 'git':
        # Ignore exit codes so the loop can continue retrying up to number of counts.
        sps.timeSubprocess([GITBINARY, 'fetch'],
                           ignoreStderr=True, combineStderr=True, ignoreExitCode=True, cwd=repo, vb=True)
        sps.timeSubprocess([GITBINARY, 'merge', '--ff-only', 'origin/master'],
                           ignoreStderr=True, combineStderr=True, ignoreExitCode=True, cwd=repo, vb=True)
    else:
        raise Exception('Unknown repository type: ' + repoType)

    return True
コード例 #3
0
ファイル: reposUpdate.py プロジェクト: shuixi2013/funfuzz
def updateRepo(repo):
    '''Updates a repository. Returns False if missing; returns True if successful; raises an exception if updating fails.'''
    assert os.path.isdir(repo)
    repoType = typeOfRepo(repo)

    if repoType == 'hg':
        sps.timeSubprocess(['hg', 'pull', '-u'],
                           ignoreStderr=True, combineStderr=True, cwd=repo, vb=True)
        sps.timeSubprocess(['hg', 'log', '-r', 'default'], cwd=repo, vb=True)
    elif repoType == 'git':
        # Ignore exit codes so the loop can continue retrying up to number of counts.
        gitenv = deepcopy(os.environ)
        if sps.isWin:
            gitenv['GIT_SSH_COMMAND'] = "~/../../mozilla-build/msys/bin/ssh.exe -F ~/.ssh/config"
        sps.timeSubprocess([GITBINARY, 'fetch'], env=gitenv,
                           ignoreStderr=True, combineStderr=True, ignoreExitCode=True, cwd=repo, vb=True)
        sps.timeSubprocess([GITBINARY, 'merge', '--ff-only', 'origin/master'],
                           ignoreStderr=True, combineStderr=True, ignoreExitCode=True, cwd=repo, vb=True)
    else:
        raise Exception('Unknown repository type: ' + repoType)

    return True