From 493198a832ffbc240681c088fe1f92bc3077ed93 Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Wed, 11 Aug 2010 21:51:42 -0700 Subject: Make switch-branches indiciate the current branch Ticket #42 Some ugly string work here... --- src/pyfedpkg/__init__.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/pyfedpkg/__init__.py') diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py index faa1b86..269fe9d 100644 --- a/src/pyfedpkg/__init__.py +++ b/src/pyfedpkg/__init__.py @@ -57,6 +57,17 @@ log = logging.getLogger("fedpkg") # Add the null handler log.addHandler(h) +def _find_branch(path=os.getcwd(), repo=None): + """Returns the active branch name""" + + # Create the repo from path if no repo passed + if not repo: + try: + repo = git.Repo(path) + except: + raise FedpkgError('Invalid repo %s' % path) + return(repo.active_branch.name) + # Define some helper functions, they start with _ def _hash_file(file, hashtype): """Return the hash of a file given a hash type""" -- cgit