Allow to specify default branch for repos

By default Stackalytics processes commits from master branch,
but for 3rd-party projects that may not work. Allow to set which
branch needs to be used.

Closes bug 1434533

Change-Id: I0a0b7e610a807c643e391535784824bd8328e54a
This commit is contained in:
Ilya Shakhat
2015-04-01 14:47:14 +03:00
parent ce121e8067
commit cad8a87ce6
6 changed files with 28 additions and 8 deletions

View File

@@ -12341,6 +12341,24 @@
"module": "jcloud",
"organization": "jcloud",
"uri": "https://github.com/jclouds/jclouds.git"
},
{
"module": "ansible",
"organization": "ansible",
"uri": "https://github.com/ansible/ansible.git",
"default_branch": "devel"
},
{
"module": "ansible-modules-core",
"organization": "ansible",
"uri": "https://github.com/ansible/ansible-modules-core.git",
"default_branch": "devel"
},
{
"module": "ansible-modules-extras",
"organization": "ansible",
"uri": "https://github.com/ansible/ansible-modules-extras.git",
"default_branch": "devel"
}
],
"project_sources": [
@@ -12363,10 +12381,6 @@
{
"organization": "cloudfoundry",
"uri": "github://"
},
{
"organization": "ansible",
"uri": "github://"
}
],
"module_groups": [

View File

@@ -110,6 +110,9 @@
"items": {
"type": "string"
}
},
"default_branch": {
"type": "string"
}
},
"required": ["uri", "module", "organization"],
@@ -167,6 +170,9 @@
"items": {
"type": "string"
}
},
"default_branch": {
"type": "string"
}
},
"required": ["organization"],

View File

@@ -84,7 +84,7 @@ show_record_type=True, show_user_gravatar=True, gravatar_size=32, show_all=True)
{%if record_type == "commit" %}
<div class="header">Commit &ldquo;${subject}&rdquo;</div>
<div class="message">{%html message %}</div>
{%if commit_date_str != "" %}
{%if commit_date_str != "" && commit_date_str != date_str %}
<div>Commit date: ${commit_date_str}</div>
{%/if%}
{%if correction_comment != "" %}

View File

@@ -114,7 +114,7 @@ def _retrieve_project_list_from_github(project_source):
for repo in github_repos:
yield {
'branches': ['master'],
'branches': [project_source.get('default_branch', 'master')],
'module': repo.name.lower(),
'organization': organization,
'uri': repo.git_url,

View File

@@ -85,7 +85,7 @@ def import_data(memcached_inst, fd):
def get_repo_keys(memcached_inst):
for repo in (memcached_inst.get('repos') or []):
uri = repo['uri']
branches = set(['master'])
branches = {repo.get('default_branch', 'master')}
for release in repo.get('releases'):
if 'branch' in release:
branches.add(release['branch'])

View File

@@ -119,7 +119,7 @@ def _process_repo(repo, runtime_storage_inst, record_processor_inst,
vcs_inst = vcs.get_vcs(repo, cfg.CONF.sources_root)
vcs_inst.fetch()
branches = set(['master'])
branches = {repo.get('default_branch', 'master')}
for release in repo.get('releases'):
if 'branch' in release:
branches.add(release['branch'])