Show More
@@ -135,7 +135,7 b' class filelog(object):' | |||
|
135 | 135 | |
|
136 | 136 | returns True if text is different than what is stored. |
|
137 | 137 | """ |
|
138 |
return storageutil.file |
|
|
138 | return not storageutil.filedataequivalent(self, node, text) | |
|
139 | 139 | |
|
140 | 140 | def verifyintegrity(self, state): |
|
141 | 141 | return self._revlog.verifyintegrity(state) |
@@ -108,8 +108,18 b' def filerevisioncopied(store, node):' | |||
|
108 | 108 | |
|
109 | 109 | return False |
|
110 | 110 | |
|
111 |
def file |
|
|
112 |
"""Determines whether file data is equivalent to a stored node. |
|
|
111 | def filedataequivalent(store, node, filedata): | |
|
112 | """Determines whether file data is equivalent to a stored node. | |
|
113 | ||
|
114 | Returns True if the passed file data would hash to the same value | |
|
115 | as a stored revision and False otherwise. | |
|
116 | ||
|
117 | When a stored revision is censored, filedata must be empty to have | |
|
118 | equivalence. | |
|
119 | ||
|
120 | When a stored revision has copy metadata, it is ignored as part | |
|
121 | of the compare. | |
|
122 | """ | |
|
113 | 123 | |
|
114 | 124 | if filedata.startswith(b'\x01\n'): |
|
115 | 125 | revisiontext = b'\x01\n\x01\n' + filedata |
@@ -121,18 +131,18 b' def filerevisiondifferent(store, node, f' | |||
|
121 | 131 | computednode = hashrevisionsha1(revisiontext, p1, p2) |
|
122 | 132 | |
|
123 | 133 | if computednode == node: |
|
124 |
return |
|
|
134 | return True | |
|
125 | 135 | |
|
126 | 136 | # Censored files compare against the empty file. |
|
127 | 137 | if store.iscensored(store.rev(node)): |
|
128 |
return filedata |
|
|
138 | return filedata == b'' | |
|
129 | 139 | |
|
130 | 140 | # Renaming a file produces a different hash, even if the data |
|
131 | 141 | # remains unchanged. Check if that's the case. |
|
132 | 142 | if store.renamed(node): |
|
133 |
return store.read(node) |
|
|
143 | return store.read(node) == filedata | |
|
134 | 144 | |
|
135 |
return |
|
|
145 | return False | |
|
136 | 146 | |
|
137 | 147 | def iterrevs(storelen, start=0, stop=None): |
|
138 | 148 | """Iterate over revision numbers in a store.""" |
General Comments 0
You need to be logged in to leave comments.
Login now