On Mon, Apr 19, 2010 at 3:29 PM, KARR, DAVID (ATTSI) <dk0...@att.com> wrote:

> I'm considering writing a script which (among other things) can iterate
> through all the valid revisions for an element.  I'm trying to figure
> out the best way to do that.  I could easily just start at "1" up to the
> latest revision number, and just check for errors on each one, but that
> seems pretty painful.  Is there a straightforward way to get a list of
> valid revision numbers for an element?  I would like the ability to
> start at the beginning and iterate to the latest, and also start at the
> latest and iterate to the earliest.
>
> This would be done in a Bash or Perl script.
>

Why can't you take a "log" of that element? That'll give you all the
revisions on which that element changed. You can do a "--stop-on-copy" to
prevent from going further back in time. You can even use the "--xml" flag
and parse the output that way. This will give you a list of all the
revisions where the file was changed. The truth is that even if the element
didn't change, it is still a valid revision. For example, if the first
revision is 193, and the last revision is 14,320, I can easily assume that
revision 193 through 14,320 are valid revisions for that element.

By the way, "svn log" can work both ways: From first to last or from last to
first. It all depends how you list the releases:

$ svn log 1:HEAD $element   #List from first to last
$ svn log HEAD:1 $element   #List from last to first.

BTW, notice that the element doesn't need a revision 1 for the above
commands to work. It'll merely list the first revision of that element.


-- 
David Weintraub
qazw...@gmail.com

Reply via email to