Merge with crew-stable
authorPatrick Mezard <pmezard@gmail.com>
Sun, 26 Oct 2008 14:02:32 +0100
changeset 7246 2fef3051ebb3
parent 7245 37657dc5c65e (current diff)
parent 7242 d1dff8c492dd (diff)
child 7247 c4461ea8b4c8
Merge with crew-stable
hgext/convert/git.py
--- a/hgext/convert/git.py	Sat Oct 25 15:34:58 2008 +0200
+++ b/hgext/convert/git.py	Sun Oct 26 14:02:32 2008 +0100
@@ -56,22 +56,26 @@
 
     def getchanges(self, version):
         self.modecache = {}
-        fh = self.gitcmd("git diff-tree --root -m -r %s" % version)
+        fh = self.gitcmd("git diff-tree -z --root -m -r %s" % version)
         changes = []
         seen = {}
-        for l in fh:
-            if "\t" not in l:
-                continue
-            m, f = l[:-1].split("\t")
-            if f in seen:
+        entry = None
+        for l in fh.read().split('\x00'):
+            if not entry:
+                if not l.startswith(':'):
+                    continue
+                entry = l
                 continue
-            seen[f] = 1
-            m = m.split()
-            h = m[3]
-            p = (m[1] == "100755")
-            s = (m[1] == "120000")
-            self.modecache[(f, h)] = (p and "x") or (s and "l") or ""
-            changes.append((f, h))
+            f = l
+            if f not in seen:
+                seen[f] = 1
+                entry = entry.split()
+                h = entry[3]
+                p = (entry[1] == "100755")
+                s = (entry[1] == "120000")
+                self.modecache[(f, h)] = (p and "x") or (s and "l") or ""
+                changes.append((f, h))
+            entry = None
         return (changes, {})
 
     def getcommit(self, version):