💾 Archived View for d.moonfire.us › blog › 2012 › 04 › 28 › an-obsession-with-data-subversion-editio… captured on 2023-07-10 at 15:05:28. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-04-26)

-=-=-=-=-=-=-

An obsession with data (Subversion edition)

Up a Level

Setup

Directives

use strict; use warnings;

Input Process

Since this was all in one Subversion tree, we just pipe “svn log” to

the input.

my $last_timestamp = “undef”; my %files = ();

while () { # Clean up the line and ignore blanks. chomp; next if /^s*$/; # In general, we will have two types of lines. One is in a # timestamp and the other is the name of the file. # rd+ | user | 2010-07-10 21:45:57 -0500 (Sat, 10 Jul 2010) | 1 line if (/(d+)-(d+)-(d+) (d+):(d+):(d+)/) { # We only care about the date of the check-in. $last_timestamp = “$1-$2-$3”; } else { # For everything else, we get a filename. There are a few # things that we frequently ignore, such as hidden files # (start with a period). s/^s+//sg; unless (/^(M|A|D)s+(.*?)$/) { # An unkown line, so skip it. next; }

	# We add the file and the current timestamp to the
	# hash. Since we replace with each one, and `git log` goes
	# backwards in time, the last time we see the file is the
	# point it was first added to the repository.

	# Print out the line.
	my $file = $2;
	$file =~ s/s*(.*?$//;
	$files{$file} = $last_timestamp;
}

}

Now that we are done parsing, we output the merged results.

open REPORT, “>svn.files” or die "Cannot write svn.files ($!)";

foreach my $file (sort(keys(%files))) { # Pull out the date. my $date = $files{$file}; # Keep track if this file exists. my $exists = 0; # They don't exist in this case $exists = 1 if -f “$dir/$file”;

#print "$filet$daten";
#print "$datet$existst$filen";

print REPORT “$filet$existst$daten”; }

close REPORT;

Metadata

Categories:

Programming

Writing

Tags:

Perl

Footer

Below are various useful links within this site and to related sites (not all have been converted over to Gemini).

Now

Contact

Biography

Bibliography

Support

Fiction

Fedran

Coding

The Moonfires

Categories

Tags

Privacy

Colophon

License

Mailing List

https://d.moonfire.us/blog/2012/04/28/an-obsession-with-data-subversion-edition/