From 87200d9f10b3228c30cd81807984f4f43235d28a Mon Sep 17 00:00:00 2001 From: ed Date: Wed, 30 Jun 2021 19:23:45 +0200 Subject: [PATCH] make -nw apply to more stuff --- copyparty/up2k.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/copyparty/up2k.py b/copyparty/up2k.py index 330c5f08..c0c9bd45 100644 --- a/copyparty/up2k.py +++ b/copyparty/up2k.py @@ -1019,7 +1019,8 @@ class Up2k(object): break except: # missing; restart - job = None + if not self.args.nw: + job = None break else: # file contents match, but not the path @@ -1089,6 +1090,9 @@ class Up2k(object): } def _untaken(self, fdir, fname, ts, ip): + if self.args.nw: + return fname + # TODO broker which avoid this race and # provides a new filename if taken (same as bup) suffix = ".{:.6f}-{}".format(ts, ip) @@ -1098,6 +1102,9 @@ class Up2k(object): def _symlink(self, src, dst): # TODO store this in linktab so we never delete src if there are links to it self.log("linking dupe:\n {0}\n {1}".format(src, dst)) + if self.args.nw: + return + try: lsrc = src ldst = dst @@ -1175,6 +1182,10 @@ class Up2k(object): if ret > 0: return ret, src + if self.args.nw: + # del self.registry[ptop][wark] + return ret, dst + atomic_move(src, dst) if ANYWIN: @@ -1284,6 +1295,10 @@ class Up2k(object): if self.args.dotpart: tnam = "." + tnam + if self.args.nw: + job["tnam"] = tnam + return + suffix = ".{:.6f}-{}".format(job["t0"], job["addr"]) with ren_open(tnam, "wb", fdir=pdir, suffix=suffix) as f: f, job["tnam"] = f["orz"]