You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Brad Cox <bc...@virtualschool.edu> on 2004/04/11 11:21:10 UTC

Best practices: living with .svn?

It would be a BIG help if people on this list would publish their 
collection of "living with .svn directories" suggestions and scripts, 
hopefully to be migrated  to "the book" someday. I find that 
directory incredibly intrusive since it seriously interferes with 
recursive finds and greps.

#1 on the wish list: what is the svn-friendly way to use grep -r foo 
src to find all the foos in my working src directory, without 
interference from hits in svn's administrative area (.svn). Hopefully 
a global setting somewhere so I don't have to type special commands 
each time. There are hopeful prospects in the man pages but I've not 
yet hit on a working combination.

I'll start the ball rolling with the latest gotcha that bit me 
(thanks to Ben for the solution)

When using eclipse within svn-managed directories, the root 
directories of your package hierarchy will show up as grey empty 
packages. DO NOT USE ECLIPSE TO DELETE THEM. They are not empty as 
far as svn is concerned for they contain svn's administrative (.svn) 
directories. If you do delete them, the only solution is to move the 
package (src) directory aside, run svn update to create a a new (but 
stale) copy, and manually update it with changed files from the copy 
you moved aside.
-- 
Brad J. Cox, PhD, 703 361 4751, http://virtualschool.edu
        http://virtualschool/ale Action Learning Environment
http://virtualschool.edu/mybank Digital Rights Management System
    http://virtualschool.edu/jco Java Cryptographic Objects (JCO)
   http://virtualschool.edu/jwaa Java Web Application Architecture (JWAA)
  http://virtualschool.edu/java+ Java Preprocessor (Java+)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Best practices: living with .svn?

Posted by Kalle Olavi Niemitalo <ko...@iki.fi>.
Glenn Maynard <g_...@zewt.org> writes:

> That's what "--" is for.

I meant a command like "wcgrep regex -- -dirname" should be
transformed to a pipe beginning with "find ./-dirname" because
"find -- -dirname" does not work.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Best practices: living with .svn?

Posted by Glenn Maynard <g_...@zewt.org>.
On Sun, Apr 11, 2004 at 07:26:31PM +0300, Kalle Olavi Niemitalo wrote:
> A pipe like this would avoid that problem:
> 
>   find . -name .svn -prune -or -print0 | xargs -r0 grep -H regex
> 
> However, this is more difficult to wrap with a grep-like syntax:
> the directory (or file) names would have to be separated from
> grep options, and names like -foo would have to be changed to
> ./-foo.

That's what "--" is for.

grep "regex" -- -filename.txt

find -args -print0 | xargs -r0 grep 'regex' --

-- 
Glenn Maynard

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Best practices: living with .svn?

Posted by Kalle Olavi Niemitalo <ko...@iki.fi>.
Stephen Peters <po...@portnoy.org> writes:

> I've made use of 
>   alias rg='grep --exclude=\*.svn\* -r'

In GNU grep 2.5.1, --exclude does not apply to names of
directories.  (See grep-2.5.1/lib/savedir.c.)  Thus, that command
will still search all .svn/README.txt files, among others.

A pipe like this would avoid that problem:

  find . -name .svn -prune -or -print0 | xargs -r0 grep -H regex

However, this is more difficult to wrap with a grep-like syntax:
the directory (or file) names would have to be separated from
grep options, and names like -foo would have to be changed to
./-foo.

I think the cleanest solution would be to patch grep.  It could
take a new "--exclude-dir=.svn" option, or extend the existing
"--exclude=.svn" to affect directories too, or require
"--exclude=.svn/".

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Best practices: living with .svn?

Posted by Brad Cox <bc...@virtualschool.edu>.
Thanks! That explained why my previous shot didn't work. But I don't 
want to retrain my fingers to type rg instead of grep.

Setting $GREP_OPTIONS in ~/.bashrc like this did the trick
	export GREP_OPTIONS="--exclude="\*/.svn/\*"

At 11:41 AM -0400 4/11/04, Stephen Peters wrote:
>Brad Cox <bc...@virtualschool.edu> writes:
>
>>  #1 on the wish list: what is the svn-friendly way to use grep -r foo
>>  src to find all the foos in my working src directory, without
>>  interference from hits in svn's administrative area (.svn). Hopefully
>>  a global setting somewhere so I don't have to type special commands
>>  each time. There are hopeful prospects in the man pages but I've not
>>  yet hit on a working combination.
>
>I've made use of
>   alias rg='grep --exclude=\*.svn\* -r'
>
>And then was able to type
>   rg foo src
>
>--
>Stephen L. Peters                                  portnoy@portnoy.org
>   GPG fingerprint: A1BF 5A81 03E7 47CE 71E0  3BD4 8DA6 9268 5BB6 4BBE
>  "I'm through accepting limits, 'cause someone says they're so.  Some
>   things I cannot change, but 'til I try I'll never know." -- Wicked


-- 
Brad J. Cox, PhD, 703 361 4751, http://virtualschool.edu
        http://virtualschool/ale Action Learning Environment
http://virtualschool.edu/mybank Digital Rights Management System
    http://virtualschool.edu/jco Java Cryptographic Objects (JCO)
   http://virtualschool.edu/jwaa Java Web Application Architecture (JWAA)
  http://virtualschool.edu/java+ Java Preprocessor (Java+)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Best practices: living with .svn?

Posted by Stephen Peters <po...@portnoy.org>.
Brad Cox <bc...@virtualschool.edu> writes:

> #1 on the wish list: what is the svn-friendly way to use grep -r foo
> src to find all the foos in my working src directory, without
> interference from hits in svn's administrative area (.svn). Hopefully
> a global setting somewhere so I don't have to type special commands
> each time. There are hopeful prospects in the man pages but I've not
> yet hit on a working combination.

I've made use of 
  alias rg='grep --exclude=\*.svn\* -r'

And then was able to type
  rg foo src

-- 
Stephen L. Peters                                  portnoy@portnoy.org
  GPG fingerprint: A1BF 5A81 03E7 47CE 71E0  3BD4 8DA6 9268 5BB6 4BBE
 "I'm through accepting limits, 'cause someone says they're so.  Some
  things I cannot change, but 'til I try I'll never know." -- Wicked

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Best practices: living with .svn?

Posted by Max Bowsher <ma...@ukf.net>.
Brad Cox wrote:
> It would be a BIG help if people on this list would publish their
> collection of "living with .svn directories" suggestions and scripts,
> hopefully to be migrated  to "the book" someday. I find that
> directory incredibly intrusive since it seriously interferes with
> recursive finds and greps.

There is a wcgrep script in contrib.


Max.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org