Commit c4d18f7d authored by Jérome Perrin's avatar Jérome Perrin

Revert "gitclone: when update(), if repository has local changes, don't do anything but warn user."

This reverts commit 9bd1e7e7.
What about test nodes ??
Why treating unpushed commits differently ?
parent 17ddc9fe
...@@ -167,20 +167,6 @@ When updating, it will do a "git fetch; git reset @{upstream}":: ...@@ -167,20 +167,6 @@ When updating, it will do a "git fetch; git reset @{upstream}"::
Fetching origin Fetching origin
HEAD is now at ... HEAD is now at ...
Note: if, during update, the recipe detects that local changes have been made
the recipe will warn the user, won't change content of the repository and
will succeed::
>>> print system('echo kept > parts/git-clone/local_change')
...
>>> print system(buildout)
Updating git-clone.
Warning: since you have local changes in this repository it is left untouched.
>>> print system('cat parts/git-clone/local_change')
kept
>>> print system('rm parts/git-clone/local_change')
Specific branch Specific branch
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~
......
...@@ -122,15 +122,6 @@ def download_network_cached(path, name, revision, networkcache_options): ...@@ -122,15 +122,6 @@ def download_network_cached(path, name, revision, networkcache_options):
networkcache_options.get('signature-certificate-list'), networkcache_options.get('signature-certificate-list'),
) )
def hasLocalChanges(location, git_command='git'):
"""Check if repository has local changes."""
p = subprocess.Popen([git_command, 'status', '--short'],
cwd=location,
stdout=subprocess.PIPE)
if p.communicate()[0].strip():
return True
return False
class Recipe(object): class Recipe(object):
"""Clone a git repository.""" """Clone a git repository."""
...@@ -251,9 +242,6 @@ class Recipe(object): ...@@ -251,9 +242,6 @@ class Recipe(object):
""" """
if self.develop: if self.develop:
return return
if hasLocalChanges(self.location, self.git_command):
print "Warning: since you have local changes in this repository it is left untouched."
return
# first cleanup pyc files # first cleanup pyc files
self.deletePycFiles(self.location) self.deletePycFiles(self.location)
...@@ -274,15 +262,17 @@ def uninstall(name, options): ...@@ -274,15 +262,17 @@ def uninstall(name, options):
if not os.path.exists(options['location']): if not os.path.exists(options['location']):
return return
force_keep = False force_keep = False
git_command = options.get('git-executable', 'git')
if options.get('develop', 'yes').lower() in TRUE_VALUES: if options.get('develop', 'yes').lower() in TRUE_VALUES:
if hasLocalChanges(options['location'], git_command): p = subprocess.Popen([options.get('git-executable', 'git'), 'status', '--short'],
cwd=options['location'],
stdout=subprocess.PIPE)
if p.communicate()[0].strip():
print "You have uncommited changes in %s. "\ print "You have uncommited changes in %s. "\
"This folder will be left as is." % options['location'] "This folder will be left as is." % options['location']
force_keep = True force_keep = True
p = subprocess.Popen([git_command, p = subprocess.Popen([options.get('git-executable', 'git'),
'log', '--branches', '--not', '--remotes'], 'log', '--branches', '--not', '--remotes'],
cwd=options['location'], cwd=options['location'],
stdout=subprocess.PIPE) stdout=subprocess.PIPE)
if p.communicate()[0].strip(): if p.communicate()[0].strip():
......
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