Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Gepetto
dashboard
Commits
2cd8aa1f
Commit
2cd8aa1f
authored
Jul 19, 2018
by
Guilhem Saurel
Browse files
fix branch / repo
parent
7276134c
Pipeline
#999
passed with stages
in 40 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
rainboard/migrations/0023_branch_repo.py
0 → 100644
View file @
2cd8aa1f
# 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'
)},
),
]
rainboard/models.py
View file @
2cd8aa1f
...
...
@@ -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
}
'
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment