Merge "Only add upstream remotes if we track upstream"
diff --git a/jeepyb/cmd/manage_projects.py b/jeepyb/cmd/manage_projects.py
index 29baaab..c446244 100644
--- a/jeepyb/cmd/manage_projects.py
+++ b/jeepyb/cmd/manage_projects.py
@@ -420,12 +420,12 @@
     # a local branch of, optionally prefixed with the
     # upstream prefix value
     for branch in git_command_output(
-            repo_path, "branch -a")[1].split():
+            repo_path, "branch -a")[1].split('\n'):
         if not branch.strip().startswith("remotes/upstream"):
             continue
         if "->" in branch:
             continue
-        local_branch = branch[len('remotes/upstream/'):]
+        local_branch = branch.split()[0][len('remotes/upstream/'):]
         if upstream_prefix:
             local_branch = "%s/%s" % (
                 upstream_prefix, local_branch)
@@ -518,6 +518,8 @@
     parser = argparse.ArgumentParser(description='Manage projects')
     parser.add_argument('-v', dest='verbose', action='store_true',
                         help='verbose output')
+    parser.add_argument('-d', dest='debug', action='store_true',
+                        help='debug output')
     parser.add_argument('--nocleanup', action='store_true',
                         help='do not remove temp directories')
     parser.add_argument('projects', metavar='project', nargs='*',
@@ -525,6 +527,8 @@
     args = parser.parse_args()
 
     if args.verbose:
+        logging.basicConfig(level=logging.INFO)
+    elif args.debug:
         logging.basicConfig(level=logging.DEBUG)
     else:
         logging.basicConfig(level=logging.ERROR)