fetch.py 473 Bytes
Newer Older
Guilhem Saurel's avatar
git    
Guilhem Saurel committed
1
2
3
import logging

from django.core.management.base import BaseCommand
Guilhem Saurel's avatar
Guilhem Saurel committed
4
from rainboard.models import Project
Guilhem Saurel's avatar
git    
Guilhem Saurel committed
5
6
7

logger = logging.getLogger('rainboard.management.fetch')

Guilhem Saurel's avatar
Guilhem Saurel committed
8

Guilhem Saurel's avatar
git    
Guilhem Saurel committed
9
10
11
12
class Command(BaseCommand):
    help = 'Fetch all remotes'

    def handle(self, *args, **options):
Guilhem Saurel's avatar
flake8    
Guilhem Saurel committed
13
        logger.info('Fetching all repos')
Guilhem Saurel's avatar
Guilhem Saurel committed
14
        for project in Project.objects.all():
Guilhem Saurel's avatar
Guilhem Saurel committed
15
            logger.info(f' updating branches for {project}')
Guilhem Saurel's avatar
update    
Guilhem Saurel committed
16
            project.update_branches(main=False, pull=True)