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
06df9177
Commit
06df9177
authored
Sep 26, 2014
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement repository configuration
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
075910b4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
5 deletions
+34
-5
weblate/trans/tests/test_vcs.py
weblate/trans/tests/test_vcs.py
+11
-1
weblate/trans/vcs.py
weblate/trans/vcs.py
+23
-4
No files found.
weblate/trans/tests/test_vcs.py
View file @
06df9177
...
...
@@ -19,7 +19,7 @@
#
from
weblate.trans.tests.test_models
import
RepoTestCase
from
weblate.trans.vcs
import
GitRepository
from
weblate.trans.vcs
import
GitRepository
,
RepositoryException
import
tempfile
import
shutil
...
...
@@ -170,3 +170,13 @@ class VCSGitTest(RepoTestCase):
self
.
repo
.
get_config
(
'remote.origin.fetch'
),
'+refs/heads/branch:refs/remotes/origin/branch'
,
)
def
test_configure_branch
(
self
):
# Existing branch
self
.
repo
.
configure_branch
(
'master'
)
self
.
assertRaises
(
RepositoryException
,
self
.
repo
.
configure_branch
,
(
'branch'
)
)
weblate/trans/vcs.py
View file @
06df9177
...
...
@@ -34,10 +34,6 @@ class RepositoryException(Exception):
class
Repository
(
object
):
"""
Basic repository object.
Currently missing methods:
- branch configuration (SubProject.configure_branch)
"""
_last_revision
=
None
_last_remote_revision
=
None
...
...
@@ -192,6 +188,12 @@ class Repository(object):
"""
raise
NotImplementedError
()
def
configure_branch
(
self
,
branch
):
"""
Configure repository branch.
"""
raise
NotImplementedError
()
class
GitRepository
(
Repository
):
"""
...
...
@@ -376,3 +378,20 @@ class GitRepository(Repository):
self
.
_execute
(
[
'remote'
,
'set-branches'
,
'--add'
,
'origin'
,
branch
]
)
def
configure_branch
(
self
,
branch
):
"""
Configure repository branch.
"""
# List of branches (we get additional * there, but we don't care)
branches
=
self
.
_execute
([
'branch'
]).
split
()
if
branch
in
branches
:
return
# Add branch
self
.
_execute
(
[
'branch'
,
'--track'
,
branch
,
'origin/{0}'
.
format
(
branch
)]
)
# Checkout
self
.
_execute
([
'checkout'
,
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