Show More
@@ -115,15 +115,7 b' class filelog(object):' | |||||
115 | return self.addrevision(text, transaction, link, p1, p2) |
|
115 | return self.addrevision(text, transaction, link, p1, p2) | |
116 |
|
116 | |||
117 | def renamed(self, node): |
|
117 | def renamed(self, node): | |
118 | if self.parents(node)[0] != revlog.nullid: |
|
118 | return storageutil.filerevisioncopied(self, node) | |
119 | return False |
|
|||
120 | t = self.revision(node) |
|
|||
121 | m = storageutil.parsemeta(t)[0] |
|
|||
122 | # copy and copyrev occur in pairs. In rare cases due to bugs, |
|
|||
123 | # one can occur without the other. |
|
|||
124 | if m and "copy" in m and "copyrev" in m: |
|
|||
125 | return (m["copy"], revlog.bin(m["copyrev"])) |
|
|||
126 | return False |
|
|||
127 |
|
119 | |||
128 | def size(self, rev): |
|
120 | def size(self, rev): | |
129 | """return the size of a given revision""" |
|
121 | """return the size of a given revision""" |
@@ -89,6 +89,25 b' def filtermetadata(text):' | |||||
89 | offset = text.index(b'\x01\n', 2) |
|
89 | offset = text.index(b'\x01\n', 2) | |
90 | return text[offset + 2:] |
|
90 | return text[offset + 2:] | |
91 |
|
91 | |||
|
92 | def filerevisioncopied(store, node): | |||
|
93 | """Resolve file revision copy metadata. | |||
|
94 | ||||
|
95 | Returns ``False`` if the file has no copy metadata. Otherwise a | |||
|
96 | 2-tuple of the source filename and node. | |||
|
97 | """ | |||
|
98 | if store.parents(node)[0] != nullid: | |||
|
99 | return False | |||
|
100 | ||||
|
101 | meta = parsemeta(store.revision(node))[0] | |||
|
102 | ||||
|
103 | # copy and copyrev occur in pairs. In rare cases due to old bugs, | |||
|
104 | # one can occur without the other. So ensure both are present to flag | |||
|
105 | # as a copy. | |||
|
106 | if meta and b'copy' in meta and b'copyrev' in meta: | |||
|
107 | return meta[b'copy'], bin(meta[b'copyrev']) | |||
|
108 | ||||
|
109 | return False | |||
|
110 | ||||
92 | def iterrevs(storelen, start=0, stop=None): |
|
111 | def iterrevs(storelen, start=0, stop=None): | |
93 | """Iterate over revision numbers in a store.""" |
|
112 | """Iterate over revision numbers in a store.""" | |
94 | step = 1 |
|
113 | step = 1 |
General Comments 0
You need to be logged in to leave comments.
Login now