[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Finding shallowest instance of $foo in a given structure
From: |
RB |
Subject: |
Finding shallowest instance of $foo in a given structure |
Date: |
Tue, 18 Mar 2008 15:44:22 -0600 |
I've presented myself with an interesting (to me) problem that I can't
seem to address with find; an alternative would be a trivially short
script, but I'm being stubborn for the moment. I'll try to make this
short.
In tracking multiple OSS projects, I've collected a src/ directory
full of various repositories I'd like to keep up-to-date.
Unfortunately, there is little standardization on either VCS or code
tree hygeine, and synchronizing them all is growing both
time-consuming and tiresome. In short, I'm looking for a clean way to
find the shallowest 'CVS', '.svn', or what have you in a given
directory structure without ignoring sibling directories. If a
project publishes multiple trees (trunk, branch, etc.) with no common
VCS parent, it's difficult to cleanly categorize and/or store them
without causing headaches, and for obvious reasons, I'm not up for
starting source-management wars with a dozen different maintainers.
I've nearly gotten where I want with -prune but only in a crufty
manner (i.e. 'find ${PWD} -type d ! -name . -exec [ -e "{}/.svn" ] \;
-print -prune') that makes searching large, heterogeneous trees
painful (no need to search .git repositories for .svn or CVS). It
seems like I'm just not seeing the obvious, that there's a right way
to do this in an efficient and elegant manner. I've experimented with
several variations, but most either print every $foo in the structure
or ignore siblings (project/trunk/$foo, project/branches/$foo), or
even worse depend on brittle -maxdepth and -mindepth statements. I
could group projects in directories according to VCS instead of
category, or any number of other similarly ugly hacks, but believe
there should be a better way.
Random conjecture here: what if -prune would accept an integer
argument (0 as a default) as a representative of how many parent
directories to actually prune? Would that be a viable pursuit, or is
there a better way to do what I'm trying?
Thanks for your time!
RB
- Finding shallowest instance of $foo in a given structure,
RB <=
- Re: Finding shallowest instance of $foo in a given structure, Bob Proulx, 2008/03/19
- Re: Finding shallowest instance of $foo in a given structure, RB, 2008/03/19
- Re: Finding shallowest instance of $foo in a given structure, Bob Proulx, 2008/03/19
- Re: Finding shallowest instance of $foo in a given structure, James Youngman, 2008/03/19
- Re: Finding shallowest instance of $foo in a given structure, RB, 2008/03/19
- Re: Finding shallowest instance of $foo in a given structure, James Youngman, 2008/03/19
- Re: Finding shallowest instance of $foo in a given structure, Bob Proulx, 2008/03/19
- Re: Finding shallowest instance of $foo in a given structure, RB, 2008/03/20
- Re: Finding shallowest instance of $foo in a given structure, James Youngman, 2008/03/20