[svk-devel] "svk info" latency vs. vc-svk.el: pain vs. gain

David Glasser glasser at mit.edu
Fri Aug 4 03:08:06 EDT 2006


On 8/4/06, Chip Salzenberg <chip at pobox.com> wrote:
> Or, perhaps, a minimal 'tinysvk info' program could avoid all the extensive
> module loads but knows enough to just say whether a file is controlled or
> not.  For example, it could load only YAML, look in ~/.svk/config for the
> current svn repo, and then (speculation begins) use 'svn' directly in some
> way to find out whether the given file is currently controlled.

Try this, maybe?

#!/usr/bin/env perl
use strict;
use warnings;
use YAML::Syck;
use Data::Hierarchy 0.30;
use Cwd;

# Doesn't deal with Windows, symlinks, or floating checkouts.

@ARGV <= 1 or die "usage: $0 [filename]\n";

my $file = @ARGV ? $ARGV[0] : '';

my $xd = YAML::Syck::LoadFile("$ENV{HOME}/.svk/config");
my $hierarchy = $xd->{checkout};

my $abs_path = Cwd::abs_path($file);
my $rev = $hierarchy->get($abs_path)->{revision};

if (defined $rev) {
    print "$rev\n";
    exit 0;
} else {
    exit 1;
}


-- 
David Glasser | glasser at mit.edu | http://www.davidglasser.net/


More information about the svk-devel mailing list