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

Re: [PATCH] Extend 'svn diff URL URL' to 'svn diff URL URL [WC]'

From: Julian Foad <julian.foad_at_wandisco.com>
Date: Thu, 03 Dec 2009 11:39:05 +0000

Philip Martin wrote:
> It's possible to compare branches in the repository using
>
> $ svn diff ^/repo/branches/foo ^/repo/branches/bar
>
> but that only works if the current directory is a working copy because
> libsvn_client/cmdline.c:svn_client_args_to_target_array converts
> relative URLs to full URLs using the hardcoded path "". Since I
> regularly have my current working directory outside a working copy
> this is inconvenient.
>
> I'd like to be able to do
>
> $ svn diff ^/repo/branches/foo ^/repo/branches/bar path/to/wc
>
> and it turns out to be quite simple from a code point of view. It is,
> of course, an extension to our rather complex diff UI. What do people
> think?

What does your example command line mean? I assume you mean path/to/wc
is used just to identify the repository, and does not additionally
specify something like which path within the branches you want diffed.
(Compare the diff syntax 2, where paths within the primary pair of
targets can be specified at the end.)

-1 to exactly as formulated here. It looks far too much like a
(syntax-2) command for specifying sub-paths.

We could consider instead something like

$ svn diff ^/repo/branches/foo ^/repo/branches/bar --repos=[URL|WC]

where --repos= is a new option that either overrides or provides a
fallback for the repository used for resolving "^/" arguments.

However, if the option is named simply "--repos=", it doesn't sound like
it would apply only to "^/" args, but also to other places where a repos
is specified. It might need to be called "--default-repos=" if we want
it to be a fallback, or "--relative-to-repos=" for an override.

Such an option would enable the use of "^/" in commands such as
"checkout" and "import" and "export" that need a repository to be
specified but don't necessarily have an existing WC.

This could be very useful in conjunction with the ability to specify it
in the client-side configuration file - I expect there are very many
users who only regularly work with one repository. And for those who
regularly work with one repository per command shell, it would be useful
to be able to specify the repos in an environment variable, (though I
know we don't like to make svn use more env vars), thus making a little
slicker what many of us already can and do:

  export REPOS=http://s.a.o/repos/subversion
  ...
  svn co $REPOS/trunk/www wc
  ...
  svn ps release-id "1.1.0" --revprop -r 1234 $REPOS
  ...

But overall I'm not casting any strong opinion on the usefulness of such
an option at all.

- Julian

> Add 'svn diff URL URL [WC]' as an extension to 'svn diff URL URL'.
>
> * subversion/svn/diff-cmd.c:
> (svn_cl_diff): Recognise 'svn diff URL URL [WC]'.
>
> * subversion/svn/main.c
> (svn_cl__cmd_table): Extend diff help text.
>
> * subversion/include/svn_client.h
> (svn_client_args_to_target_array): Tweak doc string.
>
> * subversion/libsvn_client/cmdline.c
> (svn_client_args_to_target_array): Convert relative urls using the first
> path given and only use "" if there are no paths.
[...]
> "usage: 1. diff [-c M | -r N[:M]] [TARGET[@REV]...]\n"
> " 2. diff [-r N[:M]] --old=OLD-TGT[@OLDREV] [--new=NEW-TGT[@NEWREV]] \\\n"
> " [PATH...]\n"
> - " 3. diff OLD-URL[@OLDREV] NEW-URL[@NEWREV]\n"
> + " 3. diff OLD-URL[@OLDREV] NEW-URL[@NEWREV] [PATH]\n"
> "\n"
> " 1. Display the changes made to TARGETs as they are seen in REV between\n"
> " two revisions. TARGETs may be all working copy paths or all URLs.\n"
> @@ -490,6 +490,8 @@
> " to N, -r N:M makes OLDREV default to N and NEWREV default to M.\n"
> "\n"
> " 3. Shorthand for 'svn diff --old=OLD-URL[@OLDREV] --new=NEW-URL[@NEWREV]'\n"
> + " Relative URLs are converted to full URLs using either PATH, if given,\n"
> + " or the current directory.\n"
> "\n"
> " Use just 'svn diff' to display local modifications in a working copy.\n"),
> {'r', 'c', opt_old_cmd, opt_new_cmd, 'N', opt_depth, opt_diff_cmd, 'x',

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2426647

Please start new threads on the <dev_at_subversion.apache.org> mailing list.
To subscribe to the new list, send an empty e-mail to <dev-subscribe_at_subversion.apache.org>.
Received on 2009-12-03 12:39:32 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.