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))
|
||||
|
||||
# calc new hashes for this index
|
||||
def update(self):
|
||||
def update(self, update):
|
||||
for name in self.files:
|
||||
if self.should_ignore(name):
|
||||
self._log(Status.SKIP, name)
|
||||
@ -58,6 +58,11 @@ class Index:
|
||||
elif "a" in old:
|
||||
a = old["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)
|
||||
def check_fix(self, force):
|
||||
@ -95,6 +100,15 @@ class Index:
|
||||
self._log(Status.WARN_OLD, name)
|
||||
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):
|
||||
path = os.path.join(self.path, name)
|
||||
info = os.stat(path)
|
||||
|
@ -37,7 +37,7 @@ class IndexThread:
|
||||
index.load()
|
||||
|
||||
# calc the new hashes
|
||||
index.update()
|
||||
index.update(self.update)
|
||||
|
||||
# compare
|
||||
index.check_fix(self.context.force)
|
||||
|
Loading…
x
Reference in New Issue
Block a user