Subversion: Difference between revisions
m Text replacement - "<(\/?)source" to "<$1syntaxhighlight" |
|||
| (3 intermediate revisions by one other user not shown) | |||
| Line 1: | Line 1: | ||
This page is about 'Subversion' which is more commonly known as svn. | |||
{{highlight| | |||
|text = if you need help [[Git/migrating to git|migrating to git]] then call Greg Rundlett at {{CompanyName}} }} | |||
==See Also== | ==See Also== | ||
* [[Google:{{PAGENAME}}]] | * [[Google:{{PAGENAME}}]] | ||
* '''[[:Category:{{PAGENAME}}]]''' | * '''[[:Category:{{PAGENAME}}]]''' | ||
* [[Subversion/client]] | * [[Subversion/client]] | ||
* [[Subversion/Vendor Sources]] | * [[Subversion/Vendor Sources]] | ||
| Line 9: | Line 13: | ||
==Architecture== | ==Architecture== | ||
[[File:Subversion.architecture.diagram.png]] | |||
==Documentation and Resources== | ==Documentation and Resources== | ||
| Line 58: | 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 | ||
< | <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 | ||
</ | </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. | ||
< | <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 | ||
</ | </syntaxhighlight> | ||
| Line 168: | Line 172: | ||
file:///var/svn/myrepo/www.example.com/trunk/images/smile1.png | file:///var/svn/myrepo/www.example.com/trunk/images/smile1.png | ||
</pre> | </pre> | ||
=== 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? | |||
<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> | |||
[[Category:Version Control]] | [[Category:Version Control]] | ||