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)
 
|-
 
|-
| svn log ^/ || log the full revision history for this repository
+
| svn log ^/ || list the full revision history for this repository
 
|-
 
|-
 
| svn merge -r HEAD:''<revision>'' ''[file]'' || reset a file to the state it was in at ''<revision>''
 
| svn merge -r HEAD:''<revision>'' ''[file]'' || reset a file to the state it was in at ''<revision>''

Revision as of 10:36, 29 August 2012

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)
svn log ^/ list the full revision history for this repository
svn merge -r HEAD:<revision> [file] reset a file to the state it was in at <revision>

SVN+SSH using a specific identity

export SVN_SSH="ssh -i /home/attie/.ssh/custom.id_rsa"

Extracting a Sub-Tree

Extract an SVN subtree - Import into Git
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 -re "s#^(Node(-copyfrom)?-path): $EXTRACT_PATH#\\1: #" > relocated
 
svnadmin create ./freshRepo
 
cat relocated | svnadmin load --ignore-uuid ./freshRepo

Dump a remote repository

svnadmin create localrepo
 
cat << EEOF > localrepo/hooks/pre-revprop-change
#!/bin/bash
exit 0
EEOF
 
chmod +x localrepo/hooks/pre-revprop-change
 
svnsync init --username $USERNAME file://`pwd`/localrepo $REMOTE_REPO
 
svnsync sync --username $USERNAME file://`pwd`/localrepo
 
svnadmin dump ./localrepo > dump
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox