1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-27 02:16:12 +01:00

Remove all untracked files during "osc clean"

Now we also take files into account that match the "exclude_glob"
config option. The new behavior is consistent with the command's
description.
This commit is contained in:
Marcus Huewe 2017-08-03 17:21:20 +02:00
parent 2c353a5696
commit 8ce386c76a

View File

@ -8813,7 +8813,13 @@ Please submit there instead, or use --nodevelproject to force direct submission.
for pdir in pacs:
p = Package(pdir)
pdir = getTransActPath(pdir)
for filename in (fname for st, fname in p.get_status() if st == '?'):
todo = [fname for st, fname in p.get_status() if st == '?']
for fname in p.excluded:
# there might be some rare cases, where an excluded file has
# not state '?'
if os.path.isfile(fname) and p.status(fname) == '?':
todo.append(fname)
for filename in todo:
print('Removing: %s' % os.path.join(pdir, filename))
if not opts.dry_run:
os.unlink(os.path.join(p.absdir, filename))