Tag Archive for 'ignore'

Subversion Properties: Ignore Patterns

When working on your Apache Subversion project with SmartSVN, you may include items in your working copy that do not need to be placed under version control. While it’s possible to include unversioned items in your working copy, these items will continue to clutter up your Subversion dialogs, e.g the commit dialog:

The ‘Ignore Patterns’ property can be used to explicitly state which file patterns should be ignored within a directory. This helps the user filter out items that shouldn’t be under version control, and prevents Subversion from repeatedly asking whether these should be included in your Subversion activities.

To apply the ‘Ignore Patterns’ property:

1) Open the ‘Properties’ menu and select ‘Ignore Patterns…’

2) Enter the names of the files you wish to ignore. You can also use the * wildcard to instruct Subversion to ignore all files that:

  •  End with a certain file extension (*.png, *.txt, *.class)
  • Contain certain keywords (test_*, draft*)
  • Or alternatively, you can opt to ignore all files (*)

3) By default, only the patterns in the selected directory are ignored. Open the ‘Depth’ drop-down menu to view the other available options:

  • Only file children
  • Immediate children (files and directories)
  • Fully recursive (applies patterns to all subdirectories)

Remember, you can claim your 30 day free trial of SmartSVN Professional now. Want to find out more about Subversion Properties? There’s still time to register for our free ‘Subversion Properties‘ webinar. 

 

Adding and Removing Files in SmartSVN for Windows

When working with SmartSVN, sooner or later you’ll need to add and remove files from your project. In this article, we show you how to add a file to SmartSVN and place it under version control, before demonstrating how to remove a file from the repository. Finally, we cover adding a file to SmartSVN’s ignore list, which is useful when you need to include a file in your project without placing it under version control.

Adding a File in SmartSVN

1) Outside of SmartSVN, select the file you wish to add and drop it into the working copy on your local machine.

 

 

 

 

 

 

2) Open your working copy with SmartSVN. The new file will appear as an unversioned item. Select the file, followed by the ‘Add’ button. Alternatively, you can right-click the unversioned file and select ‘Add.’

 

 

 

 

 

 

3) Commit your change back to the repository to make it permanent.

 

 

 

 

 

 

4) Don’t forget to add an appropriate log message!

 

 

 

 

 

 

 

Removing Files in SmartSVN

If you can add files, at some point you will need to remove them.

1) Select the file you wish to remove and click SmartSVN’s ‘Remove’ button. Alternatively, right-click the file you wish to remove and select the ‘Remove’ option.

 

 

 

 

 

 

2) In the subsequent dialog, select whether you wish to remove the file from version control, which will schedule the item for removal, or remove the control and also delete it locally.

In this example, we’ll choose to delete the file locally. Select ‘Remove.’

 

 

 

 

 

 

3) Commit your changes back to the repository to make them permanent.

Note, if you have opted to delete the file locally, it will disappear from both your working copy and the repository at this point.

Adding a File to SmartSVN’s Ignore List

If you have added a file to your working copy but don’t want to place it under version control, it may be worth adding to SmartSVN’s ignore list. This will prevent you from receiving a notification about the unversioned file every time you perform a commit.

To add a file to SmartSVN’s ignore list:

1) Select the file you wish to ignore.
2)
Open the ‘Modify’ menu and click ‘Ignore…’
3)
Choose either ‘Explore Explicitly,’ which will add the selected file/directory to the ignore list, or ‘Ignore As Pattern’ which instructs SmartSVN to ignore all files with a certain naming convention.
4)
Select ‘Ok’ to add the file(s) to SmartSVN’s ignore list.

Tip. If you cannot access the ‘Ignore’ option, check you are not attempting to ignore a previously committed file. You can only ignore unversioned files.

Remember that a free download of SmartSVN Foundation is available. Simply visit http://smartsvn.com/ to get started. 

 

SmartSVN: Set or Delete Property

‘Properties’ in Apache Subversion are useful for associating metadata with files under version control. In this post, we’ll begin to look at how properties can be used in SmartSVN, by exploring the ‘Set or Delete Property…’ option.

Remember, you can download your free edition of SmartSVN Foundation at http://smartsvn.com/

1) Open the ‘Properties’ menu and select the ‘Set or Delete Property’ option.

 

 

 

 

 

