diff options
author | Léon Keijser <keijser@stone-it.com> | 2010-07-15 09:39:47 +0200 |
---|---|---|
committer | Jesse Keating <jkeating@redhat.com> | 2010-07-15 15:25:33 -0700 |
commit | e11fb1cca1de4f09f30ed142fea06427f2293661 (patch) | |
tree | b84deeca797f4fff3fffd19aebfac5fbcd43ff40 /src/pyfedpkg | |
parent | f58e03c4d3afded99fbc27a0c6d5350049515dd3 (diff) | |
download | fedora-packager-e11fb1cca1de4f09f30ed142fea06427f2293661.tar.gz fedora-packager-e11fb1cca1de4f09f30ed142fea06427f2293661.tar.xz fedora-packager-e11fb1cca1de4f09f30ed142fea06427f2293661.zip |
Added new command 'switch-branch' for working with branches.
Diffstat (limited to 'src/pyfedpkg')
-rw-r--r-- | src/pyfedpkg/__init__.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py index 53b7e3e..799ae97 100644 --- a/src/pyfedpkg/__init__.py +++ b/src/pyfedpkg/__init__.py @@ -251,6 +251,28 @@ def clean(dry=False, useignore=True): log.error(error) return proc.returncode +def switch_branch(branch=None, list=None): + """Work with different branches. + + branch is the name of the branch to switch to + + Logs output and returns nothing. + """ + if list: + cmd = ['git', 'branch'] + print "Listing branches" + cmd.extend(['-a']) + _run_command(cmd) + else: + cmd = ['git', 'checkout'] + cmd.extend([branch]) + log.debug('Switching to branch %s' % branch) + try: + _run_command(cmd) + except FedpkgError: + sys.exit(1) + return + def clone(module, user, path=os.getcwd(), branch=None, bare_dir=None): """Clone a repo, optionally check out a specific branch. |