changeset 7248:723d7a2e6ec0

merge with crew
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Mon, 27 Oct 2008 13:17:26 +0100
parents c4461ea8b4c8 (diff) 421f4cbddd68 (current diff)
children 671b3e1eac2e
files
diffstat 4 files changed, 43 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/git.py	Wed Oct 22 11:57:20 2008 +0200
+++ b/hgext/convert/git.py	Mon Oct 27 13:17:26 2008 +0100
@@ -38,7 +38,7 @@
 
     def getheads(self):
         if not self.rev:
-            return self.gitcmd('git rev-parse --branches').read().splitlines()
+            return self.gitcmd('git rev-parse --branches --remotes').read().splitlines()
         else:
             fh = self.gitcmd("git rev-parse --verify %s" % self.rev)
             return [fh.read()[:-1]]
@@ -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):
--- a/mercurial/patch.py	Wed Oct 22 11:57:20 2008 +0200
+++ b/mercurial/patch.py	Mon Oct 27 13:17:26 2008 +0100
@@ -31,9 +31,8 @@
         raise util.Abort(_("cannot create %s: destination already exists") %
                          dst)
 
-    targetdir = os.path.dirname(absdst)
-    if not os.path.isdir(targetdir):
-        os.makedirs(targetdir)
+    if not os.path.isdir(basedir):
+        os.makedirs(basedir)
 
     util.copyfile(abssrc, absdst)
 
@@ -1061,7 +1060,7 @@
         if line.startswith('patching file '):
             pf = util.parse_patch_output(line)
             printed_file = False
-            files.setdefault(pf, (None, None))
+            files.setdefault(pf, None)
         elif line.find('with fuzz') >= 0:
             fuzz = True
             if not printed_file:
--- a/tests/test-import	Wed Oct 22 11:57:20 2008 +0200
+++ b/tests/test-import	Mon Oct 27 13:17:26 2008 +0100
@@ -20,6 +20,18 @@
 hg --cwd b tip | grep someone
 rm -r b
 
+echo % import exported patch with external patcher
+cat > dummypatch.py <<EOF
+print 'patching file a'
+file('a', 'wb').write('line2\n')
+EOF
+chmod +x dummypatch.py
+hg clone -r0 a b
+hg --cwd a export tip > tip.patch
+hg --config ui.patch='python ../dummypatch.py' --cwd b import ../tip.patch
+cat b/a
+rm -r b
+
 echo % import of plain diff should fail without message
 hg clone -r0 a b
 hg --cwd a diff -r0:1 > tip.patch
--- a/tests/test-import.out	Wed Oct 22 11:57:20 2008 +0200
+++ b/tests/test-import.out	Mon Oct 27 13:17:26 2008 +0100
@@ -13,6 +13,16 @@
 summary:     second change
 % committer should be same
 user:        someone
+% import exported patch with external patcher
+requesting all changes
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 2 changes to 2 files
+updating working directory
+2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+applying ../tip.patch
+line2
 % import of plain diff should fail without message
 requesting all changes
 adding changesets