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
3d4af2cb
Commit
3d4af2cb
authored
Feb 18, 2013
by
Stefano Rivera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow mass importing against an existing sub-project
parent
e3a4df2a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
2 deletions
+32
-2
weblate/trans/management/commands/import_project.py
weblate/trans/management/commands/import_project.py
+15
-2
weblate/trans/tests/test_commands.py
weblate/trans/tests/test_commands.py
+17
-0
No files found.
weblate/trans/management/commands/import_project.py
View file @
3d4af2cb
...
...
@@ -20,6 +20,7 @@
from
django.core.management.base
import
BaseCommand
,
CommandError
from
weblate.trans.models
import
SubProject
,
Project
from
weblate.trans.util
import
is_repo_link
from
glob
import
glob
import
tempfile
import
git
...
...
@@ -118,8 +119,20 @@ class Command(BaseCommand):
'for subproject part of the match!'
)
names
,
sharedrepo
=
self
.
import_initial
(
project
,
repo
,
branch
,
filemask
)
if
is_repo_link
(
repo
):
sharedrepo
=
repo
master_sub_project
=
repo
.
rsplit
(
'/'
,
1
)[
-
1
]
try
:
sub_project
=
SubProject
.
objects
.
get
(
project
=
project
,
slug
=
master_sub_project
)
except
SubProject
.
DoesNotExist
:
raise
CommandError
(
'SubProject %s does not exist, '
'you need to create it first!'
%
repo
)
names
=
self
.
get_matching_subprojects
(
sub_project
.
get_path
(),
filemask
)
else
:
names
,
sharedrepo
=
self
.
import_initial
(
project
,
repo
,
branch
,
filemask
)
# Create remaining subprojects sharing git repository
for
name
in
names
:
...
...
weblate/trans/tests/test_commands.py
View file @
3d4af2cb
...
...
@@ -40,6 +40,23 @@ class ImportTest(RepoTestCase):
# We should have loaded two subprojects
self
.
assertEqual
(
project
.
subproject_set
.
count
(),
2
)
def
test_import_against_existing
(
self
):
'''
Test importing with a weblate:// URL
'''
android
=
self
.
create_android
()
project
=
android
.
project
self
.
assertEqual
(
project
.
subproject_set
.
count
(),
1
)
call_command
(
'import_project'
,
project
.
slug
,
'weblate://%s/%s'
%
(
project
.
slug
,
android
.
slug
),
'master'
,
'**/*.po'
,
)
# We should have loaded two subprojects
self
.
assertEqual
(
project
.
subproject_set
.
count
(),
3
)
def
test_import_missing_project
(
self
):
'''
Test of correct handling of missing project.
...
...
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