make new files go brrrr!
This commit is contained in:
parent
9229d463cb
commit
6654527ffc
@ -41,7 +41,7 @@ class Index:
|
|||||||
self.context.log(stat, os.path.join(self.path, name))
|
self.context.log(stat, os.path.join(self.path, name))
|
||||||
|
|
||||||
# calc new hashes for this index
|
# calc new hashes for this index
|
||||||
def update(self):
|
def update(self, update):
|
||||||
for name in self.files:
|
for name in self.files:
|
||||||
if self.should_ignore(name):
|
if self.should_ignore(name):
|
||||||
self._log(Status.SKIP, name)
|
self._log(Status.SKIP, name)
|
||||||
@ -57,7 +57,12 @@ class Index:
|
|||||||
self.old[name] = {"mod": old["mod"], "a": a, "h": old["md5"]}
|
self.old[name] = {"mod": old["mod"], "a": a, "h": old["md5"]}
|
||||||
elif "a" in old:
|
elif "a" in old:
|
||||||
a = old["a"]
|
a = old["a"]
|
||||||
self.new[name] = self._calc_file(name, a)
|
self.new[name] = self._calc_file(name, a)
|
||||||
|
else:
|
||||||
|
if update:
|
||||||
|
self.new[name] = self._calc_file(name, a)
|
||||||
|
else:
|
||||||
|
self.new[name] = self._list_file(name, a)
|
||||||
|
|
||||||
# check/update the index (old vs new)
|
# check/update the index (old vs new)
|
||||||
def check_fix(self, force):
|
def check_fix(self, force):
|
||||||
@ -95,6 +100,15 @@ class Index:
|
|||||||
self._log(Status.WARN_OLD, name)
|
self._log(Status.WARN_OLD, name)
|
||||||
self._setmod()
|
self._setmod()
|
||||||
|
|
||||||
|
def _list_file(self, name, a):
|
||||||
|
path = os.path.join(self.path, name)
|
||||||
|
self.context.hit(cfiles=1)
|
||||||
|
return {
|
||||||
|
"mod": None,
|
||||||
|
"a": a,
|
||||||
|
"h": None,
|
||||||
|
}
|
||||||
|
|
||||||
def _calc_file(self, name, a):
|
def _calc_file(self, name, a):
|
||||||
path = os.path.join(self.path, name)
|
path = os.path.join(self.path, name)
|
||||||
info = os.stat(path)
|
info = os.stat(path)
|
||||||
|
@ -37,7 +37,7 @@ class IndexThread:
|
|||||||
index.load()
|
index.load()
|
||||||
|
|
||||||
# calc the new hashes
|
# calc the new hashes
|
||||||
index.update()
|
index.update(self.update)
|
||||||
|
|
||||||
# compare
|
# compare
|
||||||
index.check_fix(self.context.force)
|
index.check_fix(self.context.force)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user