|
@@ -1384,25 +1384,26 @@ class Archiver:
|
|
dry_run = args.dry_run
|
|
dry_run = args.dry_run
|
|
|
|
|
|
if not args.cache_only:
|
|
if not args.cache_only:
|
|
- msg = []
|
|
|
|
- try:
|
|
|
|
- manifest, key = Manifest.load(repository, Manifest.NO_OPERATION_CHECK)
|
|
|
|
- except NoManifestError:
|
|
|
|
- msg.append("You requested to completely DELETE the repository *including* all archives it may "
|
|
|
|
- "contain.")
|
|
|
|
- msg.append("This repository seems to have no manifest, so we can't tell anything about its "
|
|
|
|
- "contents.")
|
|
|
|
- else:
|
|
|
|
- msg.append("You requested to completely DELETE the repository *including* all archives it "
|
|
|
|
- "contains:")
|
|
|
|
- for archive_info in manifest.archives.list(sort_by=['ts']):
|
|
|
|
- msg.append(format_archive(archive_info))
|
|
|
|
- msg.append("Type 'YES' if you understand this and want to continue: ")
|
|
|
|
- msg = '\n'.join(msg)
|
|
|
|
- if not yes(msg, false_msg="Aborting.", invalid_msg='Invalid answer, aborting.', truish=('YES',),
|
|
|
|
- retry=False, env_var_override='BORG_DELETE_I_KNOW_WHAT_I_AM_DOING'):
|
|
|
|
- self.exit_code = EXIT_ERROR
|
|
|
|
- return self.exit_code
|
|
|
|
|
|
+ if args.forced == 0: # without --force, we let the user see the archives list and confirm.
|
|
|
|
+ msg = []
|
|
|
|
+ try:
|
|
|
|
+ manifest, key = Manifest.load(repository, Manifest.NO_OPERATION_CHECK)
|
|
|
|
+ except NoManifestError:
|
|
|
|
+ msg.append("You requested to completely DELETE the repository *including* all archives it may "
|
|
|
|
+ "contain.")
|
|
|
|
+ msg.append("This repository seems to have no manifest, so we can't tell anything about its "
|
|
|
|
+ "contents.")
|
|
|
|
+ else:
|
|
|
|
+ msg.append("You requested to completely DELETE the repository *including* all archives it "
|
|
|
|
+ "contains:")
|
|
|
|
+ for archive_info in manifest.archives.list(sort_by=['ts']):
|
|
|
|
+ msg.append(format_archive(archive_info))
|
|
|
|
+ msg.append("Type 'YES' if you understand this and want to continue: ")
|
|
|
|
+ msg = '\n'.join(msg)
|
|
|
|
+ if not yes(msg, false_msg="Aborting.", invalid_msg='Invalid answer, aborting.', truish=('YES',),
|
|
|
|
+ retry=False, env_var_override='BORG_DELETE_I_KNOW_WHAT_I_AM_DOING'):
|
|
|
|
+ self.exit_code = EXIT_ERROR
|
|
|
|
+ return self.exit_code
|
|
if not dry_run:
|
|
if not dry_run:
|
|
repository.destroy()
|
|
repository.destroy()
|
|
logger.info("Repository deleted.")
|
|
logger.info("Repository deleted.")
|