Commit 2cd8aa1f authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

fix branch / repo

parent 7276134c
Pipeline #999 passed with stages
in 40 seconds
# Generated by Django 2.0.5 on 2018-07-19 08:33
from django.db import migrations, models
import django.db.models.deletion
def branch_unique_repo(apps, schema_editor):
apps.get_model('rainboard', 'Branch').objects.filter(repo=None).delete()
class Migration(migrations.Migration):
dependencies = [
('rainboard', '0022_dependency_ros'),
]
operations = [
migrations.RunPython(branch_unique_repo),
migrations.AlterField(
model_name='branch',
name='repo',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='rainboard.Repo'),
),
migrations.AlterUniqueTogether(
name='branch',
unique_together={('project', 'name', 'repo')},
),
]
......@@ -489,7 +489,7 @@ class Branch(TimeStampedModel):
ahead = models.PositiveSmallIntegerField(blank=True, null=True)
behind = models.PositiveSmallIntegerField(blank=True, null=True)
updated = models.DateTimeField(blank=True, null=True)
repo = models.ForeignKey(Repo, on_delete=models.CASCADE, null=True)
repo = models.ForeignKey(Repo, on_delete=models.CASCADE)
deleted = models.BooleanField(default=False)
keep_doc = models.BooleanField(default=False)
......@@ -497,7 +497,7 @@ class Branch(TimeStampedModel):
return self.name
class Meta:
unique_together = ('project', 'name')
unique_together = ('project', 'name', 'repo')
def get_ahead(self, branch='master'):
commits = self.project.git().git.rev_list(f'{branch}..{self}')
......
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