Show More
@@ -70,7 +70,7 b' class unionrevlog(revlog.revlog):' | |||||
70 | self.revlog2.rev(self.node(rev1)), |
|
70 | self.revlog2.rev(self.node(rev1)), | |
71 | self.revlog2.rev(self.node(rev2))) |
|
71 | self.revlog2.rev(self.node(rev2))) | |
72 | elif rev1 <= self.repotiprev and rev2 <= self.repotiprev: |
|
72 | elif rev1 <= self.repotiprev and rev2 <= self.repotiprev: | |
73 |
return |
|
73 | return self.baserevdiff(rev1, rev2) | |
74 |
|
74 | |||
75 | return mdiff.textdiff(self.revision(self.node(rev1)), |
|
75 | return mdiff.textdiff(self.revision(self.node(rev1)), | |
76 | self.revision(self.node(rev2))) |
|
76 | self.revision(self.node(rev2))) | |
@@ -93,10 +93,20 b' class unionrevlog(revlog.revlog):' | |||||
93 | text = self.revlog2.revision(node) |
|
93 | text = self.revlog2.revision(node) | |
94 | self._cache = (node, rev, text) |
|
94 | self._cache = (node, rev, text) | |
95 | else: |
|
95 | else: | |
96 |
text = |
|
96 | text = self.baserevision(rev) | |
97 | # already cached |
|
97 | # already cached | |
98 | return text |
|
98 | return text | |
99 |
|
99 | |||
|
100 | def baserevision(self, nodeorrev): | |||
|
101 | # Revlog subclasses may override 'revision' method to modify format of | |||
|
102 | # content retrieved from revlog. To use unionrevlog with such class one | |||
|
103 | # needs to override 'baserevision' and make more specific call here. | |||
|
104 | return revlog.revlog.revision(self, nodeorrev) | |||
|
105 | ||||
|
106 | def baserevdiff(self, rev1, rev2): | |||
|
107 | # Exists for the same purpose as baserevision. | |||
|
108 | return revlog.revlog.revdiff(self, rev1, rev2) | |||
|
109 | ||||
100 | def addrevision(self, text, transaction, link, p1=None, p2=None, d=None): |
|
110 | def addrevision(self, text, transaction, link, p1=None, p2=None, d=None): | |
101 | raise NotImplementedError |
|
111 | raise NotImplementedError | |
102 | def addgroup(self, revs, linkmapper, transaction): |
|
112 | def addgroup(self, revs, linkmapper, transaction): | |
@@ -114,6 +124,15 b' class unionchangelog(unionrevlog, change' | |||||
114 | unionrevlog.__init__(self, opener, self.indexfile, changelog2, |
|
124 | unionrevlog.__init__(self, opener, self.indexfile, changelog2, | |
115 | linkmapper) |
|
125 | linkmapper) | |
116 |
|
126 | |||
|
127 | def baserevision(self, nodeorrev): | |||
|
128 | # Although changelog doesn't override 'revision' method, some extensions | |||
|
129 | # may replace this class with another that does. Same story with | |||
|
130 | # manifest and filelog classes. | |||
|
131 | return changelog.changelog.revision(self, nodeorrev) | |||
|
132 | ||||
|
133 | def baserevdiff(self, rev1, rev2): | |||
|
134 | return changelog.changelog.revdiff(self, rev1, rev2) | |||
|
135 | ||||
117 | class unionmanifest(unionrevlog, manifest.manifest): |
|
136 | class unionmanifest(unionrevlog, manifest.manifest): | |
118 | def __init__(self, opener, opener2, linkmapper): |
|
137 | def __init__(self, opener, opener2, linkmapper): | |
119 | manifest.manifest.__init__(self, opener) |
|
138 | manifest.manifest.__init__(self, opener) | |
@@ -121,6 +140,12 b' class unionmanifest(unionrevlog, manifes' | |||||
121 | unionrevlog.__init__(self, opener, self.indexfile, manifest2, |
|
140 | unionrevlog.__init__(self, opener, self.indexfile, manifest2, | |
122 | linkmapper) |
|
141 | linkmapper) | |
123 |
|
142 | |||
|
143 | def baserevision(self, nodeorrev): | |||
|
144 | return manifest.manifest.revision(self, nodeorrev) | |||
|
145 | ||||
|
146 | def baserevdiff(self, rev1, rev2): | |||
|
147 | return manifest.manifest.revdiff(self, rev1, rev2) | |||
|
148 | ||||
124 | class unionfilelog(unionrevlog, filelog.filelog): |
|
149 | class unionfilelog(unionrevlog, filelog.filelog): | |
125 | def __init__(self, opener, path, opener2, linkmapper, repo): |
|
150 | def __init__(self, opener, path, opener2, linkmapper, repo): | |
126 | filelog.filelog.__init__(self, opener, path) |
|
151 | filelog.filelog.__init__(self, opener, path) | |
@@ -129,6 +154,12 b' class unionfilelog(unionrevlog, filelog.' | |||||
129 | linkmapper) |
|
154 | linkmapper) | |
130 | self._repo = repo |
|
155 | self._repo = repo | |
131 |
|
156 | |||
|
157 | def baserevision(self, nodeorrev): | |||
|
158 | return filelog.filelog.revision(self, nodeorrev) | |||
|
159 | ||||
|
160 | def baserevdiff(self, rev1, rev2): | |||
|
161 | return filelog.filelog.revdiff(self, rev1, rev2) | |||
|
162 | ||||
132 | def _file(self, f): |
|
163 | def _file(self, f): | |
133 | self._repo.file(f) |
|
164 | self._repo.file(f) | |
134 |
|
165 |
General Comments 0
You need to be logged in to leave comments.
Login now