D1056: context: add a fast-comparision path between arbitraryfilectx and workingfilectx
phillco (Phil Cohen)
phabricator at mercurial-scm.org
Mon Oct 16 13:34:14 EDT 2017
phillco added inline comments.
INLINE COMMENTS
> ryanmce wrote in context.py:2567
> Why is this sufficient? Can't the contents be the same even if the paths are different?
>
> I think you can only fastpath if the paths are the same, otherwise you have to fall back to data comparison.
>
> This is already queued, but I think we need to drop it if I'm right here.
Ryan and I talked offline -- but surprisingly, the default `filectx.cmp` function only compares contents:
1:~/1$ repo['.']['A'].cmp(repo['.']['B'])
Out[1]: False
2:~/1$ repo['.']['A'].cmp(repo['.']['A'])
Out[2]: False
3:~/1$ repo['.']['A'].cmp(repo['.']['C'])
Out[3]: True
(here, `A` and `B` have the same content).
And `filecmp` seems to behave the same way:
7:~/1$ filecmp.cmp('A', 'B')
Out[7]: True
8:~/1$ filecmp.cmp('A', 'A')
Out[8]: True
9:~/1$ filecmp.cmp('A', 'C')
Out[9]: False
That doesn't mean that it's wrong, but I think it's consistent.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D1056
To: phillco, #hg-reviewers, durin42
Cc: ryanmce, mercurial-devel
More information about the Mercurial-devel
mailing list