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/10 22:22:41 UTC

Help: deleting package roots in eclipse broke svn

I've a number of Java Eclipse projects organized in the usual fashion:

	workspace
		project1
			src
				edu
					virtualschool
						...
		project2
			src
				edu
					virtualschool
						...
Each project is checked into subversion in the usual fashion, as 
separate directories.

Problem is, the edu and virtualschool package directories showed as 
empty in eclipse so I deleted them in the package browser, not 
thinking of the fact that subversion sees them as directories, not 
java packages, and expects to find a .svn directory there. So 
checkins fail with Working copy ...workspace/project1/src/edu not 
locked errors.

How to recover from this self-inflicted wound?
-- 
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

Best practices: living with .svn?

Posted by Brad Cox <bc...@virtualschool.edu>.
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: Help: deleting package roots in eclipse broke svn

Posted by Brad Cox <bc...@virtualschool.edu>.
That wasn't so bad. Thanks!!

At 8:41 PM -0500 4/10/04, Ben Collins-Sussman wrote:
>The only thing you can do is delete the entire 'edu' directory ('rm 
>-rf edu), and run 'svn up' to have that whole sub-tree re-added by 
>the subversion server.
>
>If you have irreplaceable data somewhere within that sub-tree 
>(either important unversioned data, or locally edited versioned 
>data), then carefully move it out beforehand, and move it back in 
>after the update.


-- 
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: Help: deleting package roots in eclipse broke svn

Posted by Ben Collins-Sussman <su...@collab.net>.
Brad Cox wrote:


> Note src and src/edu/virtuascool/jwaa have .svn directories, src/edu and 
> src/edu/virtualschool do not.
>

So eclipse destroyed the .svn/ directories in two of the intermediate 
folders in your tree.

Answer:  you're screwed.  There's no way to get those administrative 
areas back.

The only thing you can do is delete the entire 'edu' directory ('rm -rf 
edu), and run 'svn up' to have that whole sub-tree re-added by the 
subversion server.

If you have irreplaceable data somewhere within that sub-tree (either 
important unversioned data, or locally edited versioned data), then 
carefully move it out beforehand, and move it back in after the update.


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

Re: Help: deleting package roots in eclipse broke svn

Posted by Brad Cox <bc...@virtualschool.edu>.
Nope, didn't work

cd workspace/jwaa
svn up
Working copy src/edu not locked

The problem isn't how to recover src/edu and src/edu/virtualschool 
per se (they're empty except for numerous subdirectories, which still 
contain the needed files). The problem is how to get svn to recognize 
the subdirectories.

I know; the relationship between Java packages and Unix directories 
is confusing, especially with IDE's like eclipse in the middle, doing 
their level best to obscure things.

Perhaps this will make it clear.

cd workspace/jwaa
ls -Ra src
src:
.  ..  edu  log4j.properties  META-INF  .svn

src/edu:
.  ..  virtualschool

src/edu/virtualschool:
.  ..  jwaa

src/edu/virtualschool/jwaa:
.                         GenericServlet.java   StringUtil.java
..                        GenericURI.java       .svn
AccountAbstraction.java   IgnorableFault.java   swing

...and so forth

Note src and src/edu/virtuascool/jwaa have .svn directories, src/edu 
and src/edu/virtualschool do not.

Ideas?

At 5:47 PM -0500 4/10/04, Ben Collins-Sussman wrote:
>Brad Cox wrote:
>
>>I've a number of Java Eclipse projects organized in the usual fashion:
>>
>>     workspace
>>         project1
>>             src
>>                 edu
>>                     virtualschool
>>                         ...
>>         project2
>>             src
>>                 edu
>>                     virtualschool
>>                         ...
>>Each project is checked into subversion in the usual fashion, as 
>>separate directories.
>>
>>Problem is, the edu and virtualschool package directories showed as 
>>empty in eclipse so I deleted them in the package browser, not 
>>thinking of the fact that subversion sees them as directories, not 
>>java packages, and expects to find a .svn directory there. So 
>>checkins fail with Working copy ...workspace/project1/src/edu not 
>>locked errors.
>>
>>How to recover from this self-inflicted wound?
>
>I'm not sure I understand.  You deleted directories that are under 
>version control, and want them to come back?  Just run 'svn up'.


-- 
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: Help: deleting package roots in eclipse broke svn

Posted by Ben Collins-Sussman <su...@collab.net>.
Brad Cox wrote:

> I've a number of Java Eclipse projects organized in the usual fashion:
> 
>     workspace
>         project1
>             src
>                 edu
>                     virtualschool
>                         ...
>         project2
>             src
>                 edu
>                     virtualschool
>                         ...
> Each project is checked into subversion in the usual fashion, as 
> separate directories.
> 
> Problem is, the edu and virtualschool package directories showed as 
> empty in eclipse so I deleted them in the package browser, not thinking 
> of the fact that subversion sees them as directories, not java packages, 
> and expects to find a .svn directory there. So checkins fail with 
> Working copy ...workspace/project1/src/edu not locked errors.
> 
> How to recover from this self-inflicted wound?

I'm not sure I understand.  You deleted directories that are under 
version control, and want them to come back?  Just run 'svn up'.


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