Sometimes, especially when you work cross various projects, you need to modify a single file in a project. A good example for this updating pom.xml by adding description, name, SCM or CI sections.
However majority of UI tools do not provide a possibility to extract a single file, avoiding checking out all its siblings recursively. Commands of CLI enable this, but they are not well known.
The idea is to checkout the containing folder with ’empty’ depth and then update the file you are interested in. For simplicity of use, I wrote a shell script, which take the URI to the file is SVN, and extracts it to the current directory. The URI of the file can be copied from a browser. The script is also available in Bitbucket
10 | usage=$"This scripts extract single file /folder from SVN repository into the current directory,\n\ |
11 | allowing to modify it locally without extracting all other sibling files and directories\n\ |
16 | [ "$#" - ge 1 ] || die "SVN URI is not provided. $usage" |
20 | svnRun=` which svn 2> /dev/null` |
23 | die "svn CLI is not found on PATH" |
28 | svnParent=${fullUri%%/${svnFile}} |
35 | svn checkout -q --depth=empty $svnParent . |
39 | After $svnFile is changed locally commit it using\n\ |
40 | svn commit -m \ "your update description\"" |