[BUG] hg import not working on windows

Volker.Kleinfeld at gmx.de Volker.Kleinfeld at gmx.de
Fri Sep 2 01:41:36 CDT 2005

> > I haven't mentioned that I use patch.exe from the unxutils tools
> > perhaps there are better choices ?????.
> Please try the version from mingw32 instead.  If you continue to have
> problems, let us know.

The mingw/msys version of patch helps the matter a bit, since it correctly
handles unix EOL. Nevertheless I still see the same problems:

1. popen("patch ...") in commands.py fails due to the single quotes around
   patch file name. Windows cmd.exe does not like this. The following code
   in the same way:
   # name me tmp.py
   import os
   name = 'tmp.py'
   cmd = "sort < \"%s\"" % (name,) # Case 1: This works
   cmd = "sort < '%s'" % (name,) # Case 2: This fails

   print "Command\t>>",cmd
   f = os.popen(cmd)
   print "f.read\t>>",f.read()
   print "f.close\t>>:",f.close()

2. The patch commands returns the files quoted - something like this:
   ---patching file `setup.py'---. Since the quotes are not removed, the
   later repo commit fails.

Still I found it strange that I am the only one having this trouble. Anyhow
I have prepared a patch that moves the popen to util.py and fixes the issues
above. I can sent it in case we conclude this is a bug.


More information about the Mercurial mailing list