Show More
@@ -135,26 +135,7 b' class filelog(object):' | |||
|
135 | 135 | |
|
136 | 136 | returns True if text is different than what is stored. |
|
137 | 137 | """ |
|
138 | ||
|
139 | t = text | |
|
140 | if text.startswith('\1\n'): | |
|
141 | t = '\1\n\1\n' + text | |
|
142 | ||
|
143 | samehashes = not self._revlog.cmp(node, t) | |
|
144 | if samehashes: | |
|
145 | return False | |
|
146 | ||
|
147 | # censored files compare against the empty file | |
|
148 | if self.iscensored(self.rev(node)): | |
|
149 | return text != '' | |
|
150 | ||
|
151 | # renaming a file produces a different hash, even if the data | |
|
152 | # remains unchanged. Check if it's the case (slow): | |
|
153 | if self.renamed(node): | |
|
154 | t2 = self.read(node) | |
|
155 | return t2 != text | |
|
156 | ||
|
157 | return True | |
|
138 | return storageutil.filerevisiondifferent(self, node, text) | |
|
158 | 139 | |
|
159 | 140 | def verifyintegrity(self, state): |
|
160 | 141 | return self._revlog.verifyintegrity(state) |
@@ -108,6 +108,32 b' def filerevisioncopied(store, node):' | |||
|
108 | 108 | |
|
109 | 109 | return False |
|
110 | 110 | |
|
111 | def filerevisiondifferent(store, node, filedata): | |
|
112 | """Determines whether file data is equivalent to a stored node.""" | |
|
113 | ||
|
114 | if filedata.startswith(b'\x01\n'): | |
|
115 | revisiontext = b'\x01\n\x01\n' + filedata | |
|
116 | else: | |
|
117 | revisiontext = filedata | |
|
118 | ||
|
119 | p1, p2 = store.parents(node) | |
|
120 | ||
|
121 | computednode = hashrevisionsha1(revisiontext, p1, p2) | |
|
122 | ||
|
123 | if computednode == node: | |
|
124 | return False | |
|
125 | ||
|
126 | # Censored files compare against the empty file. | |
|
127 | if store.iscensored(store.rev(node)): | |
|
128 | return filedata != b'' | |
|
129 | ||
|
130 | # Renaming a file produces a different hash, even if the data | |
|
131 | # remains unchanged. Check if that's the case. | |
|
132 | if store.renamed(node): | |
|
133 | return store.read(node) != filedata | |
|
134 | ||
|
135 | return True | |
|
136 | ||
|
111 | 137 | def iterrevs(storelen, start=0, stop=None): |
|
112 | 138 | """Iterate over revision numbers in a store.""" |
|
113 | 139 | step = 1 |
General Comments 0
You need to be logged in to leave comments.
Login now