Merge "Just use flake8 instead of hacking"
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 8d875fe..0760a5c 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,16 +1,16 @@
-If you would like to contribute to the development of OpenStack,
+If you would like to contribute to the development of OpenDev,
 you must follow the steps in this page:
 
-   [https://docs.openstack.org/infra/manual/developers.html](https://docs.openstack.org/infra/manual/developers.html)
+   [https://docs.opendev.org/opendev/infra-manual/latest/developers.html](https://docs.opendev.org/opendev/infra-manual/latest/developers.html)
 
 If you already have a good understanding of how the system works and your
-OpenStack accounts are set up, you can skip to the development workflow section
-of this documentation to learn how changes to OpenStack should be submitted for
+OpenDev accounts are set up, you can skip to the development workflow section
+of this documentation to learn how changes to OpenDev should be submitted for
 review via the Gerrit tool:
 
-   [https://docs.openstack.org/infra/manual/developers.html#development-workflow](https://docs.openstack.org/infra/manual/developers.html#development-workflow)
+   [https://docs.opendev.org/opendev/infra-manual/latest/developers.html#development-workflow](https://docs.opendev.org/opendev/infra-manual/latest/developers.html#development-workflow)
 
 Pull requests submitted through GitHub will be ignored.
 
-Bugs should be filed [on StoryBoard](https://storyboard.openstack.org/#!/project/722),
+Bugs should be filed [on StoryBoard](https://storyboard.openstack.org/#!/project/opendev/jeepyb),
 not in GitHub's issue tracker.
diff --git a/jeepyb/cmd/close_pull_requests.py b/jeepyb/cmd/close_pull_requests.py
index 6e24bc5..e8265df 100644
--- a/jeepyb/cmd/close_pull_requests.py
+++ b/jeepyb/cmd/close_pull_requests.py
@@ -1,5 +1,5 @@
 #! /usr/bin/env python
-# Copyright (C) 2011 OpenStack, LLC.
+# Copyright (C) 2011 OpenStack Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -16,15 +16,9 @@
 # Github pull requests closer reads a project config file called projects.yaml
 # It should look like:
 
-# - homepage: http://openstack.org
-#   team-id: 153703
-#   has-wiki: False
-#   has-issues: False
-#   has-downloads: False
-# ---
 # - project: PROJECT_NAME
 #   options:
-#   - has-pull-requests
+#     - has-pull-requests
 
 # Github authentication information is read from github.secure.config,
 # which should look like:
@@ -48,16 +42,16 @@
 import jeepyb.projects as p
 import jeepyb.utils as u
 
-MESSAGE = """Thank you for contributing to %(project)s!
+MESSAGE = """Thank you for your interest in %(project)s!
 
 %(project)s uses Gerrit for code review.
 
-If you have never contributed to OpenStack before make sure you have read the
-getting started documentation:
-https://docs.openstack.org/infra/manual/developers.html#getting-started
+If you have never contributed to an OpenDev hosted project before
+make sure you have read the getting started documentation:
+https://docs.opendev.org/opendev/infra-manual/latest/developers.html#getting-started
 
 Otherwise please visit
-https://docs.openstack.org/infra/manual/developers.html#development-workflow
+https://docs.opendev.org/opendev/infra-manual/latest/developers.html#development-workflow
 and follow the instructions there to upload your change to Gerrit.
 """
 
diff --git a/jeepyb/cmd/expire_old_reviews.py b/jeepyb/cmd/expire_old_reviews.py
index 3f81386..2dbd015 100644
--- a/jeepyb/cmd/expire_old_reviews.py
+++ b/jeepyb/cmd/expire_old_reviews.py
@@ -1,5 +1,5 @@
 #!/usr/bin/env python
-# Copyright (c) 2012 OpenStack, LLC.
+# Copyright (c) 2012 OpenStack Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/jeepyb/cmd/manage_projects.py b/jeepyb/cmd/manage_projects.py
index 3b75eb0..212d899 100644
--- a/jeepyb/cmd/manage_projects.py
+++ b/jeepyb/cmd/manage_projects.py
@@ -1,5 +1,5 @@
 #! /usr/bin/env python
-# Copyright (C) 2011 OpenStack, LLC.
+# Copyright (C) 2011 OpenStack Foundation
 # Copyright (c) 2012 Hewlett-Packard Development Company, L.P.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,20 +16,17 @@
 
 # manage_projects.py reads a config file called projects.ini
 # It should look like:
-
+#
 # [projects]
-# homepage=http://openstack.org
-# gerrit-host=review.openstack.org
-# local-git-dir=/var/lib/git
-# gerrit-key=/home/gerrit2/review_site/etc/ssh_host_rsa_key
-# gerrit-committer=Project Creator <openstack-infra@lists.openstack.org>
-# gerrit-replicate=True
-# has-github=True
-# has-wiki=False
-# has-issues=False
-# has-downloads=False
+# homepage=https://opendev.org
 # acl-dir=/home/gerrit2/acls
-# acl-base=/home/gerrit2/acls/project.config
+# local-git-dir=/opt/lib/git
+# jeepyb-cache-dir=/opt/lib/jeepyb
+# gerrit-host=review.opendev.org
+# gerrit-user=project-creator
+# gerrit-committer=Project Creator <project-creator@opendev.org>
+# gerrit-key=/home/gerrit2/review_site/etc/ssh_project_rsa_key
+# has-github=false
 #
 # manage_projects.py reads a project listing file called projects.yaml
 # It should look like:
@@ -40,7 +37,7 @@
 #    - has-downloads
 #    - has-pull-requests
 #    - track-upstream
-#   homepage: Some homepage that isn't http://openstack.org
+#   homepage: Some homepage that isn't http://opendev.org
 #   description: This is a great project
 #   upstream: https://gerrit.googlesource.com/gerrit
 #   upstream-prefix: upstream
@@ -74,7 +71,7 @@
 orgs = None
 
 # Gerrit system groups as defined:
-# https://review.openstack.org/Documentation/access-control.html#system_groups
+# https://review.opendev.org/Documentation/access-control.html#system_groups
 # Need to set Gerrit system group's uuid to the format it expects.
 GERRIT_SYSTEM_GROUPS = {
     'Anonymous Users': 'global:Anonymous-Users',
@@ -198,7 +195,12 @@
     Wait for up to 10 seconds for the group to be created in the DB.
     """
     for x in range(retries):
-        group_list = gerrit.listGroup(group, verbose=True)
+        # Work around gerritlib raising a generic "Exception" exception
+        # when listGroup() finds no group
+        try:
+            group_list = list(gerrit.listGroup(group, verbose=True))
+        except Exception:
+            group_list = None
         if group_list:
             return group_list[0].split('\t')[1]
         if retries > 1:
@@ -213,10 +215,10 @@
     if group in GERRIT_SYSTEM_GROUPS:
         return GERRIT_SYSTEM_GROUPS[group]
     gerrit.createGroup(group)
-    for user in gerrit.listMembers(group):
-        if gerrit.username == user['username']:
+    for user in list(gerrit.listMembers(group)):
+        if gerrit.connection.username == user['username']:
             # Gerrit now adds creating user to groups. We don't want that.
-            gerrit.removeMember(group, gerrit.username)
+            gerrit.removeMember(group, gerrit.connection.username)
             break
     uuid = _get_group_uuid(gerrit, group)
     if uuid:
@@ -349,7 +351,7 @@
     return created
 
 
-# TODO(mordred): Inspect repo_dir:master for a description
+# TODO(mordred): Inspect repo_dir:default-branch for a description
 #                override
 def find_description_override(repo_path):
     return None
@@ -383,14 +385,15 @@
         raise ProcessACLException()
     finally:
         u.git_command(repo_path, 'reset --hard')
-        u.git_command(repo_path, 'checkout master')
+        default_branch = section.get('default-branch', 'master')
+        u.git_command(repo_path, 'checkout %s' % default_branch)
         u.git_command(repo_path, 'branch -D config')
 
 
-def create_gerrit_project(project, project_list, gerrit):
+def create_gerrit_project(project, default_branch, project_list, gerrit):
     if project not in project_list:
         try:
-            gerrit.createProject(project)
+            gerrit.createProject(project, branches=[default_branch])
             return True
         except Exception:
             log.exception(
@@ -425,7 +428,7 @@
 
     default_has_github = registry.get_defaults('has-github', True)
 
-    LOCAL_GIT_DIR = registry.get_defaults('local-git-dir', '/var/lib/git')
+    LOCAL_GIT_DIR = registry.get_defaults('local-git-dir', None)
     JEEPYB_CACHE_DIR = registry.get_defaults('jeepyb-cache-dir',
                                              '/var/lib/jeepyb')
     ACL_DIR = registry.get_defaults('acl-dir')
@@ -457,19 +460,19 @@
     acl_cache = {}
     for acl_file in glob.glob(os.path.join(ACL_DIR, '*/*.config')):
         sha256 = hashlib.sha256()
-        sha256.update(open(acl_file, 'r').read())
+        sha256.update(open(acl_file, 'r').read().encode('utf-8'))
         acl_cache[acl_file] = sha256.hexdigest()
 
     gerrit = gerritlib.gerrit.Gerrit(GERRIT_HOST,
                                      GERRIT_USER,
                                      GERRIT_PORT,
                                      GERRIT_KEY)
-    project_list = gerrit.listProjects()
+    project_list = list(gerrit.listProjects())
     ssh_env = u.make_ssh_wrapper(GERRIT_USER, GERRIT_KEY)
     try:
         # Collect processed errors,if any
         process_errors = []
-        for section in registry.configs_list:
+        for section in registry.all_configs_list:
             project = section['project']
             if args.projects and project not in args.projects:
                 continue
@@ -482,6 +485,7 @@
                 description = section.get('description', None)
                 homepage = section.get('homepage', DEFAULT_HOMEPAGE)
                 upstream = section.get('upstream', None)
+                default_branch = section.get('default-branch', 'master')
                 repo_path = os.path.join(JEEPYB_CACHE_DIR, project)
 
                 # If this project doesn't want to use gerrit, exit cleanly.
@@ -509,7 +513,7 @@
                 if not project_created:
                     try:
                         project_created = create_gerrit_project(
-                            project, project_list, gerrit)
+                            project, default_branch, project_list, gerrit)
                         project_cache[project]['project-created'] = True
                     except Exception:
                         project_cache[project]['project-created'] = False
@@ -524,7 +528,7 @@
 
                     # Make Local repo
                     push_string = u.make_local_copy(
-                        repo_path, project, project_list,
+                        repo_path, project, default_branch, project_list,
                         git_opts, ssh_env, upstream, GITREVIEW_GERRIT_HOST,
                         GITREVIEW_GERRIT_PORT, project_git, GERRIT_GITID)
 
@@ -543,9 +547,12 @@
                         gerrit.replicate(project)
 
                 # Create the repo for the local git mirror
-                create_local_mirror(
-                    LOCAL_GIT_DIR, project_git,
-                    GERRIT_OS_SYSTEM_USER, GERRIT_OS_SYSTEM_GROUP)
+                if LOCAL_GIT_DIR:
+                    # This is conditional because new gerrit url pathing
+                    # has made local git mirrors less straightfoward.
+                    create_local_mirror(
+                        LOCAL_GIT_DIR, project_git,
+                        GERRIT_OS_SYSTEM_USER, GERRIT_OS_SYSTEM_GROUP)
 
                 if acl_config:
                     acl_sha = acl_cache.get(acl_config)
@@ -553,9 +560,10 @@
 
                         if not os.path.exists(repo_path):
                             u.make_local_copy(
-                                repo_path, project, project_list,
-                                git_opts, ssh_env, upstream, GERRIT_HOST,
-                                GERRIT_PORT, project_git, GERRIT_GITID)
+                                repo_path, project, default_branch,
+                                project_list, git_opts, ssh_env, upstream,
+                                GERRIT_HOST, GERRIT_PORT, project_git,
+                                GERRIT_GITID)
                         process_acls(
                             acl_config, project, ACL_DIR, section,
                             remote_url, repo_path, ssh_env, gerrit,
diff --git a/jeepyb/cmd/notify_impact.py b/jeepyb/cmd/notify_impact.py
index 611d332..0636c06 100644
--- a/jeepyb/cmd/notify_impact.py
+++ b/jeepyb/cmd/notify_impact.py
@@ -1,5 +1,5 @@
 #!/usr/bin/env python
-# Copyright (c) 2012 OpenStack, LLC.
+# Copyright (c) 2012 OpenStack Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -19,7 +19,7 @@
 
 # You want to test this? I use a command line a bit like this:
 #     python notify_impact.py --change 55607 \
-#     --change-url https://review.openstack.org/55607 --project nova/ \
+#     --change-url https://review.opendev.org/55607 --project nova/ \
 #     --branch master --commit c262de4417d48be599c3a7496ef94de5c84b188c \
 #     --impact DocImpact --dest-address none@localhost --dryrun \
 #     --config foo.yaml \
@@ -48,7 +48,8 @@
 logger = logging.getLogger('notify_impact')
 
 DOC_TAG = "doc"
-BASE_DIR = '/home/gerrit2/review_site'
+GERRIT_GIT_DIR = os.environ.get(
+    'GERRIT_GIT_DIR', '/home/gerrit2/review_site/git')
 EMAIL_TEMPLATE = """
 Hi, I'd like you to take a look at this patch for potential
 %s.
@@ -131,7 +132,7 @@
                    'the documentation bugs against it. If this needs '
                    'changing, the docimpact-group option needs to be added '
                    'for the project. You can ask the '
-                   'OpenStack infra team (#openstack-infra on freenode) for '
+                   'OpenStack TaCT SIG (#openstack-infra on freenode) for '
                    'help if you need to.\n'
                    % args.project)
         lp_project = project_name
@@ -241,9 +242,10 @@
 def extract_git_log(args):
     """Extract git log of all merged commits."""
     cmd = ['git',
-           '--git-dir=' + BASE_DIR + '/git/' + args.project + '.git',
+           '--git-dir=' + GERRIT_GIT_DIR + '/' + args.project + '.git',
            'log', '--no-merges', args.commit + '^1..' + args.commit]
-    return subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
+    return subprocess.Popen(
+        cmd, stdout=subprocess.PIPE).communicate()[0].decode('utf-8')
 
 
 def main():
@@ -289,7 +291,7 @@
 
     # SMTP configuration
     parser.add_argument('--smtp-from', dest='smtp_from',
-                        default='gerrit2@review.openstack.org')
+                        default='gerrit2@review.opendev.org')
 
     parser.add_argument('--smtp-host', dest='smtp_host', default="localhost")
     parser.add_argument('--smtp-port', dest='smtp_port')
diff --git a/jeepyb/cmd/openstackwatch.py b/jeepyb/cmd/openstackwatch.py
index f7782d6..264112f 100644
--- a/jeepyb/cmd/openstackwatch.py
+++ b/jeepyb/cmd/openstackwatch.py
@@ -23,8 +23,8 @@
 
 __author__ = "Chmouel Boudjnah <chmouel@chmouel.com>"
 
+import six
 from six.moves import configparser
-import cStringIO
 import datetime
 import json
 import os
@@ -128,7 +128,7 @@
         time.sleep(1)
 
     client.put_object(cfg['container'], objectname,
-                      cStringIO.StringIO(content))
+                      six.StringIO(content))
 
 
 def generate_rss(content, project=""):
diff --git a/jeepyb/cmd/track_upstream.py b/jeepyb/cmd/track_upstream.py
index 6cd1e6a..4a30c61 100644
--- a/jeepyb/cmd/track_upstream.py
+++ b/jeepyb/cmd/track_upstream.py
@@ -1,5 +1,5 @@
 #! /usr/bin/env python
-# Copyright (C) 2011 OpenStack, LLC.
+# Copyright (C) 2011 OpenStack Foundation
 # Copyright (c) 2012 Hewlett-Packard Development Company, L.P.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,18 +18,15 @@
 # It should look like:
 
 # [projects]
-# homepage=http://openstack.org
-# gerrit-host=review.openstack.org
-# local-git-dir=/var/lib/git
-# gerrit-key=/home/gerrit2/review_site/etc/ssh_host_rsa_key
-# gerrit-committer=Project Creator <openstack-infra@lists.openstack.org>
-# gerrit-replicate=True
-# has-github=True
-# has-wiki=False
-# has-issues=False
-# has-downloads=False
+# homepage=https://opendev.org
 # acl-dir=/home/gerrit2/acls
-# acl-base=/home/gerrit2/acls/project.config
+# local-git-dir=/opt/lib/git
+# jeepyb-cache-dir=/opt/lib/jeepyb
+# gerrit-host=review.opendev.org
+# gerrit-user=project-creator
+# gerrit-committer=Project Creator <project-creator@opendev.org>
+# gerrit-key=/home/gerrit2/review_site/etc/ssh_project_rsa_key
+# has-github=false
 #
 # manage_projects.py reads a project listing file called projects.yaml
 # It should look like:
@@ -40,7 +37,7 @@
 #    - has-downloads
 #    - has-pull-requests
 #    - track-upstream
-#   homepage: Some homepage that isn't http://openstack.org
+#   homepage: Some homepage that isn't http://opendev.org
 #   description: This is a great project
 #   upstream: https://gerrit.googlesource.com/gerrit
 #   upstream-prefix: upstream
@@ -192,6 +189,7 @@
 
                 upstream = section.get('upstream', None)
                 upstream_prefix = section.get('upstream-prefix', None)
+                default_branch = section.get('default-branch', 'master')
                 repo_path = os.path.join(IMPORT_DIR, project)
 
                 project_git = "%s.git" % project
@@ -209,7 +207,7 @@
                 # Make Local repo
                 if not os.path.exists(repo_path):
                     u.make_local_copy(
-                        repo_path, project, project_list,
+                        repo_path, project, default_branch, project_list,
                         git_opts, ssh_env, upstream, GERRIT_HOST,
                         GERRIT_PORT, project_git, GERRIT_GITID)
                 else:
diff --git a/jeepyb/cmd/update_blueprint.py b/jeepyb/cmd/update_blueprint.py
index 5c6590a..07bcce9 100644
--- a/jeepyb/cmd/update_blueprint.py
+++ b/jeepyb/cmd/update_blueprint.py
@@ -1,5 +1,5 @@
 #!/usr/bin/env python
-# Copyright (c) 2011 OpenStack, LLC.
+# Copyright (c) 2011 OpenStack Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -18,10 +18,10 @@
 # corresponding Launchpad blueprints with links back to the change.
 
 import argparse
+import six
 from six.moves import configparser
 import os
 import re
-import StringIO
 import subprocess
 
 from launchpadlib import launchpad
@@ -31,7 +31,8 @@
 from jeepyb import projects as p
 
 
-BASE_DIR = '/home/gerrit2/review_site'
+GERRIT_GIT_DIR = os.environ.get(
+    'GERRIT_GIT_DIR', '/home/gerrit2/review_site/git')
 GERRIT_CACHE_DIR = os.path.expanduser(
     os.environ.get('GERRIT_CACHE_DIR',
                    '~/.launchpadlib/cache'))
@@ -54,8 +55,8 @@
         for line in conf.readlines():
             text = "%s%s" % (text, line.lstrip())
 
-    fp = StringIO.StringIO(text)
-    c = configparser.ConfigParser()
+    fp = six.StringIO(text)
+    c = configparser.ConfigParser(strict=False)
     c.readfp(fp)
     return c
 
@@ -108,12 +109,15 @@
 
 
 def find_specs(launchpad, dbconn, args):
-    git_dir_arg = '--git-dir={base_dir}/git/{project}.git'.format(
-        base_dir=BASE_DIR,
+    git_dir_arg = '--git-dir={base_dir}/{project}.git'.format(
+        base_dir=GERRIT_GIT_DIR,
         project=args.project)
-    git_log = subprocess.Popen(['git', git_dir_arg, 'log', '--no-merges',
-                                args.commit + '^1..' + args.commit],
-                               stdout=subprocess.PIPE).communicate()[0]
+    git_log = subprocess.Popen(
+        [
+            'git', git_dir_arg, 'log', '--no-merges',
+            args.commit + '^1..' + args.commit
+        ],
+        stdout=subprocess.PIPE).communicate()[0].decode('utf-8')
 
     change = args.change
     if '~' in change:
diff --git a/jeepyb/cmd/update_bug.py b/jeepyb/cmd/update_bug.py
index 212ee7a..b756304 100644
--- a/jeepyb/cmd/update_bug.py
+++ b/jeepyb/cmd/update_bug.py
@@ -1,5 +1,5 @@
 #!/usr/bin/env python
-# Copyright (c) 2011 OpenStack, LLC.
+# Copyright (c) 2011 OpenStack Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -30,7 +30,8 @@
 from jeepyb import utils as u
 
 
-BASE_DIR = '/home/gerrit2/review_site'
+GERRIT_GIT_DIR = os.environ.get(
+    'GERRIT_GIT_DIR', '/home/gerrit2/review_site/git')
 GERRIT_CACHE_DIR = os.path.expanduser(
     os.environ.get('GERRIT_CACHE_DIR',
                    '~/.launchpadlib/cache'))
@@ -72,8 +73,7 @@
                               submitter, branch, git_log, related=False):
     subject = '%s merged to %s (%s)' % (fix_or_related_fix(related),
                                         u.short_project_name(project), branch)
-    git_url = 'https://git.openstack.org/cgit/%s/commit/?id=%s' % (project,
-                                                                   commit)
+    git_url = 'https://opendev.org/%s/commit/%s' % (project, commit)
     body = '''Reviewed:  %s
 Committed: %s
 Submitter: %s
@@ -332,9 +332,10 @@
 def extract_git_log(args):
     """Extract git log of all merged commits."""
     cmd = ['git',
-           '--git-dir=' + BASE_DIR + '/git/' + args.project + '.git',
+           '--git-dir=' + GERRIT_GIT_DIR + '/' + args.project + '.git',
            'log', '--no-merges', args.commit + '^1..' + args.commit]
-    return subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
+    return subprocess.Popen(
+        cmd, stdout=subprocess.PIPE).communicate()[0].decode('utf-8')
 
 
 def main():
diff --git a/jeepyb/cmd/welcome_message.py b/jeepyb/cmd/welcome_message.py
index b39c454..d09397d 100644
--- a/jeepyb/cmd/welcome_message.py
+++ b/jeepyb/cmd/welcome_message.py
@@ -18,7 +18,7 @@
 #
 # For example, this might be called as follows
 # python welcome_message.py --change Ia1fea1eab3976f1a9cb89ceb3ce1c6c6a7e79c42
-# --change-url \ https://review-dev.openstack.org/81 --project gtest-org/test \
+# --change-url \ https://review-dev.opendev.org/81 --project gtest-org/test \
 # --branch master --uploader User A. Example (user@example.com) --commit \
 # 05508ae633852469d2fd7786a3d6f1d06f87055b --patchset 1 patchset-merged \
 # --ssh-user=user --ssh-key=/home/user/.ssh/id_rsa
@@ -33,8 +33,6 @@
 import jeepyb.gerritdb
 import jeepyb.log
 
-BASE_DIR = '/home/gerrit2/review_site'
-
 logger = logging.getLogger('welcome_reviews')
 
 
@@ -69,30 +67,29 @@
 def post_message(commit, gerrit_user, gerrit_ssh_key, message_file):
     """Post a welcome message on the patch set specified by the commit."""
 
-    default_text = """Thank you for your first contribution to OpenStack.
+    default_text = """\
+Congratulations, you've proposed your first change in OpenDev.
 
-Your patch will now be tested automatically by OpenStack testing frameworks
-and once the automatic tests pass, it will be reviewed by other friendly
-developers. They will give you feedback and may require you to refine it.
+Your submission will now be tested automatically by Zuul, our gatekeeper,
+and reviewed by other friendly developers. They will give you feedback and
+may require you to refine it.
 
 People seldom get their patch approved on the first try, so don't be
 concerned if requested to make corrections. Feel free to modify your patch
 and resubmit a new change-set.
 
-Patches usually take 3 to 7 days to be reviewed so be patient and be
-available on IRC to ask and answer questions about your work. Also it
-takes generally at least a couple of weeks for cores to get around to
-reviewing code. The more you participate in the community the more
-rewarding it is for you. You may also notice that the more you get to know
-people and get to be known, the faster your patches will be reviewed and
-eventually approved. Get to know others and become known by doing code
-reviews: anybody can do it, and it's a great way to learn the code base.
+Patches often take days (and sometimes weeks) to get reviewed, so be
+patient. Don't hesitate to ask for help, and answer questions about your
+work promptly if you can. The more you get to know reviewers and get to be
+known by them, the smoother the review and approval process will become. The
+fastest way to accomplish this is by reviewing other proposed changes
+yourself: anybody can do it, and it's a great way to learn the code base.
 
-Thanks again for supporting OpenStack, we look forward to working with you.
+Thanks again for participating in OpenDev, we look forward to seeing you
+around.
 
-IRC: https://wiki.openstack.org/wiki/IRC
-Workflow: https://docs.openstack.org/infra/manual/developers.html
-Commit Messages: https://wiki.openstack.org/wiki/GitCommitMessages
+Workflow Guide:
+https://docs.opendev.org/opendev/infra-manual/latest/developers.html
 """
 
     if message_file:
diff --git a/jeepyb/gerritdb.py b/jeepyb/gerritdb.py
index 963f997..dade73c 100644
--- a/jeepyb/gerritdb.py
+++ b/jeepyb/gerritdb.py
@@ -1,5 +1,5 @@
 #! /usr/bin/env python
-# Copyright (C) 2011 OpenStack, LLC.
+# Copyright (C) 2011 OpenStack Foundation
 # Copyright (c) 2012 Hewlett-Packard Development Company, L.P.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,9 +14,9 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
+import six
 from six.moves import configparser
 import os
-import StringIO
 
 
 GERRIT_CONFIG = os.environ.get(
@@ -34,8 +34,8 @@
     for line in open(filename, "r"):
         text += line.lstrip()
 
-    fp = StringIO.StringIO(text)
-    c = configparser.ConfigParser()
+    fp = six.StringIO(text)
+    c = configparser.ConfigParser(strict=False)
     c.readfp(fp)
     return c
 
diff --git a/jeepyb/utils.py b/jeepyb/utils.py
index 2a0efd2..31510cf 100644
--- a/jeepyb/utils.py
+++ b/jeepyb/utils.py
@@ -52,6 +52,7 @@
     p = subprocess.Popen(cmd_list, stdout=subprocess.PIPE,
                          stderr=subprocess.STDOUT, env=newenv)
     (out, nothing) = p.communicate()
+    out = out.decode('utf-8')
     log.debug("Return code: %s" % p.returncode)
     log.debug("Command said: %s" % out.strip())
     if status:
@@ -82,16 +83,16 @@
 
 def make_ssh_wrapper(gerrit_user, gerrit_key):
     (fd, name) = tempfile.mkstemp(text=True)
-    os.write(fd, '#!/bin/bash\n')
+    os.write(fd, b'#!/bin/bash\n')
     os.write(fd,
-             'ssh -i %s -l %s -o "StrictHostKeyChecking no" $@\n' %
-             (gerrit_key, gerrit_user))
+             b'ssh -i %s -l %s -o "StrictHostKeyChecking no" $@\n' %
+             (gerrit_key.encode('utf-8'), gerrit_user.encode('utf-8')))
     os.close(fd)
     os.chmod(name, 0o755)
     return dict(GIT_SSH=name)
 
 
-def make_local_copy(repo_path, project, project_list,
+def make_local_copy(repo_path, project, default_branch, project_list,
                     git_opts, ssh_env, upstream, GERRIT_HOST, GERRIT_PORT,
                     project_git, GERRIT_GITID):
 
@@ -147,8 +148,11 @@
     # Neither gerrit has it, nor does it have an upstream,
     # just create a whole new one
     else:
+        ref_str = 'refs/heads/%s' % default_branch
         run_command("git init %s" % repo_path)
         git_command(
+            repo_path, "symbolic-ref HEAD " + ref_str)
+        git_command(
             repo_path,
             "remote add origin %(remote_url)s" % git_opts)
         with open(os.path.join(repo_path,
@@ -163,7 +167,7 @@
         cmd = ("commit -a -m'Added .gitreview' --author='%s'"
                % GERRIT_GITID)
         git_command(repo_path, cmd)
-        return "push %s HEAD:refs/heads/master"
+        return "push %s HEAD:" + ref_str
 
 
 def fsck_repo(repo_path):
@@ -237,3 +241,7 @@
     @property
     def configs_list(self):
         return [entry for entry in self._configs_list if not is_retired(entry)]
+
+    @property
+    def all_configs_list(self):
+        return self._configs_list
diff --git a/setup.cfg b/setup.cfg
index 24207d0..73ab438 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -3,9 +3,9 @@
 summary = Tools for managing gerrit projects and external sources.
 description-file =
     README.rst
-author = OpenStack Infrastructure Team
-author-email = openstack-infra@lists.openstack.org
-home-page = https://docs.openstack.org/infra/system-config/
+author = OpenDev Contributors
+author-email = service-discuss@lists.opendev.org
+home-page = https://docs.opendev.org/opendev/system-config/
 classifier =
     Intended Audience :: Information Technology
     Intended Audience :: System Administrators