On 20. 5. 25 15:56, Dr. Thomas Orgis via dev wrote:
Hi,
this may be some thing already convered, but then it may be hidden … I
work a lot in a repository with several levels of directories that have
copy/merge relations to each other. Hence I often need to do something like
$ cd /checkout/some/dir
$ svn merge ^/some/dir/foo/bar baz/flu
(Ideally I'd like to be able to say 'merge foo/bar baz/flu, but it is
bothersome to find out what to do to satisfy E195002, addressing the
repo is easier than that.)
Or I might just want to know what is there in the repo before doing
$ svn up --parents some/path
in a shallow working copy. There I also have to do
$ svn list ^/some/dir/some
to see my options.
Is there a way to shorten the ^/some/dir? It seems like something
obvious that there would be a shorthand for 'the location in the repo
that corresponds to the current working durctory'. Pardon me if I
managed to miss it in the documentation. If it is not existing, would
the project be open to adding it? I'm not sure about all implicatons of
handling ^ in paths … but I halfway expected something like
$ svn list ^^/
to give me a listing of ^/some/dir/. Or of
$ svn merge ^^/foo/bar baz/flu
meaning to merge the path foo/bar in the current working directory into
baz/flu, with the state it has in the repo.
Is this something that has been considered before? I only find old
questions and hacks like on
https://stackoverflow.com/questions/41416499/this-working-copys-repository-url-shorthand-in-svn
where a shell function defines shell variables with the respective
parent paths. Doesn't seem that convenient.
As I repeatedly tell people who wonder why anyone is still using svn,
working with the paths in a directory structure, and even just paths
without actual data (empty directories) is the strong aspect of
subversion, compared to git, which is very good at handling content,
less so the structure around it.
It would be nice if the svn command line would make working with
directory trees and partial checkouts a bit easier by providing such a shortcut
for
$ svn merge "$(svn info | grep ^Relative\ URL:| cut -f 3- -d ' ')"/foo/bar
baz/flu
Well … I can define that as command or shell function … but ^^ is still
a lot nicer to type than $(svnrelpath).
So, no, we don't currently have a syntax for relative URLs that would do
what you propose. I don't know offhand what all the ramifications would
be (other than, well, writing a bushel of tests for that), but if
someone steps forward with a patch, I expect we'd accept it.
I'm sure we talked a lot about relative URLs on this list before,
including about what you propose. There is, however, a "slight" problem:
the current implementation of repos-relative URLs doesn't look at the
working copy at all; indeed, ^/path works without a working copy. So
this is really an entirely new concept.
And of course, if we support "^.", we obviously have to support
"^./any/relative/wc/path" in the same way. I don't remember how we deal
with actual names in the working copy named "^", but I'm sure there's
some way to escape that.
-- Brane