Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird diffing #2

Open
canpolat opened this issue Nov 6, 2014 · 0 comments
Open

Weird diffing #2

canpolat opened this issue Nov 6, 2014 · 0 comments

Comments

@canpolat
Copy link

canpolat commented Nov 6, 2014

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant