Subversion: Difference between revisions

No edit summary
m Text replacement - "<(\/?)source" to "<$1syntaxhighlight"
 
(One intermediate revision by one other user not shown)
Line 2: Line 2:


{{highlight|
{{highlight|
|text = if you need help [[Git/migrating to git|migrating to git]] then call Greg Rundlett at eQuality-Tech.com }}
|text = if you need help [[Git/migrating to git|migrating to git]] then call Greg Rundlett at {{CompanyName}} }}


==See Also==
==See Also==
Line 62: Line 62:
=== Migrating a repo from one host to another ===
=== Migrating a repo from one host to another ===
To start with, do a dump of the repo
To start with, do a dump of the repo
<source lang="bash">
<syntaxhighlight lang="bash">
svnadmin dump /var/svn/oasis > /home/me/svndump-2006-12-20
svnadmin dump /var/svn/oasis > /home/me/svndump-2006-12-20
</source>
</syntaxhighlight>
Since the dump file is a human-readable format, it can be compressed considerably.  In our case, the uncompressed file is 9GB, so compression is a big timesaver for sending it across the wire.  You could compress it in transit using rsync's -z option, or you could use gzip or bzip to compress and decompress on the fly.
Since the dump file is a human-readable format, it can be compressed considerably.  In our case, the uncompressed file is 9GB, so compression is a big timesaver for sending it across the wire.  You could compress it in transit using rsync's -z option, or you could use gzip or bzip to compress and decompress on the fly.
<source lang="bash">
<syntaxhighlight lang="bash">
tar cf - ./svndump-2006-12-20 | gzip -9 | ssh grundlett@10.21.20.10 tar xzf - -C /home/grundlett
tar cf - ./svndump-2006-12-20 | gzip -9 | ssh grundlett@10.21.20.10 tar xzf - -C /home/grundlett
</source>
</syntaxhighlight>




Line 175: Line 175:
=== Deleting untracked files ===
=== Deleting untracked files ===
Say your project spews build artifacts into your source tree, and doesn't clean up after itself.  How do you clean out your working copy without having to do a clean checkout?
Say your project spews build artifacts into your source tree, and doesn't clean up after itself.  How do you clean out your working copy without having to do a clean checkout?
<source lang="bash">
<syntaxhighlight lang="bash">
svn status -no-ignore | grep -e ^\? -e ^I | awk '{ print $2 }' | xargs --no-run-if-empty rm -r
</syntaxhighlight>
 
=== Last Week's svn Log ===
<syntaxhighlight lang="bash">
svn -vr {$(date --iso-8601 --date="last week")}:HEAD log http://code.example.com/svn/project/trunk/
</syntaxhighlight>
 
=== Add a bunch of new files ===
<syntaxhighlight lang="bash">
svn status . | grep '^?' | sed  's/^? */svn  add "/g' | sed 's/$/"/g' | sh
</syntaxhighlight>
 
=== Find in svn ===
Old versions of Subversion would store metadata throughout the working copy, and offers no facility for searching the content.  While you could and should setup a [[Search|fantastic indexing service]], you
<syntaxhighlight lang="bash">
find . -name \.svn/ -prune -o -name '*.php' -exec grep -l needle {} \; | sed 's/^/# /'
</syntaxhighlight>
 


svn status -no-ignore | grep -e ^\? -e ^I | awk '{ print $2 }' | xargs --no-run-if-empty rm -r
</source>


[[Category:Version Control]]
[[Category:Version Control]]