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
aa3f1654
Commit
aa3f1654
authored
Nov 13, 2014
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve error handling in VCS module
parent
5ead5b3e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
weblate/trans/vcs.py
weblate/trans/vcs.py
+15
-5
No files found.
weblate/trans/vcs.py
View file @
aa3f1654
...
@@ -34,6 +34,19 @@ class RepositoryException(Exception):
...
@@ -34,6 +34,19 @@ class RepositoryException(Exception):
"""
"""
Error while working with a repository.
Error while working with a repository.
"""
"""
def
__init__
(
self
,
retcode
,
stderr
,
stdout
):
self
.
retcode
=
retcode
self
.
stderr
=
stderr
.
strip
()
self
.
stdout
=
stdout
.
strip
()
def
__str__
(
self
):
if
self
.
stderr
:
message
=
self
.
stderr
else
:
message
=
self
.
stdout
if
self
.
retcode
!=
0
:
return
'{0} ({1})'
.
format
(
message
,
self
.
retcode
)
return
message
class
Repository
(
object
):
class
Repository
(
object
):
...
@@ -87,7 +100,7 @@ class Repository(object):
...
@@ -87,7 +100,7 @@ class Repository(object):
Executes the command using popen.
Executes the command using popen.
'''
'''
if
args
is
None
:
if
args
is
None
:
raise
RepositoryException
(
'Not supported functionality
'
)
raise
RepositoryException
(
0
,
'Not supported functionality'
,
'
'
)
args
=
[
cls
.
_cmd
]
+
args
args
=
[
cls
.
_cmd
]
+
args
process
=
subprocess
.
Popen
(
process
=
subprocess
.
Popen
(
args
,
args
,
...
@@ -99,10 +112,7 @@ class Repository(object):
...
@@ -99,10 +112,7 @@ class Repository(object):
output
,
output_err
=
process
.
communicate
()
output
,
output_err
=
process
.
communicate
()
retcode
=
process
.
poll
()
retcode
=
process
.
poll
()
if
retcode
:
if
retcode
:
message
=
output_err
.
strip
()
raise
RepositoryException
(
retcode
,
output_err
,
output
)
if
not
message
:
message
=
output
.
strip
()
raise
RepositoryException
(
message
)
return
output
return
output
def
execute
(
self
,
args
):
def
execute
(
self
,
args
):
...
...
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