Check need_commit on purge_deleted_files.
This commit is contained in:
parent
b35cc8196f
commit
f6cb496db4
1 changed files with 12 additions and 0 deletions
|
@ -303,9 +303,15 @@ def purge_deleted_files_argparse(args):
|
||||||
else:
|
else:
|
||||||
photos = search_in_cwd(yield_photos=True, yield_albums=False)
|
photos = search_in_cwd(yield_photos=True, yield_albums=False)
|
||||||
|
|
||||||
|
need_commit = False
|
||||||
|
|
||||||
for deleted in photodb.purge_deleted_files(photos):
|
for deleted in photodb.purge_deleted_files(photos):
|
||||||
|
need_commit = True
|
||||||
print(deleted)
|
print(deleted)
|
||||||
|
|
||||||
|
if not need_commit:
|
||||||
|
return
|
||||||
|
|
||||||
if args.autoyes or interactive.getpermission('Commit?'):
|
if args.autoyes or interactive.getpermission('Commit?'):
|
||||||
photodb.commit()
|
photodb.commit()
|
||||||
|
|
||||||
|
@ -320,9 +326,15 @@ def purge_empty_albums_argparse(args):
|
||||||
else:
|
else:
|
||||||
albums = photodb.get_albums_within_directory(pathclass.cwd())
|
albums = photodb.get_albums_within_directory(pathclass.cwd())
|
||||||
|
|
||||||
|
need_commit = False
|
||||||
|
|
||||||
for deleted in photodb.purge_empty_albums(albums):
|
for deleted in photodb.purge_empty_albums(albums):
|
||||||
|
need_commit = True
|
||||||
print(deleted)
|
print(deleted)
|
||||||
|
|
||||||
|
if not need_commit:
|
||||||
|
return
|
||||||
|
|
||||||
if args.autoyes or interactive.getpermission('Commit?'):
|
if args.autoyes or interactive.getpermission('Commit?'):
|
||||||
photodb.commit()
|
photodb.commit()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue