Weird diffing
canpolat opened this issue · 0 comments
canpolat commented
When I test DirState on a directory of 2000+ files, I get a weird diff behavior. Here is my code (it's just a copy of your code in README):
PATH = "/my/path/here"
def main():
d1 = Dir(PATH)
state = DirState(d1)
print("State 0: {}".format(len(state.state['files'])))
json = state.to_json()
d2 = Dir(PATH)
state2 = DirState(d2)
print("State 2: {}".format(len(state2.state['files'])))
state1 = DirState.from_json(json)
print("State 1: {}".format(len(state1.state['files'])))
changes = state2 - state1
print("Diff: {}".format(len(changes['created'])))
if __name__=='__main__':
main()
And here is the output I get:
State 0: 2333
State 2: 2333
State 1: 2333
Diff: 1924
Can you spot a problem in my code? Or is it a subtle bug in DirState implementation? (I'm using dirtools 0.2.0 from PyPi).