You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Russell Yanofsky <re...@columbia.edu> on 2003/07/26 23:48:53 UTC

Re: [PATCH] cvs2svn on windows (updated resend)

Russell Yanofsky wrote:
> cmpilato@collab.net wrote:
>> "Russell Yanofsky" <re...@columbia.edu> writes:
>>>   (pass3): Changed to sort the file listing in memory instead of
>>>   with the "sort" command on Windows. Original behavior is
>>>   preserved on other platforms.
>>
>> I'm confused.  Windows has a 'sort' program that supports path input
>> and redirected I/O.  Why not use it?  Does it behave differently than
>> it should?
>
> The windows sort program does seem to work some times, but it fails
> at other times.
> ...
> I don't remember what causes this, but I'll look into it.

Turns out the problem running the sort command was not in cvs2svn.py, but in
run-tests.py.

When you ran cvs2svn.py directly from the command line it would work, but if it
were run under run-tests.py, it wouldn't work. I experimented with the code in
run-tests.py that starts up cvs2svn, and found that changing the comand line
from

  cvs2svn.py [args]

to

  python cvs2svn.py [args]

made everything work. A new patch is attached that has this change and the
original sorting code.

<aside>
I couldn't figure out what the difference between the two invocations is, but I
did write a little script to reproduce the problem:

  import os, sys

  cmdline = "python %s arg" % sys.argv[0]  # working command line
  #cmdline = "%s arg" % sys.argv[0]        # broken command line

  if len(sys.argv) == 1:
    infile, outfile, errfile = os.popen3(cmdline, 't')
    print "".join(outfile.readlines())
  else:
    if os.system("echo WORKS"):
      print "BROKEN"
</aside>



Log Message:

Changes to cvs2svn.py and its regression testing script so they will
work on Windows.

* tools/cvs2svn/cvs2svn.py (relative_name): Changed this function to
  expect os.sep in the file path passed to it instead of forward
  slashes. Also added an assertion to detect incorrect usage.

  (escape_shell_arg): new function to escape shell arguments, works
  differently on unix and windows

  (Dumper.add_or_change_path): changed to check out files in binary
  mode, and to use the escape_shell_arg function

* tools/cvs2svn/run-tests.py (repos_to_url): Added missing slash
  detection. Needed because absolute paths on windows begin with
  a drive letter instead of a slash.

  (svn_strptime): new function to take the place of time.strptime,
  which doesn't exist on windows

  (Log.__init__): replaced time.strptime() call with svn_strptime()
  call.

  (run_cvs2svn): changed command line used to start cvs2svn on windows