You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Christopher Ness <ch...@nesser.org> on 2005/05/18 04:16:20 UTC

[patch] svnversion - current working directory

I got sick of typing svnversion without a path and getting the usage
info.

This patch enables svnversion to act like the rest of the CLI programs.
When it is called without an argument it displays the revision of the
current directory, aka "."  I believe this is a valid path for most
platforms (at least Win/*nix).

I'm not sure why this hasn't been done previously.  If there was a good
debate and reason why it hasn't been changed to be like most of the CLI
programs I sure couldn't find it with google.

I'm not subscribed to Dev@ so please include me in any replies on that
list.

My first attempt at modifying SVN.  ;)

Cheers,
-- 
Christopher Ness
Wireless Group,
McMaster University

finger - 00:03:55 up 22:12, 1 user, load average: 0.77, 0.27, 0.09

Re: [PATCH] svnversion - current working directory

Posted by kf...@collab.net.
Peter McNab <mc...@melbpc.org.au> writes:
> Philip Martin wrote:
> 
> >I think it's
> >
> >      usage: svnversion [OPTIONS] [WC_PATH [TRAIL_URL]]
> >
> >
> Is that meant to be "TRAIL" as in mountain track or TRIAL as in what
> goes on in a court room?

It's "TRAIL" as in mountain track, but thanks for checking.

-Karl

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] svnversion - current working directory

Posted by Peter McNab <mc...@melbpc.org.au>.
Philip Martin wrote:

>I think it's
>
>      usage: svnversion [OPTIONS] [WC_PATH [TRAIL_URL]]
>
>  
>
Is that meant to be "TRAIL" as in mountain track or TRIAL as in what 
goes on in a court room?

Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [BOOK PATCH] svnversion - current working directory

Posted by "C. Michael Pilato" <cm...@collab.net>.
Christopher Ness <ch...@nesser.org> writes:

> On Thu, 2005-05-19 at 10:54 -0500, C. Michael Pilato wrote:
> > Christopher Ness <ch...@nesser.org> writes:
> > > Since this is a shift in the user interface workings of svnversion
> > > some changes to the SVNbook would be in order too.  If this is
> > > accepted I'll have a look at the docbook source next week as I am
> > > going out of town tonight.
> > 
> > Much appreciated.
> 
> I love long weekends like May 24.  Glad I read the 1.2 release notes to
> find out that the book was split into a new repository.  
> 
> I did not see a global HACKING file that explained the patch method (the
> HACKING file in /en/ hinted there might be one), so I assume it is
> similar to SVN's.

Patch is all good.  I just ran into some admin issues -- namely, we
haven't yet figured out how we'll track changes to Subversion HEAD in
the book's repository (trunk there is 1.2 coverage).  For now, I'll
just leave a TODO in the book which points to your patch in a mailing
list archive.

Thanks, Christopher.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [BOOK PATCH] svnversion - current working directory

Posted by Christopher Ness <ch...@nesser.org>.
On Thu, 2005-05-19 at 10:54 -0500, C. Michael Pilato wrote:
> Christopher Ness <ch...@nesser.org> writes:
> > Since this is a shift in the user interface workings of svnversion
> > some changes to the SVNbook would be in order too.  If this is
> > accepted I'll have a look at the docbook source next week as I am
> > going out of town tonight.
> 
> Much appreciated.

I love long weekends like May 24.  Glad I read the 1.2 release notes to
find out that the book was split into a new repository.  

I did not see a global HACKING file that explained the patch method (the
HACKING file in /en/ hinted there might be one), so I assume it is
similar to SVN's.

ChangeLog

* /src/en/book/ch09.xml
  (svn-ch-9-sect-5): Updated svnversion examples to no longer require
  an explicit WC_PATH unless TRAIL_URL is required.

Find patch attached.

Cheers,
Chris
-- 
Wireless Group,
McMaster University

finger.localdomain
15:51:24 up 5:20, 1 user, load average: 0.55, 0.53, 0.32

Re: [PATCH] svnversion - current working directory

Posted by "C. Michael Pilato" <cm...@collab.net>.
Christopher Ness <ch...@nesser.org> writes:

> On Thu, 2005-05-19 at 00:08 +0100, Philip Martin wrote:
> >       usage: svnversion [OPTIONS] [WC_PATH [TRAIL_URL]]
> 
> If Michael agrees then I think it is complete.  I have also patched
> the man page for svnversion to finalize the documentation update.

I do agree.  How could I disagree with Philip?  He's ... Philip!  :-)

> Since this is a shift in the user interface workings of svnversion
> some changes to the SVNbook would be in order too.  If this is
> accepted I'll have a look at the docbook source next week as I am
> going out of town tonight.

Much appreciated.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] svnversion - current working directory

Posted by "C. Michael Pilato" <cm...@collab.net>.
Christopher Ness <ch...@nesser.org> writes:

> On Thu, 2005-05-19 at 00:08 +0100, Philip Martin wrote:
> >       usage: svnversion [OPTIONS] [WC_PATH [TRAIL_URL]]
> 
> If Michael agrees then I think it is complete.
> I have also patched the man page for svnversion to finalize the
> documentation update.

Thanks for the patch, Christopher.  Committed in r14892.  I'll be
looking at your book patch next.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] svnversion - current working directory

Posted by Christopher Ness <ch...@nesser.org>.
On Thu, 2005-05-19 at 00:08 +0100, Philip Martin wrote:
>       usage: svnversion [OPTIONS] [WC_PATH [TRAIL_URL]]

If Michael agrees then I think it is complete.
I have also patched the man page for svnversion to finalize the
documentation update.

Since this is a shift in the user interface workings of svnversion some
changes to the SVNbook would be in order too.  If this is accepted I'll
have a look at the docbook source next week as I am going out of town
tonight.

ChangeLog:

* /subversion/svnversion/main.c
  (main): Prints the version of the current working directory
  when called without arguments instead of the usage message.
  (help): Usage Documentation Update

* /subversion/svnversion/svnversion.1
  (): Documentation Update

Cheers,
Chris
-- 
Wireless Group,
McMaster University

finger - 10:03:18 up 1 day, 20:17, 1 user, load average: 0.10, 0.05, 0.01

Re: [PATCH] svnversion - current working directory

Posted by Philip Martin <ph...@codematters.co.uk>.
"C. Michael Pilato" <cm...@collab.net> writes:

> Christopher Ness <ch...@nesser.org> writes:
>
>> Index: main.c
>> ===================================================================
>> --- main.c	(revision 14773)
>> +++ main.c	(working copy)
>> @@ -131,7 +131,7 @@
>>    svn_error_clear
>>      (svn_cmdline_fprintf
>>       (stdout, pool,
>> -      _("usage: svnversion [OPTIONS] WC_PATH [TRAIL_URL]\n\n"
>> +      _("usage: svnversion [OPTIONS] [WC_PATH] [TRAIL_URL]\n\n"
>
> I think this is too ambiguous, now.  Does 'svnversion foo' now mean
> WC_PATH == FOO, or TRAIL_URL == FOO?

WC_PATH == FOO

> You might have to either break it into two lines:
>
>     usage: svnversion [OPTIONS]
>            svnversion [OPTIONS] WC_PATH [TRAIL_URL]

I think it's

      usage: svnversion [OPTIONS] [WC_PATH [TRAIL_URL]]

-- 
Philip Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] svnversion - current working directory

Posted by Christopher Ness <ch...@nesser.org>.
On Wed, 2005-18-05 at 17:18 -0500, C. Michael Pilato wrote:
    8< snip >8
> > -      _("usage: svnversion [OPTIONS] WC_PATH [TRAIL_URL]\n\n"
> > +      _("usage: svnversion [OPTIONS] [WC_PATH] [TRAIL_URL]\n\n"
> 
> I think this is too ambiguous, now.  Does 'svnversion foo' now mean
> WC_PATH == FOO, or TRAIL_URL == FOO?
> 
> You might have to either break it into two lines:
> 
>     usage: svnversion [OPTIONS]
>            svnversion [OPTIONS] WC_PATH [TRAIL_URL]
> 
> Or teach the code to use the likes of svn_path_is_url() to determine,
> in the 1-argument case, if that one argument was a working copy path
> or a URL.

Would this be the suggested way?  Is that more complexity for a simple
piece of code?

> I wish I'd noticed the TRAIL_URL before ... the UI side-effects have
> me less excited about this change.

I see what you mean.  Yes, WC_PATH *must* be declared in order for
TRAIL_URL to engage.  The location of the argument determines its
meaning.

Perhaps this:
    usage: svnversion [OPTIONS] [ WC_PATH [TRAIL_URL] ]

Which is a more compact version of your two line example above.  
Or would this be too confusing for users?  :-D  <-- Big Toothy Grin

Could we leave the usage syntax as is while including the note at the
bottom of the verbose help message with this new line:

"   If invoked without arguments, WC_PATH will be the current directory."

Cheers,
Chris
-- 
Software Engineering IV,
McMaster University
PGP Public Key: http://www.nesser.org/pgp-key/
19:32:27 up 7 days, 22:01, 1 user, load average: 0.04, 0.03, 0.01 
http://www.gnu.org/philosophy/no-word-attachments.html

Re: [PATCH] svnversion - current working directory

Posted by "C. Michael Pilato" <cm...@collab.net>.
Christopher Ness <ch...@nesser.org> writes:

> Index: main.c
> ===================================================================
> --- main.c	(revision 14773)
> +++ main.c	(working copy)
> @@ -131,7 +131,7 @@
>    svn_error_clear
>      (svn_cmdline_fprintf
>       (stdout, pool,
> -      _("usage: svnversion [OPTIONS] WC_PATH [TRAIL_URL]\n\n"
> +      _("usage: svnversion [OPTIONS] [WC_PATH] [TRAIL_URL]\n\n"

I think this is too ambiguous, now.  Does 'svnversion foo' now mean
WC_PATH == FOO, or TRAIL_URL == FOO?

You might have to either break it into two lines:

    usage: svnversion [OPTIONS]
           svnversion [OPTIONS] WC_PATH [TRAIL_URL]

Or teach the code to use the likes of svn_path_is_url() to determine,
in the 1-argument case, if that one argument was a working copy path
or a URL.

I wish I'd noticed the TRAIL_URL before ... the UI side-effects have
me less excited about this change.




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] svnversion - current working directory

Posted by Christopher Ness <ch...@nesser.org>.
Last version - I promise.  

I decided to update the online help in my patch as well - like I should
have in the first place.  

Log Message:

* /subversion/svnversion/main.c
  (main): Prints the version of the current working directory
  when called without arguments instead of the usage message.
  (help): Updated Docs

Cheers,
Chris
-- 
Wireless Group,
McMaster University

finger - 14:33:06 up 1 day, 47 min, 1 user, load average: 0.30, 0.09,
0.02

Re: [PATCH] svnversion - current working directory

Posted by Christopher Ness <ch...@nesser.org>.
On Wed, 2005-05-18 at 11:41 -0500, C. Michael Pilato wrote:
> Christopher Ness <ch...@nesser.org> writes:
> 
> > I got sick of typing svnversion without a path and getting the usage
> > info.
> 
> Heh.  I think I ran svnversion for one of the first times ever last
> night, and had the same thought.
> 
> Your patch (thank you much), lacks a log message.  Please see HACKING
> for log message guidelines.

Log Message:

* /subversion/svnversion/main.c
  (main): Prints the version of the current working directory
  when called without arguments instead of the usage message.

> I was about to fuss because "." is not canonical for Subversion
> purposes, but then this section of code is dealing with user input,
> not yet canonicalized anyway, so I'm pretty sure "." here is fine.

Excellent, thanks for the review.
Reattached my little patch for good measure.

Cheers,
Chris
-- 
Wireless Group,
McMaster University

finger - 02:22:31 up 1 day, 31 min, 1 user, load average: 0.00, 0.02, 0.00

Re: [PATCH] svnversion - current working directory

Posted by Christopher Ness <ch...@nesser.org>.
On Wed, 2005-05-18 at 11:41 -0500, C. Michael Pilato wrote:
> Christopher Ness <ch...@nesser.org> writes:
> 
> > I got sick of typing svnversion without a path and getting the usage
> > info.
> 
> Heh.  I think I ran svnversion for one of the first times ever last
> night, and had the same thought.
> 
> Your patch (thank you much), lacks a log message.  Please see HACKING
> for log message guidelines.

Log Message:

* /subversion/svnversion/main.c
  (main): Prints the version of the current working directory
  when called without arguments instead of the usage message.

> I was about to fuss because "." is not canonical for Subversion
> purposes, but then this section of code is dealing with user input,
> not yet canonicalized anyway, so I'm pretty sure "." here is fine.

Excellent, thanks for the review.
Reattached my little patch for good measure.

Cheers,
Chris
-- 
Wireless Group,
McMaster University

finger - 02:22:31 up 1 day, 31 min, 1 user, load average: 0.00, 0.02, 0.00

Re: [patch] svnversion - current working directory

Posted by "C. Michael Pilato" <cm...@collab.net>.
Christopher Ness <ch...@nesser.org> writes:

> I got sick of typing svnversion without a path and getting the usage
> info.

Heh.  I think I ran svnversion for one of the first times ever last
night, and had the same thought.

Your patch (thank you much), lacks a log message.  Please see HACKING
for log message guidelines.

> Index: main.c
> ===================================================================
> --- main.c	(revision 14773)
> +++ main.c	(working copy)

[...]

> -  SVN_INT_ERR (svn_utf_cstring_to_utf8 (&wc_path, os->argv[os->ind++], pool));
> +  SVN_INT_ERR (svn_utf_cstring_to_utf8 (&wc_path, 
> +			  (os->ind == argc) ? "." : os->argv[os->ind++], 
> +			  pool));

I was about to fuss because "." is not canonical for Subversion
purposes, but then this section of code is dealing with user input,
not yet canonicalized anyway, so I'm pretty sure "." here is fine.

Why'd I bother calling that out?  I dunno.  It's Wednesday.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: [patch] svnversion - current working directory

Posted by "C. Michael Pilato" <cm...@collab.net>.
Christopher Ness <ch...@nesser.org> writes:

> I got sick of typing svnversion without a path and getting the usage
> info.

Heh.  I think I ran svnversion for one of the first times ever last
night, and had the same thought.

Your patch (thank you much), lacks a log message.  Please see HACKING
for log message guidelines.

> Index: main.c
> ===================================================================
> --- main.c	(revision 14773)
> +++ main.c	(working copy)

[...]

> -  SVN_INT_ERR (svn_utf_cstring_to_utf8 (&wc_path, os->argv[os->ind++], pool));
> +  SVN_INT_ERR (svn_utf_cstring_to_utf8 (&wc_path, 
> +			  (os->ind == argc) ? "." : os->argv[os->ind++], 
> +			  pool));

I was about to fuss because "." is not canonical for Subversion
purposes, but then this section of code is dealing with user input,
not yet canonicalized anyway, so I'm pretty sure "." here is fine.

Why'd I bother calling that out?  I dunno.  It's Wednesday.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org