Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.recipe.build
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
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
slapos.recipe.build
Commits
5f7fb658
Commit
5f7fb658
authored
Jan 17, 2019
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not update if revision given
parent
8f904a03
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
27 deletions
+16
-27
slapos/recipe/gitclone.py
slapos/recipe/gitclone.py
+16
-27
No files found.
slapos/recipe/gitclone.py
View file @
5f7fb658
...
...
@@ -188,6 +188,7 @@ class Recipe(object):
shutil
.
rmtree
(
self
.
location
)
else
:
# If develop is set, assume that this is a valid working copy
self
.
_update
()
return
[
self
.
location
]
if
getattr
(
self
,
'branch_overrided'
,
None
):
...
...
@@ -270,6 +271,10 @@ class Recipe(object):
raise
def
update
(
self
):
if
not
self
.
revision
:
self
.
_update
()
def
_update
(
self
):
"""
Do a git fetch.
If user doesn't develop, reset to remote revision (or branch if revision is
...
...
@@ -282,41 +287,25 @@ class Recipe(object):
# first cleanup pyc files
self
.
deletePycFiles
(
self
.
location
)
# Check if the revision exists in the already fetched repository
revision_exists
=
False
if
self
.
revision
:
try
:
revision_exists
=
(
check_output
([
self
.
git_command
,
'cat-file'
,
'-t'
,
self
.
revision
]).
strip
()
==
'commit'
)
except
CalledProcessError
:
print
(
'Revision %s does not exits in the repository'
%
self
.
revision
)
pass
# then update,
# but, to save time, only if we don't have the revision already
revision_already_fetched
=
self
.
revision
and
revision_exists
if
not
revision_already_fetched
:
check_call
([
self
.
git_command
,
'fetch'
,
'--all'
],
cwd
=
self
.
location
)
# If develop parameter is set, don't reset/update.
# Otherwise, reset --hard
if
not
self
.
develop
:
if
self
.
revision
:
self
.
gitReset
(
self
.
revision
)
else
:
check_call
([
self
.
git_command
,
'fetch'
,
'--all'
],
cwd
=
self
.
location
)
self
.
gitReset
(
'@{upstream}'
)
if
not
self
.
ignore_cloning_submodules
and
self
.
revision
:
# Update the submodule to the commit which parent repo points to if
# there has been revision is present for the parent repo.
# According to man-page of submodule, update also clones missing
# submodules and updating the working tree of the submodules. This is
# why we do update here only after we are ok with revision of parent
# repo being checked out to the desired one.
# NOTE: This will put the submodule repo in a `Detached` state.
check_call
([
self
.
git_command
,
'submodule'
,
'update'
,
'--recursive'
],
cwd
=
self
.
location
)
if
not
self
.
ignore_cloning_submodules
:
# Update the submodule to the commit which parent repo points to if
# there has been revision is present for the parent repo.
# According to man-page of submodule, update also clones missing
# submodules and updating the working tree of the submodules. This is
# why we do update here only after we are ok with revision of parent
# repo being checked out to the desired one.
# NOTE: This will put the submodule repo in a `Detached` state.
check_call
([
self
.
git_command
,
'submodule'
,
'update'
,
'--recursive'
],
cwd
=
self
.
location
)
except
:
if
not
self
.
develop
:
...
...
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