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
6ef5b155
Commit
6ef5b155
authored
Feb 16, 2018
by
Guilhem Saurel
Browse files
merge_contributors
parent
03989f7e
Changes
2
Hide whitespace changes
Inline
Side-by-side
rainboard/models.py
View file @
6ef5b155
...
...
@@ -772,6 +772,18 @@ def update_travis(namespace, data):
repo
.
save
()
def
merge_contributors
(
*
contributors
):
logger
.
warning
(
f
'merging
{
contributors
}
'
)
ids
=
[
contributor
.
id
for
contributor
in
contributors
]
main
=
min
(
ids
)
for
model
in
(
ContributorName
,
ContributorMail
):
for
instance
in
model
.
objects
.
filter
(
contributor_id__in
=
ids
):
instance
.
contributor_id
=
main
instance
.
save
()
Contributor
.
objects
.
filter
(
id__in
=
ids
).
exclude
(
id
=
main
).
delete
()
return
Contributor
.
objects
.
get
(
id
=
main
)
def
get_contributor
(
name
,
mail
):
cname
,
name_created
=
ContributorName
.
objects
.
get_or_create
(
name
=
name
)
cmail
,
mail_created
=
ContributorMail
.
objects
.
get_or_create
(
mail
=
mail
,
defaults
=
{
'invalid'
:
invalid_mail
(
mail
)})
...
...
@@ -801,15 +813,5 @@ def get_contributor(name, mail):
cmail
.
contributor
=
contributor
cmail
.
save
()
else
:
contributor
,
fake
=
cname
.
contributor
,
cmail
.
contributor
logger
.
warning
(
f
'merging
{
contributor
}
&
{
fake
}
'
)
if
fake
.
id
<
contributor
.
id
:
contributor
,
fake
=
fake
,
contributor
for
n
in
fake
.
contributorname_set
.
all
():
n
.
contributor
=
contributor
n
.
save
()
for
m
in
fake
.
contributormail_set
.
all
():
m
.
contributor
=
contributor
m
.
save
()
fake
.
delete
()
contributor
=
merge_contributors
(
cname
.
contributor
,
cmail
.
contributor
)
return
contributor
rainboard/utils.py
View file @
6ef5b155
...
...
@@ -11,7 +11,7 @@ logger = logging.getLogger('rainboard.utils')
SOURCES
=
IntEnum
(
'Sources'
,
'github gitlab redmine robotpkg travis'
)
TARGETS
=
IntEnum
(
'Targets'
,
'14.04 16.04 17.10 18.04 dubnium'
)
INVALID_MAILS
=
(
'localhost'
,
'none'
)
INVALID_MAILS
=
(
'localhost'
,
'none'
,
'noreply'
)
def
slugify_with_dots
(
value
):
...
...
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