6

I am working on a perl script which has to commit a new file every 10 minutes from my hard drive.

I was wondering if it is possible to perform a commit without having the working copy of the project whose commit I want to perform? Is it necessary to have a working copy of that project checked out on my hard drive before performing the commit?

Mat
  • 202,337
  • 40
  • 393
  • 406
vishalkbhatt
  • 83
  • 1
  • 5

5 Answers5

11

If this directory contains many other files with much content, a solution would be to do a shallow checkout.

svn checkout <url> <target> --depth empty
cd <target>
svn up <yourfile>

Edit your file...

svn commit <yourfile>

If you use an older version of subversion, you will probably find what you look for in this post.

Community
  • 1
  • 1
Antoine
  • 5,158
  • 1
  • 24
  • 37
9

If it is a new file you can use the svn import command to directly import it into a particular folder in your repository

http://svnbook.red-bean.com/en/1.5/svn.ref.svn.c.import.html

manojlds
  • 290,304
  • 63
  • 469
  • 417
  • @vishalkbhatt: if this answers your question, you should accept it. (By clicking on the hook below the answer's vote counter) – Antonio Pérez Oct 20 '11 at 09:04
2

Cause you are already in Perl you could use the Subversion Perl Bindings to solve your requirements. Take a look into CPan. It should be possible to do this for a single file. Take a look into the documentation about SVN Modules May be other examples would like SVK (take a look into the source code)

khmarbaise
  • 92,914
  • 28
  • 189
  • 235
  • I got svn import working now..the only problem is the script should run in background and I dont know how to hide the command prompt window which is opened when the script is running the SVN Import command and performing commits.. any ideas guys how to hide is??? – vishalkbhatt Oct 20 '11 at 08:43
  • Then you are working on Windows. There are parameters for the start command ? Or are you doing this via cmd/bat files? – khmarbaise Oct 20 '11 at 08:46
  • I got the problem solved already with following : `code use Win32::OLE; use Win32::GUI; $hw = Win32::GUI::GetPerlWindow(); Win32::GUI::Hide($hw);` – vishalkbhatt Oct 20 '11 at 08:54
1

SVN has a separate command svnmucc for committing to repositories without a checkout. See the docs: http://svnbook.red-bean.com/en/1.8/svn.advanced.working-without-a-wc.html

Chronial
  • 66,706
  • 14
  • 93
  • 99
0

You can commit using Subversion remote API. Here's the example for Java language, but the same API is used in other languages (C, Perl, ...). For Perl bindings SVNRepository class of the example corresponds to SVN::Ra.

Dmitry Pavlenko
  • 8,530
  • 3
  • 30
  • 38