2) Open the ‘Property’ drop down menu to see the available Subversion internal properties. These are:

  • svn:eol-style – used to determine the processing that should be performed on a file. This property is useful for when commits are being made with different operating systems.
  • svn:executable – can be used to control a versioned file’s filesystem-level execute permission bit.
  • svn:externals – used to define or change externals.
  • svn:ignore – contains a list of file patterns that Subversion operations should ignore.
  • svn:keyword – instructs Subversion to substitute ‘keywords’ into the files themselves. These keywords could be a revision number, the name of the person who last changed the file, or other useful information.
  • svn:mergeinfo – used to query information related to merges.
  • svn:mime-type –  determines some of Subversion’s behavioral characteristics, and serves as a place to store a file’s MIME classification.
  • svn:needs-lock – if this property is set, the local copy of a locked file is automatically made read-only unless the user owns the lock in question.

 

 

 

 

 

 

 

 

 

 

3) From this screen, you can either set or delete a property. In this example, we’ll remove all explicit mergeinfo from our project. To achieve this, select svnmergeinfo and select the ‘Delete Property’ checkbox.

 

 

 

 

 

 

 

 

 

 

4) Select ‘Ok’ to remove the mergeinfo.

Note. This is a basic example of using Properties in SmartSVN. More information is available at WANdisco’s SmartSVN docs.

Catch up on the rest of our intro to SmartSVN series:

Getting More Out of Version Control

So, you’ve downloaded Apache Subversion and have mastered the standard workflow – but this is just the start of what the world’s most popular version control system has to offer! In this post, we’ll dig a little deeper into Subversion and provide an overview of five features that can help you get even more out of version control, including discovering who is responsible for a specific change, and reverting to a previous version of your project.

1. Hook Scripts

Hook scripts are essentially programs that are triggered by a specific repository event. Usually, hook scripts are server side, but it’s also possible to run client side hook scripts. Hook scripts can be configured to perform the following tasks:

    • Reporting on events (e.g emailing alerts when a commit occurs.)
    • Testing for a pre-condition before allowing a commit (e.g checking a commit is accompanied by a log message)
    • Blocking certain actions (e.g blocking a commit that contains multi-gigabyte files)

 

The hooks subdirectory is automatically created along with each new repository. By default, the hook files are saved as non-executable templates (.tmpl) To make changes to these files, you simply open them as text-based documents, enter the new text, and save the file in a new format. This format is different for each operating system, for example, in Windows, the format can be either .exe or .bat.

Need some more help getting started with hook scripts? Our ‘Introduction to Subversion Hook Scripts on Windows’ has a handy example of a pre-commit hook.

2. SVN Blame

Sometimes, you just need someone to blame! Subversion’s ‘blame’ command does exactly this: it displays each line of a particular file, along with who changed each line, and in which revision it was changed. This is obviously useful for pin-pointing who is responsible for bugs and broken code, but it can also be useful for finding out who you need to contact for more information about a particular part of your code.

To find out who is to blame for a particular change, right-click on the file in question and select ‘Blame’ from the TortoiseSVN menu.

In the TortoiseSVN dialog, select the revisions you wish to review, and click ‘Ok.’

This will bring up the TortoiseBlame dialog, where you can see the changes that were made to the file in each revision, and who is responsible for each change.

For more information on a particular revision, hover over that revision and a tooltip will appear displaying the revision’s log message.

3. SVN:Ignore

Sometimes, there will be files in your working copy that don’t need to be placed under version control (you own notes, or a To Do checklist, for example) In these instances, Subversion’s ‘Ignore’ property can be used. Simply create/drag-and-drop the new file into your working copy, right-click to bring up the ‘TortoiseSVN’ sub-menu, select ‘Add to ignore list’ and select the file you wish to ignore.

This file will then be added to the ‘ignore’ list, and will not be accidentally committed back to the repository when you perform an ‘SVN Commit.’

4. Reverse Merge

Subversion remembers every change that’s made to its files and directories; a potential life-saver if you introduce a code-breaking feature in revision 12, and need to revert to a revision before it all went wrong. Recovering previous revisions in Subversion, is simply a matter of performing a reverse merge i.e merging the changes in your current revision, to an earlier revision. To perform a reverse merge with TortoiseSVN:

1) Select ‘Merge’ from the TortoiseSVN menu.
2) Select the ‘Merge a range of revisions’ option.
3) Select the revision you wish to revert to. Ensure the ‘Reverse merge’ option is selected.

4) The following dialog will present you with a number of options for merging – in most instances the default settings can be used. Click ‘Merge’ and Subversion will roll back to revision 11. Note, that the reverse merge only affects your working copy, so you must perform an ‘SVN Commit’ to commit your changes back to the repository.

5. Revert Command

Less drastic than a reverse merge, the revert command overwrites any local changes made to the working copy, with the code held in the repository, including any property changes and any scheduling operations that may have been set on the working copy. However, this command should be used with care: the revert command replaces all the changes made since your last commit, and once they are gone there is no way to recover them.

Need more help with your Apache Subversion installation? Every Monday, we’ll be publishing a new Tip of the Week at our blog, so keep checking back every week for all the latest tips!