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
861e6098
Commit
861e6098
authored
May 06, 2014
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make logger an class attribute
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
00966172
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
weblate/trans/management/commands/import_project.py
weblate/trans/management/commands/import_project.py
+10
-9
No files found.
weblate/trans/management/commands/import_project.py
View file @
861e6098
...
...
@@ -68,6 +68,7 @@ class Command(BaseCommand):
self
.
file_format
=
None
self
.
name_template
=
None
self
.
base_file_template
=
None
self
.
logger
=
weblate
.
logger
def
format_string
(
self
,
template
,
match
):
'''
...
...
@@ -98,15 +99,15 @@ class Command(BaseCommand):
os
.
chmod
(
workdir
,
0755
)
# Initialize git repository
weblate
.
logger
.
info
(
'Initializing git repository...'
)
self
.
logger
.
info
(
'Initializing git repository...'
)
gitrepo
=
git
.
Repo
.
init
(
workdir
)
gitrepo
.
git
.
remote
(
'add'
,
'origin'
,
repo
)
weblate
.
logger
.
info
(
'Fetching remote git repository...'
)
self
.
logger
.
info
(
'Fetching remote git repository...'
)
gitrepo
.
git
.
remote
(
'update'
,
'origin'
)
gitrepo
.
git
.
branch
(
'--track'
,
branch
,
'origin/%s'
%
branch
)
weblate
.
logger
.
info
(
'Updating working copy in git repository...'
)
self
.
logger
.
info
(
'Updating working copy in git repository...'
)
gitrepo
.
git
.
checkout
(
branch
)
return
workdir
...
...
@@ -124,14 +125,14 @@ class Command(BaseCommand):
'''
# Find matching files
matches
=
self
.
get_matching_files
(
repo
)
weblate
.
logger
.
info
(
'Found %d matching files'
,
len
(
matches
))
self
.
logger
.
info
(
'Found %d matching files'
,
len
(
matches
))
# Parse subproject names out of them
names
=
set
()
maskre
=
self
.
get_match_regexp
()
for
match
in
matches
:
names
.
add
(
self
.
get_name
(
maskre
,
match
))
weblate
.
logger
.
info
(
'Found %d subprojects'
,
len
(
names
))
self
.
logger
.
info
(
'Found %d subprojects'
,
len
(
names
))
return
names
def
handle
(
self
,
*
args
,
**
options
):
...
...
@@ -200,13 +201,13 @@ class Command(BaseCommand):
project
=
project
)
if
subprojects
.
exists
():
weblate
.
logger
.
warn
(
self
.
logger
.
warn
(
'Subproject %s already exists, skipping'
,
name
)
continue
weblate
.
logger
.
info
(
'Creating subproject %s'
,
name
)
self
.
logger
.
info
(
'Creating subproject %s'
,
name
)
SubProject
.
objects
.
create
(
name
=
name
,
slug
=
slug
,
...
...
@@ -233,7 +234,7 @@ class Command(BaseCommand):
slug
=
slugify
(
name
)
if
SubProject
.
objects
.
filter
(
project
=
project
,
slug
=
slug
).
exists
():
weblate
.
logger
.
warn
(
self
.
logger
.
warn
(
'Subproject %s already exists, skipping and using it '
'as main subproject'
,
name
...
...
@@ -241,7 +242,7 @@ class Command(BaseCommand):
shutil
.
rmtree
(
workdir
)
return
matches
,
'weblate://%s/%s'
%
(
project
.
slug
,
slug
)
weblate
.
logger
.
info
(
'Creating subproject %s as main subproject'
,
name
)
self
.
logger
.
info
(
'Creating subproject %s as main subproject'
,
name
)
# Rename gitrepository to new name
os
.
rename
(
...
...
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