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)
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)
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)
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
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]
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
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)
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)
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)
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
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)
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)
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
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)
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)
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)
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)
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)
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)
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
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)
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
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)
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
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
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)
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]
def commit2(path, message): return shell.call_output_and_result(["git", "commit", path, "-m", message])
def fetch(): cmd = ["git", "fetch"] return shell.call_output_and_result(cmd)
def clone(repo, name = None): args = ['git', 'clone', repo] if name: args += [name] return shell.call_output_and_result(args)
def commit2(path, message): return shell.call_output_and_result(["git", "commit", path, "-m", message])
def push_tags(): return shell.call_output_and_result(['git', 'push', '--tags'])
def repo_root_path(): (result, output) = shell.call_output_and_result( ['git', 'rev-parse', '--show-toplevel']) if result == 0: return output.strip()
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)
def push_tags(): return shell.call_output_and_result(['git', 'push', '--tags'])
def current_branch(): (result, output) = shell.call_output_and_result( ['git', 'rev-parse', '--abbrev-ref', 'HEAD']) if result == 0: return output.strip()
def repo_root_path(): (result, output) = shell.call_output_and_result(['git', 'rev-parse', '--show-toplevel']) if result == 0: return output.strip()
def checkout(ref): return shell.call_output_and_result(["git", "checkout", ref])
def clone(repo, name=None): args = ['git', 'clone', repo] if name: args += [name] return shell.call_output_and_result(args)
def checkout_detached(): return shell.call_output_and_result(["git", "checkout", "--detach"])
def top_level(): (result, output) = shell.call_output_and_result(["git", "rev-parse", "--show-toplevel"]) return output.strip()
def make_branch(name, ref = None): cmd = ["git", "checkout", "-b", name] if ref: cmd = cmd + [ref] return shell.call_output_and_result(cmd)
def make_branch(name, ref=None): cmd = ["git", "checkout", "-b", name] if ref: cmd = cmd + [ref] return shell.call_output_and_result(cmd)
def top_level(): (result, output) = shell.call_output_and_result( ["git", "rev-parse", "--show-toplevel"]) return output.strip()
def current_branch(): (result, output) = shell.call_output_and_result(['git', 'rev-parse', '--abbrev-ref', 'HEAD']) if result == 0: return output.strip()
def pull(fastForwardOnly=False): cmd = ["git", "pull"] if fastForwardOnly: cmd += ["--ff-only"] return shell.call_output_and_result(cmd)
def checkout(ref): return shell.call_output_and_result(["git", "checkout", ref])
def fetch(): cmd = ["git", "fetch"] return shell.call_output_and_result(cmd)
def checkout_detached(): return shell.call_output_and_result(["git", "checkout", "--detach"])
def pull(fastForwardOnly = False): cmd = ["git", "pull"] if fastForwardOnly: cmd += ["--ff-only"] return shell.call_output_and_result(cmd)
def add(path): return shell.call_output_and_result(["git", "add", path])
def add(path): return shell.call_output_and_result(["git", "add", path])