From d3820439acd264531fd9901526b9954953e2b0e5 Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Apr 14 2011 20:46:55 +0000 Subject: Handle local branches without config entries I can't think of a better way to trim out the branches that don't have config entries, otherwise we get a traceback --- diff --git a/src/fedpkg-fixbranches.py b/src/fedpkg-fixbranches.py index 6127d9a..0712346 100755 --- a/src/fedpkg-fixbranches.py +++ b/src/fedpkg-fixbranches.py @@ -130,9 +130,16 @@ def convert(args): # Find the local branches to convert log.debug('Looking for local branches tracking %s to update merge ' 'data' % remote) - lbranches = [branch for branch in repo.branches if - repo.git.config('--get', 'branch.%s.remote' % - branch.name) == remote] + lbranches = [] + for branch in repo.branches: + try: + merge = repo.git.config('--get', 'branch.%s.remote' % + branch.name) + except git.GitCommandError: + continue + if merge == remote: + lbranches.append(branch) + log.debug('Found %s local branches related to %s' % (len(lbranches), remote)) for branch in lbranches: