changeset 7263:7e2e3aacc5dc

merge with dsop
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Mon, 27 Oct 2008 13:52:55 +0100
parents 671b3e1eac2e (diff) 3cbadcf28a4c (current diff)
children 7e963c80bbe6
files
diffstat 6 files changed, 54 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/git.py	Sun Oct 26 17:08:48 2008 +0800
+++ b/hgext/convert/git.py	Mon Oct 27 13:52:55 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	Sun Oct 26 17:08:48 2008 +0800
+++ b/mercurial/patch.py	Mon Oct 27 13:52:55 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	Sun Oct 26 17:08:48 2008 +0800
+++ b/tests/test-import	Mon Oct 27 13:52:55 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	Sun Oct 26 17:08:48 2008 +0800
+++ b/tests/test-import.out	Mon Oct 27 13:52:55 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
--- a/tests/test-init	Sun Oct 26 17:08:48 2008 +0800
+++ b/tests/test-init	Mon Oct 27 13:52:55 2008 +0100
@@ -44,10 +44,14 @@
 echo this > local/foo
 hg ci --cwd local -A -m "init" -d "1000000 0"
 
-echo "# creating repo with old format"
+echo "# creating repo with format.usestore=false"
 hg --config format.usestore=false init old
 checknewrepo old
 
+echo "# creating repo with format.usefncache=false"
+hg --config format.usefncache=false init old2
+checknewrepo old2
+
 echo "#test failure"
 hg init local
 
--- a/tests/test-init.out	Sun Oct 26 17:08:48 2008 +0800
+++ b/tests/test-init.out	Mon Oct 27 13:52:55 2008 +0100
@@ -5,8 +5,13 @@
 store
 fncache
 adding foo
-# creating repo with old format
+# creating repo with format.usestore=false
 revlogv1
+# creating repo with format.usefncache=false
+store created
+00changelog.i created
+revlogv1
+store
 #test failure
 abort: repository local already exists!
 # init+push to remote2