Commit b6cef74d authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

project name with spaces

parent 9daa4191
Pipeline #1903 passed with stages
in 39 seconds
...@@ -28,16 +28,20 @@ class Command(BaseCommand): ...@@ -28,16 +28,20 @@ class Command(BaseCommand):
log(f'\nPulling Robotpkg\n') log(f'\nPulling Robotpkg\n')
update_robotpkg(settings.RAINBOARD_RPKG) update_robotpkg(settings.RAINBOARD_RPKG)
log(f'\nUpdating all projects\n')
for project in Project.objects.all():
log(f' {project}')
try:
project.update()
except Branch.DoesNotExist:
project.update_branches()
project.update()
log(f'\nUpdating Robotpkg\n') log(f'\nUpdating Robotpkg\n')
for robotpkg in Robotpkg.objects.all(): for robotpkg in Robotpkg.objects.all():
log(f' {robotpkg}') log(f' {robotpkg}')
robotpkg.update(pull=False) robotpkg.update(pull=False)
log(f'\nUpdating all projects\n')
for project in Project.objects.all():
log(f' {project}')
project.update()
Branch.objects.filter( Branch.objects.filter(
Q(name__endswith='master') | Q(name__endswith='devel'), Q(name__endswith='master') | Q(name__endswith='devel'),
repo__namespace=F('project__main_namespace'), repo__forge__source=SOURCES.gitlab repo__namespace=F('project__main_namespace'), repo__forge__source=SOURCES.gitlab
......
...@@ -867,7 +867,7 @@ def update_gitlab(forge, data): ...@@ -867,7 +867,7 @@ def update_gitlab(forge, data):
logger.info(f'update {data["name"]} from {forge}') logger.info(f'update {data["name"]} from {forge}')
public = data['visibility'] not in ['private', 'internal'] public = data['visibility'] not in ['private', 'internal']
project, created = Project.objects.get_or_create( project, created = Project.objects.get_or_create(
name=data['name'], defaults={ name=data['name'].replace('-', ' ').replace('_', ' '), defaults={
'main_forge': forge, 'main_forge': forge,
'public': public 'public': public
}) })
...@@ -904,7 +904,7 @@ def update_gitlab(forge, data): ...@@ -904,7 +904,7 @@ def update_gitlab(forge, data):
def update_github(forge, namespace, data): def update_github(forge, namespace, data):
logger.info(f'update {data["name"]} from {forge}') logger.info(f'update {data["name"]} from {forge}')
project, _ = Project.objects.get_or_create( project, _ = Project.objects.get_or_create(
name=data['name'], defaults={ name=data['name'].replace('_', ' ').replace('-', ' '), defaults={
'homepage': data['homepage'], 'homepage': data['homepage'],
'main_namespace': namespace, 'main_namespace': namespace,
'main_forge': forge 'main_forge': forge
...@@ -947,7 +947,7 @@ def update_github(forge, namespace, data): ...@@ -947,7 +947,7 @@ def update_github(forge, namespace, data):
def update_travis(namespace, data): def update_travis(namespace, data):
project = Project.objects.filter(name=data['name']).first() project = Project.objects.filter(name=data['name'].replace('_', ' ').replace('-', ' ')).first()
if project is None: if project is None:
return return
forge = Forge.objects.get(source=SOURCES.github) forge = Forge.objects.get(source=SOURCES.github)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment