Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
orchestra-v3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alessandro Di Federico
orchestra-v3
Commits
120e88bb
Commit
120e88bb
authored
4 years ago
by
Filippo Cremonese
Browse files
Options
Downloads
Patches
Plain Diff
Get remote list dynamically
parent
5a007e96
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
orchestra/actions/clone.py
+8
-3
8 additions, 3 deletions
orchestra/actions/clone.py
with
8 additions
and
3 deletions
orchestra/actions/clone.py
+
8
−
3
View file @
120e88bb
import
os.path
import
re
from
functools
import
cached_property
from
.action
import
Action
from
.util
import
run_script
...
...
@@ -30,13 +31,17 @@ class CloneAction(Action):
def
_is_satisfied
(
self
):
return
os
.
path
.
exists
(
self
.
environment
[
"
SOURCE_DIR
"
])
@cached_property
def
remotes
(
self
):
result
=
run_script
(
'
git -C
"
$ORCHESTRA_DOTDIR
"
remote show
'
,
environment
=
self
.
environment
,
quiet
=
True
)
return
result
.
stdout
.
decode
(
"
utf-8
"
).
split
(
"
\n
"
).
strip
().
split
(
"
\n
"
)
def
remote_base_urls
(
self
):
# TODO: the remote is not necessarily called origin, and there might be more than one
# remote names should be configurable
remotes
=
[
"
origin
"
,
"
private
"
]
base_urls
=
[]
for
remote
in
remotes
:
for
remote
in
self
.
remotes
:
result
=
run_script
(
f
'
git -C
"
$ORCHESTRA_DOTDIR
"
config --get remote.
{
remote
}
.url
'
,
environment
=
self
.
environment
,
...
...
@@ -64,7 +69,7 @@ class CloneAction(Action):
quiet
=
True
,
environment
=
self
.
environment
,
check_returncode
=
False
).
stdout
.
decode
(
"
utf-8
"
)
).
stdout
.
decode
(
"
utf-8
"
)
parse_regex
=
re
.
compile
(
r
"
(?P<commit>[a-f0-9]*)\W*refs/heads/(?P<branch>.*)
"
)
matches
=
parse_regex
.
findall
(
result
)
for
commit
,
branch
in
matches
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment