Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Hello, Ovid.

    The fact that your script only works if the cwd is file's directory kind of frustate me, as I normally work on the root dir of the project.

    Here is a patch to make it work wherever the cwd is.

    --- svn_revisions.pl.ovid    2008-12-22 10:59:09.000000000 -0400
    +++ svn_revisions.pl    2008-12-22 11:12:55.000000000 -0400
    @@ -2,6 +2,7 @@

    use strict;
    use warnings;
    +use File::Basename qw(dirname);

    my $file = shift || die "You must supply a filename to $0";

    @@ -28,7 +29,8 @@
    }

    sub branch_name {
    -    chomp(my @svn_info = qx(svn info .));
    +    my $dir = dirname($file);
    +    chomp(my @svn_info = qx(svn info $dir));
         my ($branch_name) = $svn_info[1] =~ m{/([^/]+)\z};
         return $branch_name;
    }