snipt

Ctrl+h for KB shortcuts

Bash

Remove all .svn folders on a directory

find . -type d -name .svn -exec rm -rf {} +
https://snipt.net/embed/8678ce1e40b2a0d9f56e824f8470f665/
/raw/8678ce1e40b2a0d9f56e824f8470f665/
8678ce1e40b2a0d9f56e824f8470f665
bash
Bash
1
2019-05-28T06:44:13
True
False
False
/api/public/snipt/39417/
remove-all-svn-folders-on-a-directory
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>find . -type d -name .svn -exec rm -rf <span class="o">{}</span> + </span></pre></div> </td></tr></table>
bash, svn

Bash

Add all the new svn files at once

svn status | grep "^?" | awk '{print $2}' | xargs svn add
https://snipt.net/embed/cf7e32e54cfe6423fd3d164544f2c9b7/
/raw/cf7e32e54cfe6423fd3d164544f2c9b7/
cf7e32e54cfe6423fd3d164544f2c9b7
bash
Bash
1
2019-06-25T00:38:54
True
False
False
/api/public/snipt/38619/
add-all-the-new-svn-files-at-once
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>svn status <span class="p">|</span> grep <span class="s2">&quot;^?&quot;</span> <span class="p">|</span> awk <span class="s1">&#39;{print $2}&#39;</span> <span class="p">|</span> xargs svn add </span></pre></div> </td></tr></table>
awk, grep, svn, xarg

Bash

Recursively Delete .svn Directories

find . -name .svn -print0 | xargs -0 rm -rf
https://snipt.net/embed/ee4fb7c2e9b017b999acc4d03248ce26/
/raw/ee4fb7c2e9b017b999acc4d03248ce26/
ee4fb7c2e9b017b999acc4d03248ce26
bash
Bash
2
2019-06-25T09:27:08
True
False
False
/api/public/snipt/38408/
recursively-delete-svn-directories-3
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>find . -name .svn -print0 <span class="p">|</span> xargs -0 rm -rf </span></pre></div> </td></tr></table>
svn

Bash

Get all SVN commiters from a Working Copy

