You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by tstone-barcard <ts...@barclaycardus.com> on 2010/05/07 14:07:41 UTC

How do I use "^" in command-line paths?

The SVN Book uses a path syntax throughout the narrative that prefixes
a "^". I'm continually baffled by the use of "^" in the svn-book
(http://svnbook.red-bean.com) because I cannot get it to work.

What is this shortcut? When does it work? Does it need to be set?

I've tried using it, but it never works (v1.6.3).

I've used other "path shortcuts" like environment variables, but would
love to understand just what the authors are trying to demonstrate in
the book.

Thanks,
Tim

Re: How do I use "^" in command-line paths?

Posted by Stanimir Stamenkov <s7...@netscape.net>.
Fri, 7 May 2010 07:07:41 -0700 (PDT), /tstone-barcard/:

> The SVN Book uses a path syntax throughout the narrative that prefixes 
> a "^". I'm continually baffled by the use of "^" in the svn-book 
> (http://svnbook.red-bean.com) because I cannot get it to work.
>
> What is this shortcut? When does it work? Does it need to be set?
>
> I've tried using it, but it never works (v1.6.3).
>
> I've used other "path shortcuts" like environment variables, but would 
> love to understand just what the authors are trying to demonstrate in 
> the book.

The caret (^) notation works only inside a working copy 
<http://svnbook.red-bean.com/nightly/en/svn.basic.in-action.html#svn.advanced.reposurls>:

> In Subversion 1.6, a new caret (^) notation was introduced as a 
> shorthand for “the URL of the repository's root directory”. For example:
>
> $ svn list ^/tags/bigsandwich/
>
> In this example, we're specifying a URL for the /tags/bigsandwich 
> directory in the root of the repository. Note that this URL syntax 
> only works when your current working directory is a working copy—the 
> commandline client knows the repository's root URL by looking at the 
> working copy's metadata.

You didn't state what OS you're on but on Windows you have to use ^^ as 
^ is a special command-line character - it is the escape character, e.g. 
you would need to use:

D:\...>svn merge ^^/branches/foo

On Windows you could also use double quotes around:

D:\...>svn merge "^/branches/foo"

-- 
Stanimir

Re: How do I use "^" in command-line paths?

Posted by Stanimir Stamenkov <s7...@netscape.net>.
Fri, 7 May 2010 07:07:41 -0700 (PDT), /tstone-barcard/:

> The SVN Book uses a path syntax throughout the narrative that prefixes 
> a "^". I'm continually baffled by the use of "^" in the svn-book 
> (http://svnbook.red-bean.com) because I cannot get it to work.
>
> What is this shortcut? When does it work? Does it need to be set?
>
> I've tried using it, but it never works (v1.6.3).
>
> I've used other "path shortcuts" like environment variables, but would 
> love to understand just what the authors are trying to demonstrate in 
> the book.

The caret (^) notation works only inside a working copy 
<http://svnbook.red-bean.com/nightly/en/svn.basic.in-action.html#svn.advanced.reposurls>:

> In Subversion 1.6, a new caret (^) notation was introduced as a 
> shorthand for “the URL of the repository's root directory”. For example:
>
> $ svn list ^/tags/bigsandwich/
>
> In this example, we're specifying a URL for the /tags/bigsandwich 
> directory in the root of the repository. Note that this URL syntax 
> only works when your current working directory is a working copy—the 
> commandline client knows the repository's root URL by looking at the 
> working copy's metadata.

You didn't state what OS you're on but on Windows you have to use ^^ as 
^ is a special command-line character - it is the escape character, e.g. 
you would need to use:

D:\...>svn merge ^^/branches/foo

On Windows you could also use double quotes around:

D:\...>svn merge "^/branches/foo"

-- 
Stanimir

Re: How do I use "^" in command-line paths?

Posted by Stefan Sperling <st...@elego.de>.
On Fri, May 07, 2010 at 07:07:41AM -0700, tstone-barcard wrote:
> The SVN Book uses a path syntax throughout the narrative that prefixes
> a "^". I'm continually baffled by the use of "^" in the svn-book
> (http://svnbook.red-bean.com) because I cannot get it to work.
> 
> What is this shortcut? When does it work? Does it need to be set?

"^/" expands to the value of the repository root.
svn info prints the repository root as well -- that URL is
what will be used:

$ svn info | grep Root
Repository Root: file:///tmp/svn-sandbox/repos
$ svn ls file:///tmp/svn-sandbox/repos
branch/
trunk/
$ svn ls ^/
branch/
trunk/

> I've tried using it, but it never works (v1.6.3).

It should just work on Linux/Mac.

On windows, ^ is a special character for the cmd shell,
so you must escape it: use ^^/ instead of ^/

Stefan