Пример #1
0
def delete_tag(tag, fromRemote=True):
    (result, output) = shell.call_output_and_result(['git', 'tag', '-d', tag])
    if (result == 0) and fromRemote:
        (result, output) = shell.call_output_and_result(
            ['git', 'push', 'origin', ':refs/tags/' + tag])

    return (result, output)
Пример #2
0
def add_tag(tag, ref, push = False, force = False, message = None):
    cmd = ['git', 'tag']
    if force:
        cmd += ['-f']
    cmd += [tag, ref]
    if message:
        cmd += ['-m', message]
    (result, output) = shell.call_output_and_result(cmd)
    if push and (result == 0):
        (result, output) = shell.call_output_and_result(['git', 'push', 'origin', tag])

    return (result, output)
Пример #3
0
def add_tag(tag, ref, push=False, force=False, message=None):
    cmd = ['git', 'tag']
    if force:
        cmd += ['-f']
    cmd += [tag, ref]
    if message:
        cmd += ['-m', message]
    (result, output) = shell.call_output_and_result(cmd)
    if push and (result == 0):
        (result,
         output) = shell.call_output_and_result(['git', 'push', 'origin', tag])

    return (result, output)
Пример #4
0
def short_ref(ref):
    args = ['git', 'rev-parse', '--short', ref]
    (result, output) = shell.call_output_and_result(args)
    if result == 0:
        return output.strip()
    else:
        return ref
Пример #5
0
def commit_for_ref(ref):
    (result, output) = shell.call_output_and_result(
        ["git", "log", "-1", "--oneline", "--no-abbrev-commit", ref])
    if result == 0:
        words = output.split(" ")
        if len(words) > 0:
            return words[0]
Пример #6
0
def short_ref(ref):
    args = ['git', 'rev-parse', '--short', ref]
    (result, output) = shell.call_output_and_result(args)
    if result == 0:
        return output.strip()
    else:
        return ref
Пример #7
0
def build(workspace,
          scheme,
          platform='macosx',
          configuration='Release',
          actions=['build'],
          jobName=None,
          extraArgs=[]):
    args = [
        'xctool', '-workspace', workspace, '-scheme', scheme, '-sdk', platform,
        '-configuration', configuration
    ]

    for action in actions:
        args += [action]
        if action == 'archive':
            args += ["-archivePath", archive_path()]

    args += ['-derivedDataPath', derived_path()]

    logPaths = log_paths(jobName)
    args += ['-reporter', "pretty:{0}".format(logPaths['pretty'])]
    args += ['-reporter', "plain:{0}".format(logPaths['output'])]
    args += [
        '-reporter',
        "json-compilation-database:{0}".format(logPaths['compilation'])
    ]
    args += extraArgs

    (result, output) = shell.call_output_and_result(args)
    return (result, output)
Пример #8
0
def submodule_update(recursive=True, init=False):
    args = ["git", "submodule", "update"]
    if recursive:
        args += ['--recursive']
    if init:
        args += ['init']

    return shell.call_output_and_result(args)
Пример #9
0
def submodule_update(recursive = True, init = False):
    args = ["git", "submodule", "update"]
    if recursive:
        args += ['--recursive']
    if init:
        args += ['init']

    return shell.call_output_and_result(args)
Пример #10
0
def remote_url():
    (result, output) = shell.call_output_and_result(["git", "remote", "-v"])
    if result == 0:
        match = RE_REMOTE.search(output)
        if match:
            return match.group(2)
    else:
        print result, output
Пример #11
0
def push(branch = None, upstream = None):
    cmd = ['git', 'push']
    if upstream:
        cmd += ['--set-upstream', upstream]
    if branch:
        cmd += [branch]

    return shell.call_output_and_result(cmd)
Пример #12
0
def push(branch=None, upstream=None):
    cmd = ['git', 'push']
    if upstream:
        cmd += ['--set-upstream', upstream]
    if branch:
        cmd += [branch]

    return shell.call_output_and_result(cmd)
Пример #13
0
def remote_url():
    (result, output) = shell.call_output_and_result(["git", "remote", "-v"])
    if result == 0:
        match = RE_REMOTE.search(output)
        if match:
            return match.group(2)
    else:
        print result, output
