Merge "Change return code and command said log.info"
diff --git a/jeepyb/cmd/manage_projects.py b/jeepyb/cmd/manage_projects.py
index 9423fa6..d7da659 100644
--- a/jeepyb/cmd/manage_projects.py
+++ b/jeepyb/cmd/manage_projects.py
@@ -370,26 +370,32 @@
def update_local_copy(repo_path, track_upstream, git_opts, ssh_env):
- # If we're configured to track upstream but the repo
- # does not have an upstream remote, add one
- if (track_upstream and
- 'upstream' not in git_command_output(
- repo_path, 'remote')[1]):
- git_command(
- repo_path,
- "remote add upstream %(upstream)s" % git_opts)
+ has_upstream_remote = (
+ 'upstream' in git_command_output(repo_path, 'remote')[1])
+ if track_upstream:
+ # If we're configured to track upstream but the repo
+ # does not have an upstream remote, add one
+ if not has_upstream_remote:
+ git_command(
+ repo_path,
+ "remote add upstream %(upstream)s" % git_opts)
- # If we're configured to track upstream, make sure that
- # the upstream URL matches the config
+ # If we're configured to track upstream, make sure that
+ # the upstream URL matches the config
+ else:
+ git_command(
+ repo_path,
+ "remote set-url upstream %(upstream)s" % git_opts)
+
+ # Now that we have any upstreams configured, fetch all of the refs
+ # we might need, pruning remote branches that no longer exist
+ git_command(
+ repo_path, "remote update --prune", env=ssh_env)
else:
- git_command(
- repo_path,
- "remote set-url upstream %(upstream)s" % git_opts)
-
- # Now that we have any upstreams configured, fetch all of the refs
- # we might need, pruning remote branches that no longer exist
- git_command(
- repo_path, "remote update --prune", env=ssh_env)
+ # If we are not tracking upstream, then we do not need
+ # an upstream remote configured
+ if has_upstream_remote:
+ git_command(repo_path, "remote rm upstream")
# TODO(mordred): This is here so that later we can
# inspect the master branch for meta-info
@@ -414,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)
diff --git a/jeepyb/cmd/update_bug.py b/jeepyb/cmd/update_bug.py
index 3868651..5a351e4 100644
--- a/jeepyb/cmd/update_bug.py
+++ b/jeepyb/cmd/update_bug.py
@@ -254,7 +254,7 @@
Our regular expression is composed of three major parts:
part1: Matches only at start-of-line (required). Optionally matches any
word or hyphen separated words.
- part2: Matches the words 'bug' or 'lp' on a word boundry (required).
+ part2: Matches the words 'bug' or 'lp' on a word boundary (required).
part3: Matches a whole number (required).
The following patterns will be matched properly:
diff --git a/jeepyb/cmd/welcome_message.py b/jeepyb/cmd/welcome_message.py
index e031ff7..3536769 100644
--- a/jeepyb/cmd/welcome_message.py
+++ b/jeepyb/cmd/welcome_message.py
@@ -58,7 +58,7 @@
cursor.execute(query, searchkey)
data = cursor.fetchone()
if data:
- if data[0] == "1":
+ if data[0] == 1:
logger.info('We found a newbie: %s', uploader)
return True
else:
@@ -136,7 +136,7 @@
# Don't actually post the message
parser.add_argument('--dryrun', dest='dryrun', action='store_true')
parser.add_argument('--no-dryrun', dest='dryrun', action='store_false')
- parser.add_argument('-v', dest='verbose', action='store_true',
+ parser.add_argument('-v', '--verbose', dest='verbose', action='store_true',
help='verbose output')
parser.set_defaults(dryrun=False)
diff --git a/jeepyb/projects.py b/jeepyb/projects.py
index da898b9..64d00d9 100644
--- a/jeepyb/projects.py
+++ b/jeepyb/projects.py
@@ -55,66 +55,11 @@
def is_direct_release(project_full_name):
try:
- direct = 'direct-release' in registry[project_full_name]['options']
- # return ...
+ return 'direct-release' in registry[project_full_name]['options']
except KeyError:
- direct = False
- # return False
-
- return direct or _hardcoded_is_direct_release(project_full_name)
+ return False
def docimpact_target(project_full_name):
- return registry.get('docimpact-group', 'unknown')
-
-
-# The following functions should be deleted when projects.yaml will be updated
-
-def _hardcoded_is_direct_release(project_full_name):
- """Test against a list of projects who directly release changes.
-
- This function should be removed when projects.yaml will be updated.
- To specify direct_release you just need add option 'direct_relese' to your
- project declaration in projects.yaml
-
- Example:
- - project: some/project
- options:
- - direct-release
- description: Best project ever.
- """
- return project_full_name in [
- 'openstack-dev/devstack',
- 'openstack-infra/askbot-theme',
- 'openstack-infra/config',
- 'openstack-infra/devstack-gate',
- 'openstack-infra/gerrit',
- 'openstack-infra/gerritbot',
- 'openstack-infra/gerritlib',
- 'openstack-infra/gitdm',
- 'openstack-infra/lodgeit',
- 'openstack-infra/meetbot',
- 'openstack-infra/nose-html-output',
- 'openstack-infra/publications',
- 'openstack-infra/reviewday',
- 'openstack-infra/statusbot',
- 'openstack/api-site',
- 'openstack/openstack-manuals',
- 'openstack/tempest',
- 'openstack/tripleo-heat-templates',
- 'openstack/tripleo-image-elements',
- 'openstack/tripleo-incubator',
- 'stackforge/cookbook-openstack-block-storage',
- 'stackforge/cookbook-openstack-common',
- 'stackforge/cookbook-openstack-compute',
- 'stackforge/cookbook-openstack-dashboard',
- 'stackforge/cookbook-openstack-identity',
- 'stackforge/cookbook-openstack-image',
- 'stackforge/cookbook-openstack-metering',
- 'stackforge/cookbook-openstack-network',
- 'stackforge/cookbook-openstack-object-storage',
- 'stackforge/cookbook-openstack-ops-database',
- 'stackforge/cookbook-openstack-ops-messaging',
- 'stackforge/cookbook-openstack-orchestration',
- 'stackforge/openstack-chef-repo',
- ]
+ return registry.get_project_item(project_full_name, 'docimpact-group',
+ 'unknown')
diff --git a/jeepyb/utils.py b/jeepyb/utils.py
index d010e3b..f92852e 100644
--- a/jeepyb/utils.py
+++ b/jeepyb/utils.py
@@ -51,5 +51,8 @@
def __getitem__(self, item):
return self.configs[item]
- def get(self, item, default=None):
- return self.configs.get(item, default)
+ def get_project_item(self, project, item, default=None):
+ if project in self.configs:
+ return self.configs[project].get(item, default)
+ else:
+ return default