Tag Archive for 'eol'

SmartSVN’s Project Settings: Properties

You can easily change how SmartSVN handles all your Apache Subversion projects using the popular, cross-platform client’s ‘global preferences’ settings. However, sometimes you’ll want to be more flexible and change SmartSVN’s settings on a per-project basis.

In this post, we take a closer look at the changes you can make to Subversion’s properties, on a project-by-project basis using SmartSVN’S ‘Project Settings’ 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

EOL Style

Subversion doesn’t pay attention to a file’s end-of-line (EOL) markers by default, which can be a problem for teams who are collaborating on a document across different operating systems. Different operating systems use different characters to represent EOL in a text file, and some operating systems struggle when they encounter unexpected EOL markers.

The ‘EOL Style’ option specifies the end-of-line style default for your current project. You can choose from:

  • Platform-Dependent/Native – files contain EOL markers native to your operating system.

  • LF (Line Feed) – files contain LF characters, regardless of the operating system.

  • CR+LF (Carriage Return & Line Feed) – files contain CRLF sequences, regardless of the operating system.

  • CR (Carriage Return) – files contain CR characters, regardless of the operating system.

  • As is (no convention) – this is typically the default value of EOL-style.

The ‘In case of inconsistent EOLs’ allows you to define how SmartSVN should handle files with inconsistent EOLs.

You can more about EOL Style at the ‘Subversion Properties: EOL-Style’ blog post.

EOL Style — Native

Usually, text files are stored with their ‘native’ EOL Style in the Subversion repository. However, under certain circumstances, it might be convenient to redefine what ‘native’ means, for example, when you’re working on a project on Windows but frequently uploading it to a Unix server. Open this dialog and choose from Linux/Unix, Mac or Windows.

Keyword Substitution

Allows you to automatically add ‘keywords’ into the contents of a file itself. These keywords are useful for automatically maintaining information that would be too time-consuming to keep updating manually.

You can choose from:

  • Author – the username of the person who created the revision.
  • Date – the UTC the revision was created (note, this is based on the server’s clock not the client’s.)

  • ID – a compressed combination of the keywords ‘Author,’ ‘Date’ and ‘Revision.’

  • Revision – describes the last revision in which the selected file was changed in the repository.

  • URL – a link to the latest version of the file in the repository.

  • Header – similar to ‘ID,’ this is a compressed combination of the other keywords, plus the URL information.

You can find out more about Keyword Substitution at our ‘Exploring SVN Properties’ post.

Learn more about the other options available in SmartSVN’s ‘Project Settings’ dialog by reading our Subversion Tip of the Week post.

Subversion Tip of the Week

SVN Blame

In certain situations, you may need more information about how a file changed in a particular Apache Subversion revision and crucially, who was responsible for that change. This is achieved by running the ‘svn blame’ command. This command prints each modified line of the specified file, alongside the revision number and the username of the person responsible for that change.

To run the ‘svn blame’ command, enter:

svn blame (repository-URL)/file

svn blame

However, sometimes the change may simply be an arbitrary whitespace or other formatting change. If you suspect this could be the case, the extensions switch (-x) can be used in conjunction with several other switches to filter out arbitrary changes:

  • –ignore-all-space (-w) – ignores all whitespace.
  • –ignore-space-change (-b) – ignores all changes in the amount of whitespace.
  • –ignore-eol-style – ignores changes in end-of-line-style.

In this example, we’re running ‘svn blame’ on the same file, but this time specifying that any EOL changes should be ignored.

svn blame -x –ignore-eol-style (repository-URL)/file

svn blame 2

Looking for an easy-to-use cross platform Subversion client? Claim your free 30 day trial of SmartSVN Professional by visiting: www.smartsvn.com/download

Subversion Tip of the Week

Intro to Automatic Properties 

Properties are a powerful and useful feature of Apache Subversion, but they can be easily overlooked. If you’re regularly using properties in your project, it’s a good idea to configure Subversion to add properties to new files automatically.

Subversion already sets some properties automatically: whenever you add a new file, it sets a value for the MIME type and decides whether the file is executable. You can extend this by leveraging Subversion’s automatic property setting feature “svn:auto-props.” 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 OS.

To enable auto-props:

1) Locate and open the config file on your local machine.

2) Scroll down to the [miscellany] section and uncomment the following line:

# enable-auto-props = yes

auto props

3) Just below this line, edit the ‘Section for configuring automatic properties’ text according to the properties you want to apply to your files.

Subversion Properties: EOL-Style

By default, Apache Subversion doesn’t pay attention to a file’s end-of-line (EOL) markers, which can cause problems if you’re part of a team who are collaborating on a document across different operating systems. Different operating systems use different characters to represent the end of a line in a text file, and some operating systems can struggle when EOL characters do not align with their native EOL style.

There are a few workarounds for this issue, but any workaround that involves performing EOL-related modifications by hand leaves your project open to human error, and makes it difficult to distinguish which changes relate to the EOL workaround, and which actually move the project forward.

This is where the svn:eol-style property is useful. This property allows Subversion to automatically perform the necessary processing on a file, to ensure EOL consistency across operating systems. To leverage svn:eol-style, you must set the property to one of the following valid values:

  • Platform-Dependent/Native – files contain EOL markers native to your operating system.
  • LF – files contain LF characters, regardless of the operating system.
  • CR+LF – files contain CRLF sequences, regardless of the operating system.
  • CR – files contain CR characters, regardless of the operating system.
  • As is (no convention) – this is typically the default value of EOL-style.

To set EOL-Style in SmartSVN:

1) Open the ‘Properties’ menu and select ‘EOL-Style…’

2) In the subsequent dialog, select the new value.

3) When you attempt to change the EOL-style of a file, SmartSVN checks whether the file has consistent line endings. If it doesn’t, SmartSVN will block the EOL-style change. To skip this check and apply the EOL-style change regardless, select ‘Force’ before clicking ‘OK.’

4) Click ‘OK’ to apply the properties change.

Want to learn more about Subversion properties? On December 13th we will be holding a free ‘Subversion Properties’ webinar. It’s free to attend, but places are limited so register now to avoid disappointment.