changeset 69:ab03c7a52cf2

Minor changes to import so that we can successfully import Ingo's kernel history patchset.
author mpm@selenic.com
date Fri, 13 May 2005 18:22:08 -0800
parents 6fa994fe90fc
children ce080e8eccd7
files hg
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hg	Fri May 13 13:26:00 2005 -0800
+++ b/hg	Fri May 13 18:22:08 2005 -0800
@@ -136,6 +136,12 @@
             repo.commit(repo.current)
 
 elif cmd == "import" or cmd == "patch":
+    try:
+        import psyco
+        psyco.full()
+    except:
+        pass
+    
     ioptions = {}
     opts = [('p', 'strip', 1, 'path strip'),
             ('b', 'base', "", 'base path'),
@@ -154,14 +160,16 @@
 
         text = ""
         for l in file(pf):
-            if l[:3] == "---": break
+            if l[:4] == "--- ": break
             text += l
 
-        if os.system("patch -p%d < %s %s" % (strip, pf, quiet)):
-            raise "patch failed!"
         f = os.popen("lsdiff --strip %d %s" % (strip, pf))
         files = filter(None, map(lambda x: x.rstrip(), f.read().splitlines()))
         f.close()
+
+        if files:
+            if os.system("patch -p%d < %s %s" % (strip, pf, quiet)):
+                raise "patch failed!"
         repo.commit(repo.current, files, text)
 
 elif cmd == "status":