70 #endif |
70 #endif |
71 |
71 |
72 These files are different and should return True (different): |
72 These files are different and should return True (different): |
73 (Note that filecmp.cmp's return semantics are inverted from ours, so we invert |
73 (Note that filecmp.cmp's return semantics are inverted from ours, so we invert |
74 for simplicity): |
74 for simplicity): |
75 $ hg eval "context.arbitraryfilectx('A', repo).cmp(repo[None]['real_A'])" |
75 $ hg eval "context.arbitraryfilectx(b'A', repo).cmp(repo[None][b'real_A'])" |
76 True (no-eol) |
76 True (no-eol) |
77 $ hg eval "not filecmp.cmp('A', 'real_A')" |
77 $ hg eval "not filecmp.cmp(b'A', b'real_A')" |
78 True (no-eol) |
78 True (no-eol) |
79 |
79 |
80 These files are identical and should return False (same): |
80 These files are identical and should return False (same): |
81 $ hg eval "context.arbitraryfilectx('A', repo).cmp(repo[None]['A'])" |
81 $ hg eval "context.arbitraryfilectx(b'A', repo).cmp(repo[None][b'A'])" |
82 False (no-eol) |
82 False (no-eol) |
83 $ hg eval "context.arbitraryfilectx('A', repo).cmp(repo[None]['B'])" |
83 $ hg eval "context.arbitraryfilectx(b'A', repo).cmp(repo[None][b'B'])" |
84 False (no-eol) |
84 False (no-eol) |
85 $ hg eval "not filecmp.cmp('A', 'B')" |
85 $ hg eval "not filecmp.cmp(b'A', b'B')" |
86 False (no-eol) |
86 False (no-eol) |
87 |
87 |
88 This comparison should also return False, since A and sym_A are substantially |
88 This comparison should also return False, since A and sym_A are substantially |
89 the same in the eyes of ``filectx.cmp``, which looks at data only. |
89 the same in the eyes of ``filectx.cmp``, which looks at data only. |
90 $ hg eval "context.arbitraryfilectx('real_A', repo).cmp(repo[None]['sym_A'])" |
90 $ hg eval "context.arbitraryfilectx(b'real_A', repo).cmp(repo[None][b'sym_A'])" |
91 False (no-eol) |
91 False (no-eol) |
92 |
92 |
93 A naive use of filecmp on those two would wrongly return True, since it follows |
93 A naive use of filecmp on those two would wrongly return True, since it follows |
94 the symlink to "A", which has different contents. |
94 the symlink to "A", which has different contents. |
95 #if symlink |
95 #if symlink |
96 $ hg eval "not filecmp.cmp('real_A', 'sym_A')" |
96 $ hg eval "not filecmp.cmp(b'real_A', b'sym_A')" |
97 True (no-eol) |
97 True (no-eol) |
98 #else |
98 #else |
99 $ hg eval "not filecmp.cmp('real_A', 'sym_A')" |
99 $ hg eval "not filecmp.cmp(b'real_A', b'sym_A')" |
100 False (no-eol) |
100 False (no-eol) |
101 #endif |
101 #endif |