diff mercurial/patch.py @ 3693:454b3a8cdf28

diff: improve detection of renames when diffing across many revisions
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Mon, 20 Nov 2006 19:32:35 -0200
parents eb0b4a2d70a9
children c0b1a0c72c7d
line wrap: on
line diff
--- a/mercurial/patch.py	Mon Nov 20 13:06:04 2006 -0800
+++ b/mercurial/patch.py	Mon Nov 20 19:32:35 2006 -0200
@@ -471,14 +471,15 @@
         r1, r2 = map(repo.changelog.rev, (n1, n2))
         src = None
         while r2 > r1:
-            cl = getchangelog(n2)[0]
-            m = getmanifest(cl)
-            try:
-                src = getfile(f).renamed(m[f])
-            except KeyError:
-                return None
-            if src:
-                f = src[0]
+            cl = getchangelog(n2)
+            if f in cl[3]:
+                m = getmanifest(cl[0])
+                try:
+                    src = getfile(f).renamed(m[f])
+                except KeyError:
+                    return None
+                if src:
+                    f = src[0]
             n2 = repo.changelog.parents(n2)[0]
             r2 = repo.changelog.rev(n2)
         return src