changeset 2718:a593813241e5

makes 'hg diff' diff the file in sorted order
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Fri, 28 Jul 2006 18:46:02 +0200
parents 14ebe97542a7
children d1fa79e7b07e
files mercurial/commands.py
diffstat 1 files changed, 7 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Fri Jul 28 09:01:13 2006 +0200
+++ b/mercurial/commands.py	Fri Jul 28 18:46:02 2006 +0200
@@ -432,25 +432,16 @@
                      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,