[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: "svn propset svn:externals" syntax on Windows command line

From: Simon Large <simon.tortoisesvn_at_gmail.com>
Date: Fri, 30 Nov 2012 16:18:14 +0000

On 30 November 2012 16:06, Ben Johnson <ben_at_indietorrent.org> wrote:
> On 11/29/2012 6:02 PM, Simon Large wrote:
>> On 29 November 2012 21:49, Ben Johnson <ben_at_indietorrent.org> wrote:
>>> Hello,
>>>
>>> I've wasted far too much time attempting to discern the correct syntax
>>> for setting svn:externals properties, *pinned with explicit revision
>>> numbers*, via the Windows command line.
>>>
>>> While I realize that this question is not TSVN-specific, I am hoping the
>>> TSVN developers can provide some insight, because clearly, this very
>>> capability has been implemented in TSVN.
>>>
>>> I am trying to emulate TSVN's svn:externals property editor, which
>>> yields the following property string:
>>>
>>> -r 661 ^/../framework/trunk/database database
>>>
>>> I am using the following command (all on one line):
>>>
>>> svn propset svn:externals "-r661 ^/../framework/trunk/database database" .
>>>
>>> This yields the following error message:
>>>
>>> svn: E205000: Syntax error in revision argument '661
>>> ^/../framework/trunk/database database'
>>>
>>> I have also tried placing a space between "-r" and "661", even though
>>> the output from "svn help propset" does not use a space in the example
>>> (it uses "-r25"; see last line in below paragraph):
>>>
>>> svn:externals - A newline separated list of module specifiers,
>>> each of which consists of a URL and a relative directory path,
>>> similar to the syntax of the 'svn checkout' command:
>>> http://example.com/repos/zig foo/bar
>>> A revision to check out can optionally be specified to pin the
>>> external to a known revision:
>>> -r25 http://example.com/repos/zig foo/bar
>>>
>>> Adding the space yields the same error, but with a space before "661" in
>>> the message:
>>>
>>> svn: E205000: Syntax error in revision argument ' 661
>>> ^/../framework/trunk/database database'
>>>
>>> The problem seems to be related to how Windows handles the minus sign in
>>> the "-r661" portion of the string. If I escape the minus sign with a
>>> backslash, the command succeeds, but of course, the backslash appears,
>>> literally, in the svn:externals property value.
>>>
>>> I've scoured the Web looking for examples of how this is done on the
>>> Windows command line with SVN 1.7, and I can't find a single example.
>>>
>>> Any help is greatly appreciated!
>>
>> The answer is somewhat unexpected, at least to me:
>>
>> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=463&dsMessageId=2733969
>>
>> The correct syntax it seems is:
>>
>> svn propset svn:externals -- "-r661 ^/../framework/trunk/database database" .
>>
>> And the reason seems to be this one:
>> http://www.kernel.org/doc/man-pages/online/pages/man3/getopt.3.html
>>
>> The extra -- prevents the following arguments starting with - from
>> being parsed as options.
>
> Brilliant! That works. Thank you, Simon!
>
> This solution is unexpected to me, too. How Philip Martin knew that this
> is "simply standard argument handling for just about any program" eludes
> me. I hadn't run into this before.

I think he means "just about any gcc program", i.e. a program which
uses getopt for command line processing. Windows programs don't count
as proper programs ;-)

> One last question: I noticed that TSVN inserts a space between the "r"
> and the revision number, e.g.:
>
> -r 661 ^/../framework/trunk/database database
>
> But the SVN help output omits the space in its example, e.g.:
>
> -r661 ^/../framework/trunk/database database
>
> Will both formats function identically? Or should one be used over the
> other?

They certainly both seem to work, although there is no reference to
the extra space in the user documentation. It may be documented in the
subversion API or it may be a bug in TSVN that happens to work.

Stefan

--
:       ___
:  oo  // \\      "De Chelonian Mobile"
: (_,\/ \_/ \     TortoiseSVN
:   \ \_/_\_/>    The coolest Interface to (Sub)Version Control
:   /_/   \_\     http://tortoisesvn.net
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=3032375
To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_tortoisesvn.tigris.org].
Received on 2012-11-30 17:18:35 CET

This is an archived mail posted to the TortoiseSVN Users mailing list.