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
3ce57e20
Commit
3ce57e20
authored
Sep 25, 2014
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement needs_push/needs_merge to vcs abstraction
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
4fa82270
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
1 deletion
+41
-1
weblate/trans/tests/test_vcs.py
weblate/trans/tests/test_vcs.py
+5
-0
weblate/trans/vcs.py
weblate/trans/vcs.py
+36
-1
No files found.
weblate/trans/tests/test_vcs.py
View file @
3ce57e20
...
...
@@ -85,3 +85,8 @@ class VCSGitTest(RepoTestCase):
self
.
assertTrue
(
'authordate'
in
info
)
self
.
assertTrue
(
'commit'
in
info
)
self
.
assertTrue
(
'commitdate'
in
info
)
def
test_merge
(
self
):
repo
=
GitRepository
.
clone
(
self
.
repo_path
,
self
.
_tempdir
)
self
.
assertFalse
(
repo
.
needs_merge
(
'master'
))
self
.
assertFalse
(
repo
.
needs_push
(
'master'
))
weblate/trans/vcs.py
View file @
3ce57e20
...
...
@@ -38,7 +38,6 @@ class Repository(object):
- repository configuration (SubProject.configure_repo)
- branch configuration (SubProject.configure_branch)
- needs merge/push (SubProject.git_needs_merge/push)
- get object hash (Translation.get_git_blob_hash)
- commit (Translation.__git_commit)
- configuration (Translation.__configure_committer)
...
...
@@ -143,6 +142,20 @@ class Repository(object):
"""
raise
NotImplementedError
()
def
needs_merge
(
self
,
branch
):
"""
Checks whether repository needs merge with upstream
(is missing some revisions).
"""
raise
NotImplementedError
()
def
needs_push
(
self
,
branch
):
"""
Checks whether repository needs push to upstream
(has additional revisions).
"""
raise
NotImplementedError
()
def
get_revision_info
(
self
,
revision
):
"""
Returns dictionary with detailed revision information.
...
...
@@ -221,3 +234,25 @@ class GitRepository(Repository):
result
[
'summary'
]
=
message
[
0
]
return
result
def
_log_revisions
(
self
,
refspec
):
"""
Returns revisin log for given refspec.
"""
return
self
.
_execute
(
[
'log'
,
'--oneline'
,
refspec
,
'--'
]
)
def
needs_merge
(
self
,
branch
):
"""
Checks whether repository needs merge with upstream
(is missing some revisions).
"""
return
self
.
_log_revisions
(
'..origin/{0}'
.
format
(
branch
))
!=
''
def
needs_push
(
self
,
branch
):
"""
Checks whether repository needs push to upstream
(has additional revisions).
"""
return
self
.
_log_revisions
(
'origin/{0}..'
.
format
(
branch
))
!=
''
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