You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Garrett Rooney <ro...@electricjellyfish.net> on 2001/12/06 01:15:36 UTC

[PATCH] issue 576 (specifying -F without any files to commit)

This patch handles bite sized task #576.  

We should probably replace the princess bride quote in
SVN_ERR_CL_POTENTIAL_USER_ERROR, but I couldn't think of anything
really descriptive that was also short.

* subversion/client/cmdline/commit-cmd.c

  If the user specified a log message via -F, but didn't specify any
  files to commit, error out, because it probably isn't what they wanted
  to do.  (It commits the file with it's contents as the log, which
  doesn't make much sense in most cases.)  Allow this behaviour if
  --force is specified.

* subversion/include/svn_error_codes.h

  Add a new error code, SVN_ERR_CL_POTENTIAL_USER_ERROR, for cases
  when the effect of the command given is almost certainly not what the
  user wants to do.

-- 
garrett rooney                     Unix was not designed to stop you from 
rooneg@electricjellyfish.net       doing stupid things, because that would  
http://electricjellyfish.net/      stop you from doing clever things.

Re: [PATCH] issue 576 (specifying -F without any files to commit)

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
ack!

i forgot to delete some test code (that wasn't getting run) before
making that diff...  here's the right one...

-garrett

-- 
garrett rooney                     Unix was not designed to stop you from 
rooneg@electricjellyfish.net       doing stupid things, because that would  
http://electricjellyfish.net/      stop you from doing clever things.

Re: [PATCH] issue 576 (specifying -F without any files to commit)

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On Thu, Dec 06, 2001 at 07:56:50AM -0500, Garrett Rooney wrote:
> On Thu, Dec 06, 2001 at 02:42:31AM -0800, Greg Stein wrote:
> 
> > Right. And the test in Garrett's patch isn't quite sufficient:
> > 
> > $ svn commit -F file1 file2
> > 
> > would "pass" his test (that is: are there any files to commit?), but use
> > file1 for the commit message, rather than committing both files.
> > 
> > And I agree with Daniel: I would be using "svn commit -F /tmp/msg" quite
> > often to commit a directory. Specifying no files would be quite common.
> 
> i see what you mean.  i will take a closer look and post another
> patch.

and here it is...  comments welcome as always...

- 
garrett rooney                     Unix was not designed to stop you from 
rooneg@electricjellyfish.net       doing stupid things, because that would  
http://electricjellyfish.net/      stop you from doing clever things.

Re: [PATCH] issue 576 (specifying -F without any files to commit)

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On Thu, Dec 06, 2001 at 02:42:31AM -0800, Greg Stein wrote:

> Right. And the test in Garrett's patch isn't quite sufficient:
> 
> $ svn commit -F file1 file2
> 
> would "pass" his test (that is: are there any files to commit?), but use
> file1 for the commit message, rather than committing both files.
> 
> And I agree with Daniel: I would be using "svn commit -F /tmp/msg" quite
> often to commit a directory. Specifying no files would be quite common.

i see what you mean.  i will take a closer look and post another
patch.

-garrett

-- 
garrett rooney                     Unix was not designed to stop you from 
rooneg@electricjellyfish.net       doing stupid things, because that would  
http://electricjellyfish.net/      stop you from doing clever things.

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

Re: [PATCH] issue 576 (specifying -F without any files to commit)

Posted by Greg Stein <gs...@lyra.org>.
On Thu, Dec 06, 2001 at 08:06:58AM +0100, Daniel Stenberg wrote:
> On Wed, 5 Dec 2001, Garrett Rooney wrote:
> > If the user specified a log message via -F, but didn't specify any files
> > to commit, error out, because it probably isn't what they wanted to do.
> 
> That's not how I interpret issue 576. Isn't that to take things a bit too
> far? I mean, my problem (as I actually made this mistake) wasn't that I could
> do "svn commit -F descfile" to commit everything in the directory, my problem
> was rather that I mistyped the commit message file with the file I was gonna
> commit ("cvs commit -F svn.1"). (Thanks to tab-completion in the shell, its
> very easily done!)
> 
> Thus, I would rather say that checking that the commit message is not a
> versioned file is what it takes to prevent the same mistake from happening
> again. At least that's how I see it and that's how I read issue 576.

Right. And the test in Garrett's patch isn't quite sufficient:

$ svn commit -F file1 file2

would "pass" his test (that is: are there any files to commit?), but use
file1 for the commit message, rather than committing both files.

And I agree with Daniel: I would be using "svn commit -F /tmp/msg" quite
often to commit a directory. Specifying no files would be quite common.

[ of course, I will stop using -F once EDITOR functionality arrives ]

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

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

Re: [PATCH] issue 576 (specifying -F without any files to commit)

Posted by Daniel Stenberg <da...@haxx.se>.
On Wed, 5 Dec 2001, Garrett Rooney wrote:

> If the user specified a log message via -F, but didn't specify any files
> to commit, error out, because it probably isn't what they wanted to do.

That's not how I interpret issue 576. Isn't that to take things a bit too
far? I mean, my problem (as I actually made this mistake) wasn't that I could
do "svn commit -F descfile" to commit everything in the directory, my problem
was rather that I mistyped the commit message file with the file I was gonna
commit ("cvs commit -F svn.1"). (Thanks to tab-completion in the shell, its
very easily done!)

Thus, I would rather say that checking that the commit message is not a
versioned file is what it takes to prevent the same mistake from happening
again. At least that's how I see it and that's how I read issue 576.

> Add a new error code, SVN_ERR_CL_POTENTIAL_USER_ERROR, for cases when the
> effect of the command given is almost certainly not what the user wants
> to do.

Hm, isn't error codes usually better off trying to specify the error, not the
assumed reason for why? Also, I don't think a generic help string like "I do
not think that means what you think it means" is gonna be very helpful.
Imagine a case where you run a lot of commands in a script, and that error is
what gets spit out. Would anyone have any clue what the error message is
about?

I suggest something in this style:

   SVN_ERR_CL_COMMIT_MESSAGE_IS_VERSIONED_FILE
   "The commit message is a file under version control. Use --force to
   override"

This will of course also imply a different fix...

-- 
      Daniel Stenberg - http://daniel.haxx.se - +46-705-44 31 77
   ech`echo xiun|tr nu oc|sed 'sx\([sx]\)\([xoi]\)xo un\2\1 is xg'`ol



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