Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/commands.py @ 1804:c3f959c1c3ff
refactor the dodiff optimization
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Sun, 26 Feb 2006 16:23:14 +0100 |
parents | 06e7447c7302 |
children | 6cb548cffdf5 |
comparison
equal
deleted
inserted
replaced
1803:06e7447c7302 | 1804:c3f959c1c3ff |
---|---|
274 pathname), | 274 pathname), |
275 mode) | 275 mode) |
276 | 276 |
277 def dodiff(fp, ui, repo, node1, node2, files=None, match=util.always, | 277 def dodiff(fp, ui, repo, node1, node2, files=None, match=util.always, |
278 changes=None, text=False, opts={}): | 278 changes=None, text=False, opts={}): |
279 if node1: | 279 if not node1: |
280 # reading the data for node1 early allows it to play nicely | 280 node1 = repo.dirstate.parents()[0] |
281 # with repo.changes and the revlog cache. | 281 # reading the data for node1 early allows it to play nicely |
282 change = repo.changelog.read(node1) | 282 # with repo.changes and the revlog cache. |
283 mmap = repo.manifest.read(change[0]) | 283 change = repo.changelog.read(node1) |
284 date1 = util.datestr(change[2]) | 284 mmap = repo.manifest.read(change[0]) |
285 date1 = util.datestr(change[2]) | |
285 | 286 |
286 if not changes: | 287 if not changes: |
287 changes = repo.changes(node1, node2, files, match=match) | 288 changes = repo.changes(node1, node2, files, match=match) |
288 modified, added, removed, deleted, unknown = changes | 289 modified, added, removed, deleted, unknown = changes |
289 if files: | 290 if files: |
299 date2 = util.datestr(change[2]) | 300 date2 = util.datestr(change[2]) |
300 def read(f): | 301 def read(f): |
301 return repo.file(f).read(mmap2[f]) | 302 return repo.file(f).read(mmap2[f]) |
302 else: | 303 else: |
303 date2 = util.datestr() | 304 date2 = util.datestr() |
304 if not node1: | |
305 node1 = repo.dirstate.parents()[0] | |
306 change = repo.changelog.read(node1) | |
307 mmap = repo.manifest.read(change[0]) | |
308 date1 = util.datestr(change[2]) | |
309 def read(f): | 305 def read(f): |
310 return repo.wread(f) | 306 return repo.wread(f) |
311 | 307 |
312 if ui.quiet: | 308 if ui.quiet: |
313 r = None | 309 r = None |