Tag Archive for 'lock'

Subversion Tip of the Week

SmartSVN’s Project Settings Menu 

SmartSVN’s ‘global preferences’ is a method of specifying settings across all your SmartSVN projects for efficiency and simplicity. However, sometimes you need to change settings for a single project, which is where the ‘Project Settings’ menu comes in handy.

In this week’s tip, we’ll look at some of the SmartSVN settings you can apply using this menu.

Accessing Project Settings

To access SmartSVN’s Project Settings, open the ‘Project’ menu and select ‘Settings.’ The different options are listed on the dialog box’s left-hand side.

project settings

1) Text File Encoding

This affects how file contents are presented. Choose from:

  • Use system’s default encoding – SmartSVN uses the system’s encoding when displaying files. This is the default setting for SmartSVN.

  • Use the following encoding – Select your own encoding from the dropdown menu. This is useful if you’re dealing with international characters, which may otherwise be encoded incorrectly.

Note, if you’ve specified a file type using the MIME-Type property, SmartSVN will choose this over the text file encoding settings.

2) Refresh/Scan

SmartSVN can either scan the ‘whole project’ or the ‘root directory only’ when you open a project. In most instances, you’ll want to scan the entire project, but if you’re working with particularly large repositories, the ‘root directory only’ option can speed up this initial scan and avoid high memory consumption.

3) Working Copy

Clicking on ‘Working Copy’ presents you with several checkboxes:

working copy

  • (Re)set to Commit-Times after manipulating local files – tells SmartSVN to always use a local file’s internal Apache Subversion property commit-time. This is useful for ensuring consistency across timezones, and between clients and the Subversion repository.

  • Apply auto-props from SVN ‘config’ file to added files – tells SmartSVN to use the auto-props from the SVN ‘config’ file. With auto-props enabled, you can perform tasks such as automatically inserting keywords into text files and ensuring every file has EOLs that are consistent with the operating system. Not only are auto-props a time-saving feature, but they can help you avoid human error within your project.

  • Keep input files after merging (monitored merge) – tells SmartSVN to always keep the .aux files following a merge, even for non-conflicting files. These files are stored in the ‘merged’ state and can be used to gain a deeper insight into what has changed during the merge.

4) Locks

Apache Subversion is built around a ‘copy-modify-merge’ model, but there are times when a ‘lock-modify-unlock’ model may be appropriate, for example when you’re working on image files, which cannot easily be merged. SmartSVN has full support for locking and unlocking files, but if you’re going to make heavy use of locks, you can configure SmartSVN to automatically flag certain files as requiring locking before anyone begins working on them. This is a useful reminder, especially if your project contains multiple non-mergeable files. Open the ‘Lock’ section of the Project Settings dialog and select either ‘all binary files’ or ‘every file,’ if required. The default is ‘no file.’

You can also choose whether SmartSVN should suggest releasing or keeping locks whenever you perform a commit, which is a helpful reminder if your team are working with multiple locks. Finally, the ‘Automatically scan for locks’ option tells SmartSVN to scan for locked files at specified intervals.

Find out more about locks by reading our ‘Locking and Unlocking in SmartSVN’ blog post.

5) Conflicts

When SmartSVN encounters conflicts, it adds new extensions to the conflicting files to help distinguish between them. By default, SmartSVN will take its cues from the config file, but if you want to specify particular extensions, you can select ‘Use following extensions’ and type the desired extensions into the textbox.

Remember, you can download your free edition of SmartSVN Professional at www.smartsvn.com/download

Subversion Properties: Needs Lock

Apache Subversion is built around a ‘copy-modify-merge’ model, but there are times when a ‘lock-modify-unlock’ model may be appropriate (for example, when you are working on image files, which cannot easily be merged.) Once you’ve mastered locking and unlocking, you may want to look at Subversion’s dedicated lock property, which is useful to help prevent time wasted working on files that have already been locked by others.

If present on a file, the ‘Needs Lock’ property reminds users that they should lock the file before starting work on it. The SmartSVN Subversion client automatically sets files which require locking (due to this property) to read-only when checking out or updating. When a lock token is present, the file becomes read/write. This prevents users from making changes that are difficult to merge, on a file that is also being edited in another working copy (for example, two users simultaneously editing an image file.)

To add this property to a file using SmartSVN, select a file and click the ‘Change Needs Lock’ option in SmartSVN’s ‘Locks’ menu.

smartsvn needs lock

SmartSVN will automatically add this property to the selected file.

smartsvn properties change

To remove the ‘Needs Lock’ property, repeat the process: selecting ‘Change Needs Lock’ for a file that already contains this property, will remove the property instead.

Looking for a cross-platform graphical client for Apache Subversion? Claim your free 30 day trial at www.smartsvn.com/download


Subversion Tip of the Week

Locking Files from the Subversion Command Line

Apache Subversion is built around the ‘copy-modify-merge’ model, but you can enforce a ‘lock-modify-unlock’ model if necessary. This can be useful when you’re editing files that cannot be easily merged, for example image files or large binary files.

Creating a Lock

To create a lock, use the ‘svn lock’ command followed by the location and name of the file you wish to lock:

svn lock (working-copy-path/filename)

Keep your colleagues in the loop by adding a log message explaining why you have locked the file. Log messages can be added using the -m switch:

svn lock (working-copy-path/filename) -m “log message”

In this example, we are locking an image file called ‘Logo’ with the log message “Working on logo.”

You can now make changes to the file on your local machine, confident that no one else is committing changes to the repository. Once you have finished modifying the file, you can unlock it using the ‘svn unlock’ command:

svn unlock (working-copy-path/filename)

In this example, we are unlocking the ‘Logo’ file from earlier:

Tip: when you commit back to the repository all locks are automatically released as part of the commit transaction. If you wish to commit without releasing any locks you can use the ‘–no-unlock’ switch to explicitly tell Subversion to maintain the locks:

svn commit –no-unlock (working-copy-path) -m “log message”

In this example we are committing to the repository without lifting the lock, and with the log message “initial draft of logo.”

Getting More out of Version Control with SmartSVN

In our previous SmartSVN posts, we covered essential functionality to get you off to a flying start with this cross-platform graphical client for Apache Subversion. In this post, we cover some more advanced options, including performing a reverse merge, reverting local changes and resolving any conflicts that occur when you try to perform a commit with SmartSVN.

Didn’t catch our intro to SmartSVN series? Get up to speed with the following links:

Reverse Merge

As Subversion remembers every change that’s committed to the repository, it’s possible to revert to previous revisions of your project. This is useful if you introduce a code-breaking feature in revision 15, and need to revert to a revision before it all went wrong. This is achieved by performing a ‘reverse merge’ i.e merging the changes in your current revision, to an earlier revision.

To perform a reverse merge with SmartSVN:

1) Select the ‘Merge’ item from the ‘Modify’ menu.

2) In the Merge dialog, enter the revision number you wish to roll back to.








If you need more information about the different revisions, click the ‘Select…’ button next to the ‘Revision Range’ textbox. The subsequent dialog displays the different revisions, alongside the commit message, time, author and path data for each revision. Note, the green arrows indicate revisions not yet merged.








3) Ensure the ‘Reverse merge’ checkbox is selected and finally, click ‘Merge.’

4) Remember to commit your changes to the repository, to make this reverse merge permanent!

Alternatively, right-click the revision you wish to reverse-merge in the Transactions tool window and select “Rollback.”


Revert overwrites any local changes made to the working copy, with the file content held in the repository. Note, this command should be used with caution: a revert effectively deletes all the changes made since your last commit, and once they are gone there is no way to recover them.

To perform a revert with SmartSVN, right-click on the file/directory you wish to revert, and select the ‘Revert’ option from the drop-down menu  (alternatively, select the ‘revert’ button from the toolbar.)








SmartSVN will ask you to confirm the revert. Select the ‘Revert’ button to go ahead and remove all your local changes.






At some point during your project’s lifecycle, your repository may change location and therefore get a new URL. This can be solved by deleting your working copy and performing a checkout from the new repository location, but there is a quicker way to solve this problem: the ‘Relocate’ command can be used to rewrite all the URLs associated with the files and folders in your working copy, with the new URLs. This allows you to continue using your current working copy and, of course, to successfully commit all your hard work back to the repository.

1) Open the ‘Modify’ menu and select ‘Relocate…’

2) The ‘Relocate’ dialog displays the URL of the selected directory. In the ‘To URL’ option, specify the replacement URL.







3) Select ‘Relocate’ to change the repository for your directory.

Note, this operation should be used with caution, as if used incorrectly it can corrupt your working copy. The ‘Relocate’ command should not be used to:

  • move to a different Subversion repository.
  • switch to a different branch or directory within the same repository.

Resolving Conflicts

When you are performing a commit in Apache Subversion, you may occasionally encounter the dreaded Subversion conflict, and your commit will fail. Thankfully, SmartSVN comes with a ‘conflict solver’ to help resolve these conflicts when they do occur. To access this conflict solver, open the ‘Query’ menu and select ‘Conflict solver.’











In the ‘Mark Resolved’ dialog, you can opt to:

  • Leave the file/directory as it is.
  • Take the version in the working copy, as it was before the update or merge was performed.
  • Take the new version – the pristine copy after the update or merge was performed.
  • Take the old version – the pristine copy before the update or merge was performed.
