diff mercurial/commands.py @ 1285:1546c2aa6b30

Make 'hg import' platform independent. - moved popen("patch ...") from commands.py to util.py - files may not be single quoted in popen under windows: fixed - patch returns the files quoted under windows. quotes need to be stripped off: fixed
author Volker Kleinfeld <Volker.Kleinfeld@gmx.de>
date Tue, 20 Sep 2005 21:35:51 -0700
parents 84df9951532a
children 4f08da74cae8 abcdf14449ea 332f225b835c
line wrap: on
line diff
--- a/mercurial/commands.py	Tue Sep 20 21:29:07 2005 -0700
+++ b/mercurial/commands.py	Tue Sep 20 21:35:51 2005 -0700
@@ -1173,18 +1173,7 @@
             message = "%s\n" % '\n'.join(message)
         ui.debug('message:\n%s\n' % message)
 
-        f = os.popen("patch -p%d < '%s'" % (strip, pf))
-        files = []
-        for l in f.read().splitlines():
-            l.rstrip('\r\n');
-            ui.status("%s\n" % l)
-            if l.startswith('patching file '):
-                pf = l[14:]
-                if pf not in files:
-                    files.append(pf)
-        patcherr = f.close()
-        if patcherr:
-            raise util.Abort("patch failed")
+        files = util.patch(strip, pf, ui)
 
         if len(files) > 0:
             addremove(ui, repo, *files)