Commit 1f9e5e48 authored by Xavier Thompson's avatar Xavier Thompson

gitclone: Always keep develop repository intact

parent 59c1361b
......@@ -846,7 +846,6 @@ In case of uninstall, buildout will keep the repository directory::
>>> print(system(buildout))
Uninstalling git-clone.
Running uninstall recipe.
You have uncommitted changes in /sample-buildout/parts/git-clone. This folder will be left as is.
Installing git-clone.
destination directory already exists.
...
......
......@@ -306,36 +306,11 @@ class Recipe(object):
'--recursive'], cwd=self.location)
def uninstall(name, options):
"""Keep the working copy, unless develop is set to false.
"""Keep the working copy when develop is false.
"""
if not os.path.exists(options['location']):
return
force_keep = False
if options.get('develop', 'yes').lower() in TRUE_VALUES:
git_path = options.get('git-executable', 'git')
if not os.path.isabs(git_path) or os.path.exists(git_path):
p = subprocess.Popen([git_path, 'status', '--short'],
cwd=options['location'],
stdout=subprocess.PIPE)
if p.communicate()[0].strip():
print("You have uncommitted changes in %s."
" This folder will be left as is." % options['location'])
force_keep = True
p = subprocess.Popen([git_path,
'log', '--branches', '--not', '--remotes'],
cwd=options['location'],
stdout=subprocess.PIPE)
if p.communicate()[0].strip():
print("You have commits not pushed upstream in %s."
" This folder will be left as is." % options['location'])
force_keep = True
else:
print("Cannot check if there are unpushed/uncommitted changes in %s."
" This folder will be left as is." % options['location'])
force_keep = True
if force_keep:
# Eventhough this behaviour is not documented, buildout won't uninstall
# anything if we unset __buildout_installed__
options['__buildout_installed__'] = ''
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment