SCM Utilities¶
-
exception
workspace.scm.
SCMError
¶ SCM command failed
-
workspace.scm.
all_branches
(repo=None, remotes=False, verbose=False)¶ Returns all branches. The first element is the current branch.
-
workspace.scm.
all_remotes
(repo=None)¶ Return all remotes with default remote as the 1st
-
workspace.scm.
checkout_branch
(branch, repo_path=None)¶ Checks out the branch in the given or current repo. Raises on error.
Parameters: - branch (str) – Branch to checkout. It can be a branch name or remote/branch combo.
if remote is provided, it will always set upstream to
upstream_remote()
regardless of the downstream remote, as we always want to track downstream changes to the upstream remote. - repo_path (str) – Path to repo to run checkout in. Defaults to current.
- branch (str) – Branch to checkout. It can be a branch name or remote/branch combo.
if remote is provided, it will always set upstream to
-
workspace.scm.
checkout_files
(files, repo_path=None)¶ Checks out the given list of files. Raises on error.
-
workspace.scm.
checkout_product
(product_url, checkout_path)¶ Checks out the product from url. Raises on error
-
workspace.scm.
commit_changes
(msg)¶ Commits any modified or new files with given message. Raises on error
-
workspace.scm.
create_branch
(branch, from_branch=None)¶ Creates a branch from the current branch. Raises on error
-
workspace.scm.
default_remote
(repo=None, remotes=None)¶ Default remote to take action against, such as push
-
workspace.scm.
extract_commit_msgs
(output, is_git=True)¶ Returns a list of commit msgs from the given output.
-
workspace.scm.
is_project
(path=None)¶ Check if we are inside of a project.
-
workspace.scm.
is_repo
(path=None)¶ Check if we are inside of a git repo.
-
workspace.scm.
parent_branch
(branch)¶ Returns the parent branch if available, otherwise None
-
workspace.scm.
product_repos
()¶ Product repos for the current workspace.
-
workspace.scm.
project_path
(path=None)¶ Return the project path with tox.ini by looking at the current dir and its parent dirs.
-
workspace.scm.
remove_branch
(branch, raises=False, remote=False, force=False)¶ Removes branch
-
workspace.scm.
repo_path
(path=None)¶ Return the git repo path with .git by looking at current dir and its parent dirs.
-
workspace.scm.
repo_url
(path=None, name='origin', action='push')¶ Parameters: - path (str) – Local repo path
- source (str) – Remote name
- action (str) – Action for the corresponding URL
Returns: Remote url for repo or None if not found
-
workspace.scm.
repos
(dir=None)¶ Returns a list of repos either for the given directory or current directory or in sub-directories.
-
workspace.scm.
update_repo
(path=None, quiet=False)¶ Updates given or current repo to HEAD
-
workspace.scm.
upstream_remote
(repo=None, remotes=None)¶ Upstream remote to track against
-
workspace.scm.
workspace_path
()¶ Guess the workspace path based on if we are in a repo or not.