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
efb61744
Commit
efb61744
authored
Nov 14, 2014
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add is_supported method to VCS backend
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
c0cb7581
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
1 deletion
+38
-1
requirements-optional.txt
requirements-optional.txt
+1
-1
weblate/trans/tests/test_vcs.py
weblate/trans/tests/test_vcs.py
+3
-0
weblate/trans/vcs.py
weblate/trans/vcs.py
+34
-0
No files found.
requirements-optional.txt
View file @
efb61744
...
...
@@ -2,4 +2,4 @@
PyICU
pyLibravatar
babel
Mercurial
Mercurial
>=2.8
weblate/trans/tests/test_vcs.py
View file @
efb61744
...
...
@@ -117,6 +117,9 @@ class VCSGitTest(RepoTestCase):
self
.
assertFalse
(
self
.
repo
.
needs_merge
(
self
.
_branch
))
self
.
assertFalse
(
self
.
repo
.
needs_push
(
self
.
_branch
))
def
test_is_supported
(
self
):
self
.
assertTrue
(
self
.
_class
.
is_supported
())
def
test_get_version
(
self
):
self
.
assertTrue
(
self
.
_class
.
get_version
()
!=
''
)
...
...
weblate/trans/vcs.py
View file @
efb61744
...
...
@@ -26,6 +26,7 @@ import email.utils
import
re
import
ConfigParser
import
hashlib
from
distutils.version
import
LooseVersion
from
dateutil
import
parser
from
weblate.trans.util
import
get_clean_env
...
...
@@ -215,6 +216,17 @@ class Repository(object):
"""
raise
NotImplementedError
()
@
classmethod
def
is_supported
(
cls
):
"""
Checks whether this VCS backend is supported.
"""
try
:
cls
.
get_version
()
return
True
except
OSError
:
return
False
@
classmethod
def
get_version
(
cls
):
"""
...
...
@@ -433,6 +445,17 @@ class GitRepository(Repository):
"""
return
self
.
_log_revisions
(
'origin/{0}..'
.
format
(
branch
))
!=
''
@
classmethod
def
is_supported
(
cls
):
"""
Checks whether this VCS backend is supported.
"""
try
:
version
=
cls
.
get_version
()
return
LooseVersion
(
version
)
>=
'1.6'
except
OSError
:
return
False
@
classmethod
def
get_version
(
cls
):
"""
...
...
@@ -735,6 +758,17 @@ class HgRepository(Repository):
"""
return self.execute(['
log
', '
-
r', '
not
public
()
']) != ''
@classmethod
def is_supported(cls):
"""
Checks whether this VCS backend is supported.
"""
try:
version = cls.get_version()
return LooseVersion(version) >= '
2.8
'
except OSError:
return False
@classmethod
def get_version(cls):
"""
...
...
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