Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update a file in SVN?

Tags:

svn

Can anyone tell me the command for updating a file in the SVN repository. The file is already imported, I just want to modify the changes.

The file is main.css and the filepath /home/weblab/public_html/cake_1_2/app/webroot/css.

Can someone give me the exact command?

like image 976
Angeline Avatar asked Jun 03 '09 08:06

Angeline


2 Answers

I'm guessing that you have used "svn import" to get the files into the repository. If that is the case, then your local file on disk is not part of a working copy and you will not be able to "svn commit" it.

In order to verify this, run svn info from the directory your code is in. If it says: svn: '.' is not a working copy, your current directory is not a working copy.

What you then need to do is:

  1. svn checkout your project from the repository to a local working copy (temporary directory).
  2. copy your changes to the existing files over the working copy
  3. svn commit those changes.

After you've done that, rename the original project location (where you were working now) and move the working copy in it's place. You can now svn commit as normal from your working copy.

If the folder you use now is called: /home/username/myproject and the working copy is called /tmp/workingcopy. Then you could type the following:

  1. mv /home/username/myproject /home/username/myproject.old
  2. mv /tmp/workingcopy /home/username/myproject

Now continue your work in /home/username/myproject, you can delete myproject.old if you are sure all of your code is in the svn repository

like image 136
Gerco Dries Avatar answered Oct 13 '22 01:10

Gerco Dries


There's three ways to interpret your question:

  1. You only have the file in a subversion repository, and you want to modify its contents
  2. You have the file both in a repository and on disk, no changes done yet, and you want to modify its contents both places
  3. You have the file both in a repository and on disk, the file on disk contains changes, and you want to update the repository version with those changes

If the first, you need to first check out the file to a working copy on disk, then you move on to case 2.

If the second, you need to modify the file on disk with the changes, and then move on to case 3.

If the third, you need to commit the changes to the repository.

You do this with your chosen Subversion client. If this is the command line, a typical command looks like this:

svn ci -m "Text that describes the changes that were done"

The real problem here though is that you don't know how to use Subversion. I would find a Subversion tutorial and play around with it, create a temporary repository and put files into it, play around with the commit, checkout, revert, log, etc. commands to get a feel for how the system works.

like image 44
Lasse V. Karlsen Avatar answered Oct 13 '22 00:10

Lasse V. Karlsen