SVN

From Attie's Wiki
(Difference between revisions)
Jump to: navigation, search
m
m
Line 17: Line 17:
 
| svn revert ''[file]'' || revert file(s)
 
| svn revert ''[file]'' || revert file(s)
 
|}
 
|}
 +
 +
===Extracting a Sub-Tree===
 +
This section will show you how to extract a sub-tree from one repository, and make it the base of a new repository.
 +
 +
* First, extract ''everything'' in the repository (do not strip the revisions)
 +
* Filter the path you wish to keep
 +
* At this point, you must remove the <code>Node-path: support/doc</code> directory add item, which will become the root
 +
* Change the path to the base
 +
* Create a fresh repository
 +
* Load the filtered & relocated dump into the new repository
 +
 +
<source lang="bash">
 +
EXTRACT_PATH="support/doc"
 +
 +
svnadmin dump ./firstRepo > extracted
 +
 +
cat extracted | svndumpfilter include --drop-empty-revs --renumber-revs $EXTRACT_PATH > filtered
 +
 +
cat filtered | awk "BEGIN{p=1}{
 +
                if (p == 1) {
 +
                    if (\$0 == \"Node-path: $EXTRACT_PATH\") p = 0;
 +
                    if (p == 1) print \$0
 +
                } else {
 +
                  if (\$0 == \"PROPS-END\") p = 1
 +
                }}" > filtered2
 +
 +
cat filtered2 | sed -e "s#^Node-path: $EXTRACT_PATH#Node-path: #" > relocated
 +
 +
svnadmin create ./freshRepo
 +
 +
cat relocated | svnadmin load --ignore-uuid ./freshRepo
 +
</source>

Revision as of 16:38, 17 November 2011

My svn cheat sheet! See my git cheat sheet

command description
svn co <path> checks out a copy of the project
svn up retrieves the latest version of the project
svn ci commits any changes
svn pe property edit... see below for examples
svn pe svn:ignore . add items to the ignore list
svn revert [file] revert file(s)

Extracting a Sub-Tree

This section will show you how to extract a sub-tree from one repository, and make it the base of a new repository.

  • First, extract everything in the repository (do not strip the revisions)
  • Filter the path you wish to keep
  • At this point, you must remove the Node-path: support/doc directory add item, which will become the root
  • Change the path to the base
  • Create a fresh repository
  • Load the filtered & relocated dump into the new repository
EXTRACT_PATH="support/doc"
 
svnadmin dump ./firstRepo > extracted
 
cat extracted | svndumpfilter include --drop-empty-revs --renumber-revs $EXTRACT_PATH > filtered
 
cat filtered | awk "BEGIN{p=1}{
                 if (p == 1) {
                    if (\$0 == \"Node-path: $EXTRACT_PATH\") p = 0;
                    if (p == 1) print \$0
                 } else {
                   if (\$0 == \"PROPS-END\") p = 1
                 }}" > filtered2
 
cat filtered2 | sed -e "s#^Node-path: $EXTRACT_PATH#Node-path: #" > relocated
 
svnadmin create ./freshRepo
 
cat relocated | svnadmin load --ignore-uuid ./freshRepo
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox