Tag Archive for 'unlock'

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.”

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: