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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Boxiang Sun
slapos.recipe.build
Commits
3eafc56e
Commit
3eafc56e
authored
Jan 28, 2015
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gitclone: keep local changes when there is an error during update
parent
9dcf201f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
11 deletions
+47
-11
README.rst
README.rst
+28
-0
slapos/recipe/gitclone.py
slapos/recipe/gitclone.py
+19
-11
No files found.
README.rst
View file @
3eafc56e
...
...
@@ -403,6 +403,34 @@ In case of uninstall, buildout will keep the repository directory::
Installing git-clone.
destination directory already exists.
If an error occurs during update, the error is catched to prevent buildout
behavior of deleting parts it failed to update. One type of possible error is
fetching from a non existant remote::
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... parts = git-clone
...
... [git-clone]
... recipe = slapos.recipe.build:gitclone
... repository = http://git.erp5.org/repos/slapos.recipe.build.git
... """)
>>> print system(buildout)
Installing git-clone.
...
>>> cd(sample_buildout, 'parts', 'git-clone')
>>> print system('echo kept > local_change')
>>> git remote add broken https://git.erp5.org/repos/nowhere')
...
>>> print system(buildout)
Updating git-clone.
...
Unable to update:
...
>>> print system('cat local_change')
kept
Ignore SSL certificate
~~~~~~~~~~~~~~~~~~~~~~
...
...
slapos/recipe/gitclone.py
View file @
3eafc56e
...
...
@@ -242,6 +242,7 @@ class Recipe(object):
If user doesn't develop, reset to remote revision (or branch if revision is
not specified).
"""
try
:
# first cleanup pyc files
self
.
deletePycFiles
(
self
.
location
)
...
...
@@ -255,6 +256,13 @@ class Recipe(object):
self
.
gitReset
(
self
.
revision
)
else
:
self
.
gitReset
(
'@{upstream}'
)
except
:
if
not
self
.
develop
:
raise
# Buildout will remove the installed location and mark the part as not
# installed if an error occurs during update. If we are developping this
# repository we do not want this to happen.
print
'Unable to update:
\
n
%s'
%
traceback
.
format_exc
()
def
uninstall
(
name
,
options
):
"""Keep the working copy, unless develop is set to false.
...
...
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