Login | Register
My pages Projects Community openCollabNet

Discussions > dev [DISABLED] > Re: [RFC] Paths API (svn_dirent_uri.h) - improvements

subversion
Discussion topic

Back to topic list

Re: [RFC] Paths API (svn_dirent_uri.h) - improvements

Author brane
Full name Branko Cibej
Date 2009-11-11 11:37:42 PST
Message Stefan Sperling wrote:
> On Wed, Nov 11, 2009 at 05:46:21PM +0100, Branko Cibej wrote:
>
>> Julian Foad wrote:
>>
>>> Stefan Sperling wrote:
>>>
>>>
>>>> Yes, but there's no function that deals with the case where you get
>>>> a Windows path on unix and need to normalise it to internal style.
>>>>
>>>> I don't know if dirent_uri should provide that. But I had to cook
>>>> a custom hack in libsvn_client/patch.c to deal with this case.
>>>>
>>>>
>>> Good point: it sounds like it would be useful for the lib to provide
>>> functions for handling Windows paths even when running on Unix.
>>>
>>>
>> No wait -- when do you ever have to deal with Windows paths on Unix?
>> where do they come from? Those are not valid filesystem paths on the OS
>> where your client is running -- so what's the use case?
>>
>
> I've briefly hinted at it above:
> You get a patch someone created on Windows, so it contains paths using
> backslashes as separators, and you want 'svn patch' to apply it to
> a working copy you have on a unix machine.
>

Does it work with plain "patch"? No, it does not. You have to manually
tweak the patch before you can apply it. Exempli gratia:

$ patch -p0 < test.patch
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|Index: test\Dispatcher.java
|===================​====================​====================​========
|--- test\Dispatcher.java (revision 23)
|+++ test\Dispatcher.java (revision 22)
--------------------------
File to patch: ^C
$ ls -l test/Dispatcher.java
-rw-r--r-- 1 brane brane 1872 2009-11-11 14:46 daytest/Dispatcher.java


(I produced the patch file with "svn diff" on Linux and just replaced /
with \)

Not saying that this is an argument against "svn patch" accepting such
files, but the purpose of the svn_path_(internal|local)_style functions
is to deal with local user input, not with cross-OS data migration
issues. Moreover, just blindly converting backslashes to slashes is
*ambiguous* and therefore wrong on Unix. (Going the other way is not
ambiguous on Windows.)

-- Brane

« Previous message in topic | 8 of 24 | Next message in topic »

Messages

Show all messages in topic

[RFC] Paths API (svn_dirent_uri.h) - improvements Julian Foad <julian dot foad at wandisco dot com> Julian Foad <julian dot foad at wandisco dot com> 2009-11-11 04:25:58 PST
     Re: [RFC] Paths API (svn_dirent_uri.h) - improvements stsp Stefan Sperling 2009-11-11 05:08:20 PST
         Re: [RFC] Paths API (svn_dirent_uri.h) - improvements Julian Foad <julian dot foad at wandisco dot com> Julian Foad <julian dot foad at wandisco dot com> 2009-11-11 05:15:17 PST
             Re: [RFC] Paths API (svn_dirent_uri.h) - improvements stsp Stefan Sperling 2009-11-11 06:02:48 PST
                 Re: [RFC] Paths API (svn_dirent_uri.h) - improvements Julian Foad <julian dot foad at wandisco dot com> Julian Foad <julian dot foad at wandisco dot com> 2009-11-11 06:34:19 PST
                     Re: [RFC] Paths API (svn_dirent_uri.h) - improvements brane Branko Cibej 2009-11-11 08:46:25 PST
                         Re: [RFC] Paths API (svn_dirent_uri.h) - improvements stsp Stefan Sperling 2009-11-11 09:02:07 PST
                             Re: [RFC] Paths API (svn_dirent_uri.h) - improvements brane Branko Cibej 2009-11-11 11:37:42 PST
                                 Re: [RFC] Paths API (svn_dirent_uri.h) - improvements stsp Stefan Sperling 2009-11-11 11:48:19 PST
         Re: [RFC] Paths API (svn_dirent_uri.h) - improvements brane Branko Cibej 2009-11-11 05:29:37 PST
     Re: [RFC] Paths API (svn_dirent_uri.h) - improvements brane Branko Cibej 2009-11-11 05:25:23 PST
         Re: [RFC] Paths API (svn_dirent_uri.h) - improvements Julian Foad <julian dot foad at wandisco dot com> Julian Foad <julian dot foad at wandisco dot com> 2009-11-11 05:33:54 PST
             RE: [RFC] Paths API (svn_dirent_uri.h) - improvements rhuijben Bert Huijben 2009-11-11 05:51:49 PST
     Re: [RFC] Paths API (svn_dirent_uri.h) - improvements gstein Greg Stein 2009-11-11 12:37:01 PST
         Re: [RFC] Paths API (svn_dirent_uri.h) - improvements brane Branko Cibej 2009-11-11 13:26:52 PST
             Re: [RFC] Paths API (svn_dirent_uri.h) - improvements gstein Greg Stein 2009-11-11 14:07:54 PST
                 Re: [RFC] Paths API (svn_dirent_uri.h) - improvements gstein Greg Stein 2009-11-11 14:09:31 PST
                     Re: [RFC] Paths API (svn_dirent_uri.h) - improvements brane Branko Cibej 2009-11-11 14:26:27 PST
                         Re: [RFC] Paths API (svn_dirent_uri.h) - improvements gstein Greg Stein 2009-11-11 14:32:46 PST
         Re: [RFC] Paths API (svn_dirent_uri.h) - improvements Julian Foad <julian dot foad at wandisco dot com> Julian Foad <julian dot foad at wandisco dot com> 2009-11-12 06:57:33 PST
             Re: [RFC] Paths API (svn_dirent_uri.h) - improvements gstein Greg Stein 2009-11-12 09:02:47 PST
     Re: [RFC] Paths API (svn_dirent_uri.h) - improvements rdonch Roman Donchenko 2009-11-11 12:59:36 PST
         Re: [RFC] Paths API (svn_dirent_uri.h) - improvements stsp Stefan Sperling 2009-11-11 13:10:47 PST
     Re: [RFC] Paths API (svn_dirent_uri.h) - improvements rdonch Roman Donchenko 2009-11-11 16:44:20 PST
Messages per page: