mercurial/commands.py
changeset 2718 a593813241e5
parent 2717 14ebe97542a7
child 2732 42a02b5773d4
child 2738 ad4155e757da
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -432,25 +432,16 @@ def dodiff(fp, ui, repo, node1, node2, f
                      diffopts['ignorewsamount']
     ignoreblanklines = opts.get('ignore_blank_lines') or \
                      diffopts['ignoreblanklines']
-    for f in modified:
+
+    all = modified + added + removed
+    all.sort()
+    for f in all:
         to = None
+        tn = None
         if f in mmap:
             to = repo.file(f).read(mmap[f])
-        tn = read(f)
-        fp.write(mdiff.unidiff(to, date1, tn, date2(f), f, r, text=text,
-                               showfunc=showfunc, ignorews=ignorews,
-                               ignorewsamount=ignorewsamount,
-                               ignoreblanklines=ignoreblanklines))
-    for f in added:
-        to = None
-        tn = read(f)
-        fp.write(mdiff.unidiff(to, date1, tn, date2(f), f, r, text=text,
-                               showfunc=showfunc, ignorews=ignorews,
-                               ignorewsamount=ignorewsamount,
-                               ignoreblanklines=ignoreblanklines))
-    for f in removed:
-        to = repo.file(f).read(mmap[f])
-        tn = None
+        if f not in removed:
+            tn = read(f)
         fp.write(mdiff.unidiff(to, date1, tn, date2(f), f, r, text=text,
                                showfunc=showfunc, ignorews=ignorews,
                                ignorewsamount=ignorewsamount,