svn log | ruby -e "puts STDIN.read.split(/\n/).select{|l| l =~ /^r\d+/}.map{|l| l.split('|')[1].strip}.uniq.sort"
https://snipt.net/embed/2b8f6f6971e5658584cab7f46a553bde/
/raw/2b8f6f6971e5658584cab7f46a553bde/
2b8f6f6971e5658584cab7f46a553bde
bash
Bash
1
2019-06-24T18:21:36
True
False
False
/api/public/snipt/36852/
get-all-svn-commiters-from-a-working-copy
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>svn log <span class="p">|</span> ruby -e <span class="s2">&quot;puts STDIN.read.split(/\n/).select{|l| l =~ /^r\d+/}.map{|l| l.split(&#39;|&#39;)[1].strip}.uniq.sort&quot;</span> </span></pre></div> </td></tr></table>
bash, commiters, ruby, svn

Text only

svn checksum error fix

1
2
3
4
5
    make a backup of the working copy in a different directory
    delete only the corrupted directory from your working copy
    make an svn update
    copy back only the modified files you need from the backup copy to the current working copy
    commit your changes
https://snipt.net/embed/b177fb19a3f52dee6f9e024e9d70a5a3/
/raw/b177fb19a3f52dee6f9e024e9d70a5a3/
b177fb19a3f52dee6f9e024e9d70a5a3
text
Text only
6
2019-06-25T04:32:13
True
False
False
/api/public/snipt/36432/
svn-checksum-error-fix
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a> make a backup of the working copy in a different directory </span><span id="L-2"><a name="L-2"></a> delete only the corrupted directory from your working copy </span><span id="L-3"><a name="L-3"></a> make an svn update </span><span id="L-4"><a name="L-4"></a> copy back only the modified files you need from the backup copy to the current working copy </span><span id="L-5"><a name="L-5"></a> commit your changes </span></pre></div> </td></tr></table>
svn

Bash

Review each SVN version controlled file with meld which has been modified

1
2
3
4
5
svn st | grep '^M' | sed 's/^M       //g;' | xargs -L 1 meld
sed: simpele search and replace
xargs (3): view every file in meld, one at a time (-L 1)

Note: the match may differ: s/^M      //g;
https://snipt.net/embed/ffc7bb31907cdc9c3b1d93dee453fdf3/
/raw/ffc7bb31907cdc9c3b1d93dee453fdf3/
ffc7bb31907cdc9c3b1d93dee453fdf3
bash
Bash
5
2019-06-26T22:46:54
True
False
False
/api/public/snipt/35937/
review-each-svn-version-controlled-file-which-has-been-modified-with-meld
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>svn st <span class="p">|</span> grep <span class="s1">&#39;^M&#39;</span> <span class="p">|</span> sed <span class="s1">&#39;s/^M //g;&#39;</span> <span class="p">|</span> xargs -L <span class="m">1</span> meld </span><span id="L-2"><a name="L-2"></a>sed: simpele search and replace </span><span id="L-3"><a name="L-3"></a>xargs <span class="o">(</span>3<span class="o">)</span>: view every file in meld, one at a <span class="nb">time</span> <span class="o">(</span>-L 1<span class="o">)</span> </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a>Note: the match may differ: s/^M //g<span class="p">;</span> </span></pre></div> </td></tr></table>
diff, meld, svn

Bash

Reverse a commit

svn merge -r:73:68 http://my.repository.com/my/project/trunk
https://snipt.net/embed/c35bacb6fbe6ffc3be185c3da6938c64/
/raw/c35bacb6fbe6ffc3be185c3da6938c64/
c35bacb6fbe6ffc3be185c3da6938c64
bash
Bash
1
2019-06-24T19:15:48
True
False
False
/api/public/snipt/33915/
reverse-a-commit
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>svn merge -r:73:68 http://my.repository.com/my/project/trunk </span></pre></div> </td></tr></table>
svn

Text only

Revert a faulty change SubVersion

1
2
3
4
5
6
7
8
Suppose you have changes that turned out to be broken, but stuff that works
has been committed since. This can fix it:

svn merge -r 673:669 https://host/svn/project/trunk

669 is the version just before the broken stuff was committed and 673 is the start of stuff that works. So The change between revision 669 and 673 is reverted and applied.

don't forget to commit this.
https://snipt.net/embed/ea107abcf34d1f57d7c1002256ce589e/
/raw/ea107abcf34d1f57d7c1002256ce589e/
ea107abcf34d1f57d7c1002256ce589e
text
Text only
8
2019-06-27T01:35:03
True
False
False
/api/public/snipt/33579/
revert-a-faulty-change-subversion
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>Suppose you have changes that turned out to be broken, but stuff that works </span><span id="L-2"><a name="L-2"></a>has been committed since. This can fix it: </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a>svn merge -r 673:669 https://host/svn/project/trunk </span><span id="L-5"><a name="L-5"></a> </span><span id="L-6"><a name="L-6"></a>669 is the version just before the broken stuff was committed and 673 is the start of stuff that works. So The change between revision 669 and 673 is reverted and applied. </span><span id="L-7"><a name="L-7"></a> </span><span id="L-8"><a name="L-8"></a>don&#39;t forget to commit this. </span></pre></div> </td></tr></table>
subversion, svn

MuPAD

check syntax of all php files before an svn commit

for i in `svn status | egrep '^(M|A)' | sed -r 's/\+\s+//' | awk '{ print $2 }'` ; do if [ ! -d $i ] ; then php -l $i ; fi ; done
https://snipt.net/embed/e51cba722b07c0cc5a071d1fcd32b95f/
/raw/e51cba722b07c0cc5a071d1fcd32b95f/
e51cba722b07c0cc5a071d1fcd32b95f
mupad
MuPAD
1
2019-06-26T18:15:12
True
False
False
/api/public/snipt/30883/
check-syntax-of-all-php-files-before-an-svn-commit
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="k">for</span> <span class="nv">i</span> <span class="ow">in</span> <span class="nv">`svn status | egrep &#39;^(M|A)&#39; | sed -r &#39;s/\+\s+//&#39; | awk &#39;{ print $2 }&#39;`</span> <span class="o">;</span> <span class="k">do</span> <span class="k">if</span> <span class="p">[</span> <span class="o">!</span> <span class="o">-</span><span class="nv">d</span> <span class="o">$</span><span class="nv">i</span> <span class="p">]</span> <span class="o">;</span> <span class="k">then</span> <span class="nv">php</span> <span class="o">-</span><span class="nv">l</span> <span class="o">$</span><span class="nv">i</span> <span class="o">;</span> <span class="nv">fi</span> <span class="o">;</span> <span class="nv">done</span> </span></pre></div> </td></tr></table>
bash, php, subversion, svn