Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
56c6b609
Commit
56c6b609
authored
May 10, 2013
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support for mercurial notifications from bitbucket
parent
cc1e0c26
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
15 deletions
+23
-15
trans/views/api.py
trans/views/api.py
+23
-15
No files found.
trans/views/api.py
View file @
56c6b609
...
...
@@ -33,12 +33,17 @@ import weblate
import
threading
BITBUCKET_REPOS
=
(
BITBUCKET_
GIT_
REPOS
=
(
'ssh://git@bitbucket.org/%(owner)s/%(slug)s.git'
,
'git@bitbucket.org:%(owner)s/%(slug)s.git'
,
'https://bitbucket.org/%(owner)s/%(slug)s.git'
,
)
BITBUCKET_HG_REPOS
=
(
'hg::ssh://hg@bitbucket.org/%(owner)s/%(slug)s'
,
'hg::https://bitbucket.org/%(owner)s/%(slug)s'
,
)
GITHUB_REPOS
=
(
'git://github.com/%(owner)s/%(slug)s.git'
,
'https://github.com/%(owner)s/%(slug)s.git'
,
...
...
@@ -153,24 +158,27 @@ def bitbucket_hook_helper(data):
'''
API to handle commit hooks from Bitbucket.
'''
# Parse owner, branch and repository name
owner
=
data
[
'repository'
][
'owner'
]
slug
=
data
[
'repository'
][
'slug'
]
branch
=
data
[
'commits'
][
-
1
][
'branch'
]
params
=
{
'owner'
:
owner
,
'slug'
:
slug
}
# Construct possible repository URLs
if
data
[
'repository'
][
'scm'
]
==
'git'
:
# Parse owner, branch and repository name
owner
=
data
[
'repository'
][
'owner'
]
slug
=
data
[
'repository'
][
'slug'
]
branch
=
data
[
'commits'
][
-
1
][
'branch'
]
# Construct possible repository URLs
repos
=
[
repo
%
{
'owner'
:
owner
,
'slug'
:
slug
}
for
repo
in
BITBUCKET_REPOS
]
return
{
'service_long_name'
:
'Bitbucket'
,
'repos'
:
repos
,
'branch'
:
branch
,
}
repos
=
[
repo
%
params
for
repo
in
BITBUCKET_GIT_REPOS
]
elif
data
[
'repository'
][
'scm'
]
==
'hg'
:
repos
=
[
repo
%
params
for
repo
in
BITBUCKET_HG_REPOS
]
else
:
weblate
.
logger
.
error
(
'unsupported repository'
,
repr
(
data
[
'repositoru'
]))
weblate
.
logger
.
error
(
'unsupported repository
: %s
'
,
repr
(
data
[
'repositoru'
]))
raise
ValueError
(
'unsupported repository'
)
return
{
'service_long_name'
:
'Bitbucket'
,
'repos'
:
repos
,
'branch'
:
branch
,
}
@
csrf_exempt
def
github_hook_helper
(
data
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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