Пример #14
0
def delete_branch(branch, forced = False):
    args = ["git", "branch"]
    if forced:
        args += ['-D']
    else:
        args += ['-d']
    args += [branch]

    return shell.call_output_and_result(args)
Пример #15
0
def delete_branch(branch, forced=False):
    args = ["git", "branch"]
    if forced:
        args += ['-D']
    else:
        args += ['-d']
    args += [branch]

    return shell.call_output_and_result(args)
Пример #16
0
def set_branch(branch, commit=None, forced=False):
    cmd = ["git", "branch"]
    if forced:
        cmd += ['-f']

    cmd += [branch]
    if commit:
        cmd += [commit]

    return shell.call_output_and_result(cmd)
Пример #17
0
def merge(ref = None, options = None, fastForwardOnly = False):
    cmd = ["git", "merge"]
    if not options:
        options = []
    if fastForwardOnly:
        options += ['--ff-only']
        cmd += options
    if ref:
        cmd += [ref]
    return shell.call_output_and_result(cmd)
Пример #18
0
def merge(ref=None, options=None, fastForwardOnly=False):
    cmd = ["git", "merge"]
    if not options:
        options = []
    if fastForwardOnly:
        options += ['--ff-only']
        cmd += options
    if ref:
        cmd += [ref]
    return shell.call_output_and_result(cmd)
Пример #19
0
def set_branch(branch, commit = None, forced = False):
    cmd = ["git", "branch"]
    if forced:
        cmd += ['-f']

    cmd += [branch]
    if commit:
        cmd += [commit]

    return shell.call_output_and_result(cmd)
Пример #20
0
def tags(pattern = None):
    tags = []
    args = ['git', 'tag']
    if pattern:
        args += ['--list', pattern]
    (result, output) = shell.call_output_and_result(args)
    if result == 0:
        items = output.strip().split('\n')
        tags = [item.strip() for item in items]

    return tags
Пример #21
0
def branches_containing(ref, remote=False):
    args = ['git', 'branch']
    if remote:
        args += ['-r']
    args += ['--contains', ref]
    (result, output) = shell.call_output_and_result(args)
    if result == 0:
        items = output.strip().split('\n')
        return [item.strip() for item in items]
    else:
        shell.log_verbose(output)
Пример #22
0
def tags(pattern=None):
    tags = []
    args = ['git', 'tag']
    if pattern:
        args += ['--list', pattern]
    (result, output) = shell.call_output_and_result(args)
    if result == 0:
        items = output.strip().split('\n')
        tags = [item.strip() for item in items]

    return tags
Пример #23
0
def branches_containing(ref, remote = False):
    args = ['git', 'branch']
    if remote:
        args += ['-r']
    args += ['--contains', ref]
    (result, output) = shell.call_output_and_result(args)
    if result == 0:
        items = output.strip().split('\n')
        return [item.strip() for item in items]
    else:
        shell.log_verbose(output)
Пример #24
0
def github_info():
    (result, output) = shell.call_output_and_result(["git", "remote", "-v"])
    if result == 0:
        remotes = {}
        for match in RE_GITHUB_REMOTE.findall(output):
            remote = match[0]
            info = remotes.get(remote)
            if not info:
                info = {}
            info["owner"] = match[1]
            info["name"] = os.path.splitext(match[2])[0]
            info[match[3]] = os.path.join(match[1], match[2])
            remotes[remote] = info
        return remotes
Пример #25
0
def github_info():
    (result, output) = shell.call_output_and_result(["git", "remote", "-v"])
    if result == 0:
        remotes = {}
        for match in RE_GITHUB_REMOTE.findall(output):
            remote = match[0]
            info = remotes.get(remote)
            if not info:
                info = {}
            info["owner"] = match[1]
            info["name"] =  os.path.splitext(match[2])[0]
            info[match[3]] = os.path.join(match[1], match[2])
            remotes[remote] = info
        return remotes
Пример #26
0
def build(workspace, scheme, platform = 'macosx', configuration = 'Release', actions = ['build'], jobName = None, extraArgs = []):
    args = ['xctool', '-workspace', workspace, '-scheme', scheme, '-sdk', platform, '-configuration', configuration]

    for action in actions:
        args += [action]
        if action == 'archive':
            args += ["-archivePath", archive_path()]

    args += ['-derivedDataPath', derived_path()]

    logPaths = log_paths(jobName)
    args += ['-reporter', "pretty:{0}".format(logPaths['pretty'])]
    args += ['-reporter', "plain:{0}".format(logPaths['output'])]
    args += ['-reporter', "json-compilation-database:{0}".format(logPaths['compilation'])]
    args += extraArgs

    (result, output) = shell.call_output_and_result(args)
    return (result, output)
