changeset 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 2af98c4b2587 6cb548cffdf5
files mercurial/commands.py
diffstat 1 files changed, 7 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Sun Feb 26 02:26:17 2006 +0100
+++ b/mercurial/commands.py	Sun Feb 26 16:23:14 2006 +0100
@@ -276,12 +276,13 @@
 
 def dodiff(fp, ui, repo, node1, node2, files=None, match=util.always,
            changes=None, text=False, opts={}):
-    if node1:
-        # reading the data for node1 early allows it to play nicely
-        # with repo.changes and the revlog cache.
-        change = repo.changelog.read(node1)
-        mmap = repo.manifest.read(change[0])
-        date1 = util.datestr(change[2])
+    if not node1:
+        node1 = repo.dirstate.parents()[0]
+    # reading the data for node1 early allows it to play nicely
+    # with repo.changes and the revlog cache.
+    change = repo.changelog.read(node1)
+    mmap = repo.manifest.read(change[0])
+    date1 = util.datestr(change[2])
 
     if not changes:
         changes = repo.changes(node1, node2, files, match=match)
@@ -301,11 +302,6 @@
             return repo.file(f).read(mmap2[f])
     else:
         date2 = util.datestr()
-        if not node1:
-            node1 = repo.dirstate.parents()[0]
-            change = repo.changelog.read(node1)
-            mmap = repo.manifest.read(change[0])
-            date1 = util.datestr(change[2])
         def read(f):
             return repo.wread(f)