175 self.repo = hg.repository(self.ui, path) |
175 self.repo = hg.repository(self.ui, path) |
176 except: |
176 except: |
177 raise NoRepo("could not open hg repo %s as source" % path) |
177 raise NoRepo("could not open hg repo %s as source" % path) |
178 self.lastrev = None |
178 self.lastrev = None |
179 self.lastctx = None |
179 self.lastctx = None |
|
180 self._changescache = None |
180 |
181 |
181 def changectx(self, rev): |
182 def changectx(self, rev): |
182 if self.lastrev != rev: |
183 if self.lastrev != rev: |
183 self.lastctx = self.repo.changectx(rev) |
184 self.lastctx = self.repo.changectx(rev) |
184 self.lastrev = rev |
185 self.lastrev = rev |
200 m = self.changectx(rev).manifest() |
201 m = self.changectx(rev).manifest() |
201 return (m.execf(name) and 'x' or '') + (m.linkf(name) and 'l' or '') |
202 return (m.execf(name) and 'x' or '') + (m.linkf(name) and 'l' or '') |
202 |
203 |
203 def getchanges(self, rev): |
204 def getchanges(self, rev): |
204 ctx = self.changectx(rev) |
205 ctx = self.changectx(rev) |
205 m, a, r = self.repo.status(ctx.parents()[0].node(), ctx.node())[:3] |
206 if self._changescache and self._changescache[0] == rev: |
|
207 m, a, r = self._changescache[1] |
|
208 else: |
|
209 m, a, r = self.repo.status(ctx.parents()[0].node(), ctx.node())[:3] |
206 changes = [(name, rev) for name in m + a + r] |
210 changes = [(name, rev) for name in m + a + r] |
207 changes.sort() |
211 changes.sort() |
208 return (changes, self.getcopies(ctx, m + a)) |
212 return (changes, self.getcopies(ctx, m + a)) |
209 |
213 |
210 def getcopies(self, ctx, files): |
214 def getcopies(self, ctx, files): |
224 branch=ctx.branch()) |
228 branch=ctx.branch()) |
225 |
229 |
226 def gettags(self): |
230 def gettags(self): |
227 tags = [t for t in self.repo.tagslist() if t[0] != 'tip'] |
231 tags = [t for t in self.repo.tagslist() if t[0] != 'tip'] |
228 return dict([(name, hex(node)) for name, node in tags]) |
232 return dict([(name, hex(node)) for name, node in tags]) |
|
233 |
|
234 def getchangedfiles(self, rev, i): |
|
235 ctx = self.changectx(rev) |
|
236 i = i or 0 |
|
237 changes = self.repo.status(ctx.parents()[i].node(), ctx.node())[:3] |
|
238 |
|
239 if i == 0: |
|
240 self._changescache = (rev, changes) |
|
241 |
|
242 return changes[0] + changes[1] + changes[2] |
|
243 |