Пример #27
0
def commit_for_ref(ref):
    (result, output) = shell.call_output_and_result(["git", "log", "-1", "--oneline", "--no-abbrev-commit", ref])
    if result == 0:
        words = output.split(" ")
        if len(words) > 0:
            return words[0]
Пример #28
0
def commit2(path, message):
    return shell.call_output_and_result(["git", "commit", path, "-m", message])
Пример #29
0
def fetch():
    cmd = ["git", "fetch"]
    return shell.call_output_and_result(cmd)
Пример #30
0
def clone(repo, name = None):
    args = ['git', 'clone', repo]
    if name:
        args += [name]

    return shell.call_output_and_result(args)
Пример #31
0
def commit2(path, message):
    return shell.call_output_and_result(["git", "commit", path, "-m", message])
Пример #32
0
def push_tags():
    return shell.call_output_and_result(['git', 'push', '--tags'])
Пример #33
0
def repo_root_path():
    (result, output) = shell.call_output_and_result(
        ['git', 'rev-parse', '--show-toplevel'])
    if result == 0:
        return output.strip()
Пример #34
0
def delete_tag(tag, fromRemote = True):
    (result, output) = shell.call_output_and_result(['git', 'tag', '-d', tag])
    if (result == 0) and fromRemote:
        (result, output) = shell.call_output_and_result(['git', 'push', 'origin', ':refs/tags/' + tag])

    return (result, output)
Пример #35
0
def push_tags():
    return shell.call_output_and_result(['git', 'push', '--tags'])
Пример #36
0
def current_branch():
    (result, output) = shell.call_output_and_result(
        ['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
    if result == 0:
        return output.strip()
Пример #37
0
def repo_root_path():
    (result, output) = shell.call_output_and_result(['git', 'rev-parse',  '--show-toplevel'])
    if result == 0:
        return output.strip()
Пример #38
0
def checkout(ref):
    return shell.call_output_and_result(["git", "checkout", ref])
Пример #39
0
def clone(repo, name=None):
    args = ['git', 'clone', repo]
    if name:
        args += [name]

    return shell.call_output_and_result(args)
Пример #40
0
def checkout_detached():
    return shell.call_output_and_result(["git", "checkout", "--detach"])
Пример #41
0
def top_level():
    (result, output) = shell.call_output_and_result(["git", "rev-parse", "--show-toplevel"])
    return output.strip()
Пример #42
0
def make_branch(name, ref = None):
    cmd = ["git", "checkout", "-b", name]
    if ref:
        cmd = cmd + [ref]
    return shell.call_output_and_result(cmd)
Пример #43
0
def make_branch(name, ref=None):
    cmd = ["git", "checkout", "-b", name]
    if ref:
        cmd = cmd + [ref]
    return shell.call_output_and_result(cmd)
Пример #44
0
def top_level():
    (result, output) = shell.call_output_and_result(
        ["git", "rev-parse", "--show-toplevel"])
    return output.strip()
Пример #45
0
def current_branch():
    (result, output) = shell.call_output_and_result(['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
    if result == 0:
        return output.strip()
Пример #46
0
def pull(fastForwardOnly=False):
    cmd = ["git", "pull"]
    if fastForwardOnly:
        cmd += ["--ff-only"]
    return shell.call_output_and_result(cmd)
Пример #47
0
def checkout(ref):
    return shell.call_output_and_result(["git", "checkout", ref])
Пример #48
0
def fetch():
    cmd = ["git", "fetch"]
    return shell.call_output_and_result(cmd)
Пример #49
0
def checkout_detached():
    return shell.call_output_and_result(["git", "checkout", "--detach"])
Пример #50
0
def pull(fastForwardOnly = False):
    cmd = ["git", "pull"]
    if fastForwardOnly:
        cmd += ["--ff-only"]
    return shell.call_output_and_result(cmd)
Пример #51
0
def add(path):
    return shell.call_output_and_result(["git", "add", path])
Пример #52
0
def add(path):
    return shell.call_output_and_result(["git", "add", path])