Select the appropriate checkbox and select ‘Ok.’ The conflict should now be resolved, and you can commit your changes to the repository to make them permanent.
Set a Property
‘Properties’ in Subversion are useful for associating metadata with the files placed under version control. To set a property for your Subversion files or directories using SmartSVN, open the ‘Properties’ menu and click ‘Select or delete Property….’
Use the drop-down ‘Property’ menu to select the desired Subversion internal property. The default properties are:
  • svn:eol-style – makes the client convert line-endings in text files. This property is used when the working copy is required in a specific EOL style.
  • svn:executable – makes files on Unix-hosted working copies executable.
  • svn:externals – a multi-line value defined on a directory that allows parts of other repositories to be automatically checked out.
  • svn:ignore – a list of unversioned filename patterns that should be ignored by ‘svn status’ and other subcommands.
  • svn:keywords – Subversion has the ability to substitute keywords into the contents of a file itself when changes are made. Keywords are useful for automatically maintaining information (such as author, revision number, etc) that would be too time-consuming to keep changing by hand.
  • svn:mergeinfo – this property is used to track merge data and is automatically maintained by the ‘SVN merge’ command.
  • svn:mime-type – indicates the file’s MIME type and allows the client to decide if contextual merging is safe during updates. Note, this property affects the handling of diffs and merging.
  • svn:needs-lock – tells the client that files should be checked out with permissions set to read-only. This is designed to be used in conjunction with the ‘SVN Lock’ command, to remind the developer to obtain a lock before beginning work on a file. This saves the developer from spending time modifying a file and then discovering it’s locked when it’s time to commit.

Select a value for your property (if applicable) and hit the ‘Ok’ button to set the new property.

Visit http://smartsvn.com/ to claim your free download of SmartSVN Foundation.

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:

Locking and Unlocking in SmartSVN

Apache Subversion is built around a ‘copy-modify-merge’ model, but there are times when a ‘lock-modify-unlock’ model may be appropriate (for example, when you are working on image files, which cannot easily be merged.) In this latest post in our SmartSVN series, we’ll show you how to quickly and easily lock and unlock a file.

If you don’t already have SmartSVN installed, you can download the free SmartSVN Foundation edition from http://smartsvn.com/

How to Lock Files in SmartSVN

1) Select the file you wish to lock.







2) Select the ‘Lock’ button.





3) Enter an appropriate message explaining why you have decided to lock the file, and click ‘Lock.’










How to Unlock Files in SmartSVN

If you lock files, at some point you will need to unlock them. To unlock a file in SmartSVN:

Select the file you wish to unlock and click the ‘Unlock’ button.





2) Confirm you wish to unlock the file (or alternatively, tick the ‘Break locks’ checkbox if this is someone else’s lock!)





You have now successfully unlocked the file!

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

WANdisco Announces Free Webinars for SVN Community

We hope you’re enjoying our bi-weekly free Subversion webinars! Thank you to everyone who has attended and sent us feedback on what they enjoyed, and what they’d like to see more of. Based on your feedback, we’ve devised another set of free training webinars for the Subversion community.

Here’s what’s coming up over the next couple of months (don’t forget, it’s free to register for any of our Apache Subversion webinars):

1) Hidden Subversion – get ahead of the game, as we share some tricks and techniques that many Subversion users aren’t even aware of.

2) Locking – we cover the Subversion Lock command in detail, including:

  • What is a lock?
  • How do you lock and unlock files?
  • Best practices for avoiding lock conflicts

3) Using Repository Browsers – drill down into the functionality of the Repo Browser, in this one-hour course.

4) Subversion Difference Command – get an overview of the various ways Subversion can compare files and generate meaningful reports.

5) Hook Scripts – these server-side executables can be used for a variety of tasks, including:

  • Automatic email notifications
  • Checkin content validation
  • Automatic backup
  • Specific access control

6) Introduction to uberSVN – an introductory webinar for uberSVN, the open ALM platform for Apache Subversion that’s easy to install, easy to use and easy to extend. This webinar will cover uberSVN’s core capabilities, including:

  • Installation and setup
  • Simplified repository creation and management
  • Team and user administration
  • Social coding capabilities
  • Extendibility with your favorite ALM tools

7) Access Control option with Subversion – need to control access to Apache Subversion repo information, but not sure which option is right for you? This session will weigh up the pros and cons of:

  • Subversion Access Control
  • Hook Scripts
  • uberSVN
  • …and more!

8 ) Branching and Merging – get an intro to the basic concepts of branching and merging, including when to perform a merge and create a branch, the different merge types, and some all-important best practices.

9) Subversion Properties – everything you need to know about SVN Properties! This one hour course will cover:

  • Defining properties
  • Property and “Standards and Procedures”
  • Property name rules
  • Automatic Properties
  • Recursively defining properties
  • ….and more!

Places are limited, so register now to avoid disappointment! And don’t forget to Contact Us if you have any comments, questions or suggestions for future webinars!