Tip Of The Day: Avoid Forgetting Adding Files To SVN Repository

Loading

If you are using subversion (SVN) for your source code management you may have come across this situation.

  1. You add some files to your working copy
  2. You use the command 'svn add ' to add files to the be versioned
  3. You commit using the command 'svn commit -m "message"'
  4. When other users of your project update their working copy they find some files missing

You forgot to add certain files to the repository. It happens every now and then.

To avoid the situation, check the status of the files and directories of your working copy before committing.

The command

svn status

prints the status of your working copy on the screen.

A sample output of the svn status command looks like this:

[sudheer@localhost trunk]$ svn status
?      application/config/config.ini
?      application/modules/default/views/scripts/test
?      application/data/logo-alpha/logo-alpha.png
?      application/data/pdfimage/side-text.png
X      library/Zend
?      util/scripts/module/Install/MyInstallerValues.php
 
Performing status on external item at 'library/Zend'
[sudheer@localhost trunk]$ 

In the above sample output the first column shows whether the file or directory was added, deleted or modified. It also indicates whether the item is under version control. Files that are present in your working copy and are not under version control are marked with the status character '?'. In our example, the directory application/modules/default/views/scripts/test is not under version control. To add that directory to the repository I can use the command svn add application/modules/default/views/scripts/test and then commit it to the repository.

Remember to check the status of your working copy before commiting.

Here's a quick cheat sheet of the status messages.

' ' no modifications
'A' Added
'C' Conflicted
'D' Deleted
'I' Ignored
'M' Modified
'R' Replaced
'X' item is unversioned, but is used by an externals definition
'?' item is not under version control
'!' item is missing (removed by non-svn command) or incomplete
'~' versioned item obstructed by some item of a different kind

You can find more information about the svn status command by typing

svn help status

You can also read about the topic in the SVN book.

About the author

Sudheer is an entrepreneur and software developer. Get more from Sudheer on Twitter.


Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>. The supported tag styles are: <foo>, [foo].

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.