コード例 #1
0
ファイル: git.py プロジェクト: rawfalafel/docs-tools
def am(obj, repo=None):
    "Runs 'git am' on a github object."

    if repo is None:
        repo = lazy_conf().git.remote.upstream

    cmd = [
        'curl', 'https://github.com/{0}/'.format(repo), '|', 'git', 'am',
        '--signoff --3way' if env.sign else '--3way'
    ]

    if env.branch is not None:
        local('git checkout {0}'.format(env.branch))

    for obj in obj.split(','):
        if obj.startswith('http'):
            cmd[1] = obj
            if not obj.endswith('.patch'):
                cmd[1] += '.patch'
            local(' '.join(cmd))
        elif re.search('[a-zA-Z]+', obj):
            cmd[1] = cmd[1] + 'commit/' + obj + '.patch'

            local(' '.join(cmd))
            puts('[git]: merged commit {0} for {1} into {2}'.format(
                obj, repo, get_branch()))
        else:
            cmd[1] = cmd[1] + 'pull/' + obj + '.patch'

            local(' '.join(cmd))
            puts('[git]: merged pull request #{0} for {1} into {2}'.format(
                obj, repo, get_branch()))

    if env.branch is not None:
        local('git checkout -')
コード例 #2
0
def builds(days=14):
    "Cleans all builds older than 'n' number of days. Defaults to 14."

    days = time.time() - 60 * 60 * 24 * int(days)

    path = os.path.abspath(
        os.path.join(os.path.dirname(__file__), '..', 'build'))

    builds = [path + o for o in os.listdir(path) if os.path.isdir(path + o)]

    conf = lazy_conf()

    for build in builds:
        branch = build.rsplit('/', 1)[1]

        if branch in conf.git.branches.published:
            continue
        elif branch == get_branch():
            continue
        elif branch == 'public':
            continue
        elif os.stat(build).st_mtime < days:
            _rm_rf(build)
            _rm_rf(path + "public/" + branch)
            logger.warning('removed stale build artifact: ' + build)
コード例 #3
0
def check(site, conf=None):
    conf = lazy_conf(conf)

    if site.startswith('stag'):
        env.release_info_url = 'http://test.docs.10gen.cc/{0}/release.txt'.format(
            str(get_branch()))
    elif site == 'ecosystem':
        env.release_info_url = 'http://docs.mongodb.org/ecosystem/release.txt'
    elif site.startswith('prod') or site.startswith('pub'):
        env.release_info_url = 'http://docs.mongodb.org/{0}/release.txt'.format(
            conf.git.branches.current)

    r = urlopen(env.release_info_url).readlines()[0].split('\n')[0]
    if get_commit() == r:
        raise PublicationError(
            'ERROR: the current published version of is the same as the current commit. Make a new commit before publishing.'
        )
    else:
        print(
            '[build]: the current commit is different than the published version on.'
        )
コード例 #4
0
ファイル: git.py プロジェクト: QiangTimer/docs-tools
def am(obj, repo=None):
    "Runs 'git am' on a github object."

    if repo is None:
        repo = lazy_conf().git.remote.upstream

    cmd = [
        "curl",
        "https://github.com/{0}/".format(repo),
        "|",
        "git",
        "am",
        "--signoff --3way" if env.sign else "--3way",
    ]

    if env.branch is not None:
        local("git checkout {0}".format(env.branch))

    for obj in obj.split(","):
        if obj.startswith("http"):
            cmd[1] = obj
            if not obj.endswith(".patch"):
                cmd[1] += ".patch"
            local(" ".join(cmd))
        elif re.search("[a-zA-Z]+", obj):
            cmd[1] = cmd[1] + "commit/" + obj + ".patch"

            local(" ".join(cmd))
            puts("[git]: merged commit {0} for {1} into {2}".format(obj, repo, get_branch()))
        else:
            cmd[1] = cmd[1] + "pull/" + obj + ".patch"

            local(" ".join(cmd))
            puts("[git]: merged pull request #{0} for {1} into {2}".format(obj, repo, get_branch()))

    if env.branch is not None:
        local("git checkout -")
コード例 #5
0
ファイル: clean.py プロジェクト: derickr/docs-tools
def builds(days=14):
    "Cleans all builds older than 'n' number of days. Defaults to 14."

    days = time.time() - 60*60*24 * int(days)

    path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../build/')) + '/'

    builds = [ path + o for o in os.listdir(path) if os.path.isdir(path + o)]

    conf = lazy_conf()

    for build in builds:
        branch = build.rsplit('/', 1)[1]

        if branch in conf.git.branches.published:
            continue
        elif branch == get_branch():
            continue
        elif branch == 'public':
            continue
        elif os.stat(build).st_mtime < days:
            _rm_rf(build)
            _rm_rf(path + "public/" + branch)
            logger.warning('removed stale build artifact: ' + build)
コード例 #6
0
def check(site, conf=None):
    conf = lazy_conf(conf)

    if site.startswith('stag'):
        env.release_info_url = 'http://test.docs.10gen.cc/{0}/release.txt'.format(str(get_branch()))
    elif site == 'ecosystem':
        env.release_info_url = 'http://docs.mongodb.org/ecosystem/release.txt'
    elif site.startswith('prod') or site.startswith('pub'):
        env.release_info_url = 'http://docs.mongodb.org/{0}/release.txt'.format(conf.git.branches.current)

    r = urlopen(env.release_info_url).readlines()[0].split('\n')[0]
    if get_commit() == r:
        raise PublicationError('ERROR: the current published version of is the same as the current commit. Make a new commit before publishing.')
    else:
        print('[build]: the current commit is different than the published version on.')