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

Proposed feature: safer alternative to svnput

From: Markus Kuhn <Markus.Kuhn_at_cl.cam.ac.uk>
Date: Thu, 04 Sep 2008 15:58:44 +0100

It would be extremely useful if Subversion allowed me to modify a file
that I supply to the svn command from standard input, without having to
check out a working directory first. Main application would be a
wiki-style CGI editor that allows users to modify individual files in an
a repository. (A "svn checkout -N" is messy as it generates an entire
directory with other unneeded files that need to be preserved across CGI
calls and cleaned up afterwards reliably.)

I am aware of

  http://svn.collab.net/repos/svn/trunk/tools/examples/svnput.c

but this tool seems dangerous as it might overwrite files that I have
never seen before. I would instead prefer to give svnput on the
commandline the BASE revision number that I have already seen (i.e., the
revision that I started from), and then have svnput succeed *only* if
this revision still equals the HEAD revision at the time of calling
svnput.

With this little option, svnput would become as safe as svn commit, and
could therefore (I hope) be integrated into the main svn command.

For extra points, the improved svnput could also offer the user to merge
any changes that have happend between BASE and HEAD into the file that I
supply to stdin, and provide the result on stdout, along with a suitable
exit value code that signals what had happened (e.g., whether the merge
was successfull or whether there has been a conflict). This way, a CGI
editor could quite easily and comfortably handle edit conflicts as well.

How this suggested new function could look like on the command line:

svn put BASE URL

  if the file at URL has currently revision BASE, then overwrite it
  with the file supplied via stdin (such files will typically be edited
  versions of what had before been retrieved with "svn cat -r BASE URL")
  [BASE is here a placeholder for an integer, not the word "BASE"!]

svn put -m BASE URL

  as before, but if the file at URL has currently revision HEAD later
  than BASE, then attempt to merge these changes into the file provided
  via stdin and supply the result at stdout

svn put BASE URL PATH
svn put -m BASE URL PATH

  as before, but use the file at PATH instead of stdin

For even more extra points:

svn put BASE URL PATH URL PATH ...

  as before, but overwrite two or more files as part of the same transaction
  (if it fails, perhaps call "svn put --dry-run -m BASE URL" individually for each
  file to get help with the merge)

Markus

-- 
Markus Kuhn, Computer Laboratory, University of Cambridge
http://www.cl.cam.ac.uk/~mgk25/ || CB3 0FD, Great Britain
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-09-05 19:27:45 CEST

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.