add option to disable .hist/up2k.snap

This commit is contained in:
ed 2022-11-15 22:16:53 +00:00
parent a234aa1f7e
commit 0aa7d12704
2 changed files with 5 additions and 3 deletions

View file

@ -637,6 +637,7 @@ def run_argparse(
ap2.add_argument("--hardlink", action="store_true", help="prefer hardlinks instead of symlinks when possible (within same filesystem)")
ap2.add_argument("--never-symlink", action="store_true", help="do not fallback to symlinks when a hardlink cannot be made")
ap2.add_argument("--no-dedup", action="store_true", help="disable symlink/hardlink creation; copy file contents instead")
ap2.add_argument("--no-snap", action="store_true", help="disable snapshots -- forget unfinished uploads on shutdown; don't create .hist/up2k.snap files -- abandoned/interrupted uploads must be cleaned up manually")
ap2.add_argument("--magic", action="store_true", help="enable filetype detection on nameless uploads")
ap2.add_argument("--df", metavar="GiB", type=float, default=0, help="ensure GiB free disk space by rejecting upload requests")
ap2.add_argument("--sparse", metavar="MiB", type=int, default=4, help="windows-only: minimum size of incoming uploads through up2k before they are made into sparse files")

View file

@ -3025,7 +3025,7 @@ class Up2k(object):
except:
pass
if self.args.nw:
if self.args.nw or self.args.no_snap:
return
path = os.path.join(histpath, "up2k.snap")
@ -3157,8 +3157,9 @@ class Up2k(object):
for x in list(self.spools):
self._unspool(x)
self.log("writing snapshot")
self.do_snapshot()
if not self.args.no_snap:
self.log("writing snapshot")
self.do_snapshot()
def up2k_chunksize(filesize: int) -> int: