Re: Converting output of 'svnlook tree' to canonical format
Bart Robinson <[email protected]> Mon, 6 Feb 2006 15:22:16 -0800 (PST)
| Newsgroups | gmane.comp.version-control.subversion.devel,gmane.mail.eyebrowse.user |
|---|---|
| Message-ID | <17383.55848.861244.86458__24387.3207284652$1139268226$gmane$org@bas.flux.utah.edu> |
svnlook in 1.3 has a --full-paths option that I think does what you want. Also svn ls -R does something similar but will also work on a remote repository. -- bart On 2006-2-6 Carl Spalletta <[email protected]> wrote: > Excuse me for reinventing the wheel, but I couldn't find an > existing script to convert output of 'svnlook tree' to the > usual unix format. > > Hope this is useful to somebody. > > Please give credit if you use the logic or code somewhere. > > #!/usr/bin/perl -n > #Copyright (c) 2006 by Carl Spalletta [email protected] under GPL, v2 > #This file takes the output of unix or svnlook 'tree' command, eg: > # > # trunk/ > # CVS-LEGACY/ > # cvswrappers > # checkoutlist > # PROJ1/ > # config > # branches/ > # ... > # > # And turns it into this: > # > #trunk/ > #trunk/CVS-LEGACY/ > #trunk/CVS-LEGACY/cvswrappers > #trunk/CVS-LEGACY/checkoutlist > #trunk/PROJ1/config > #branches/ > # ... > > BEGIN > { > $level=0; > $olevel=-1; > } > > #count number of leading spaces > sub countlevels > { > my $line = shift; > my @ltrs = split "",$line; > my $levels; > > for($levels=0;$levels<=$#ltrs;$levels++) > { > last unless $ltrs[$levels] =~ /^ $/; > } > > return $levels; > } > > #chomp,print,next if /^\S/; > if(/^\S/) > { > if(m{^/}) > { > chomp; > print "$_"; > } > else > { > die "Extraneous garbage: $_"; > } > next > } > > $level = countlevels $_; > if($level<$olevel) > { > for($i=$level;$i<$olevel;$i++) > { > $l[$i]=""; > } > } > > $l[$level-1]=$_; > print "$line\n"; > > $line = join "/",@l; > > $line =~ s/\s//g; > $line =~ tr/\///s; > > $olevel=$level; > > END > { > print "$line\n"; > }