1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-26 01:46:13 +01:00

- delete_file: added special handling for skipped files

if a local file exists and is marked as skipped, simply delete this file
otherwise do nothing
This commit is contained in:
Marcus Huewe 2011-01-17 15:00:21 +01:00
parent 6132f89268
commit 83d1883c35

View File

@ -1008,6 +1008,12 @@ class Package:
raise ioe
if state in ['?', 'A', 'M', 'R', 'C'] and not force:
return (False, state)
# special handling for skipped files: if file exists, simply delete it
if state == 'S':
exists = os.path.exists(os.path.join(self.dir, n))
self.delete_localfile(n)
return (exists, 'S')
self.delete_localfile(n)
was_added = n in self.to_be_added
if state in ('A', 'R') or state == '!' and was_added:
@ -2112,7 +2118,7 @@ rev: %s
if not filename in self.filenamelist and not filename in self.to_be_added:
raise oscerr.OscIOError(None, 'file \'%s\' is not under version control' % filename)
elif filename in self.skipped:
raise oscerr.OscIOError(None, 'file \'%s\' is marked as skipped and cannot be reverted')
raise oscerr.OscIOError(None, 'file \'%s\' is marked as skipped and cannot be reverted' % filename)
if filename in self.filenamelist and not os.path.exists(os.path.join(self.storedir, filename)):
raise oscerr.PackageInternalError('file \'%s\' is listed in filenamelist but no storefile exists' % filename)
state = self.status(filename)