Summary: Tidy up CIL.pm (and others) of formatting
-Status: New
+Status: Finished
CreatedBy: Andrew Chilton <andychilton@gmail.com>
AssignedTo: Andrew Chilton <andychilton@gmail.com>
+Label: Milestone-v0.06
+Comment: 5fe9eaea
Inserted: 2010-01-23T11:40:50
-Updated: 2010-01-23T11:41:50
+Updated: 2010-01-23T12:42:28
This includes:
# save the settings for various bits of info
foreach my $key ( keys %$defaults ) {
# if we have been passed it in, use it, else use the default
- $self->$key( $cfg->{$key} || $defaults->{$key} );
+ $self->$key( $cfg->{$key} || $defaults->{$key} );
}
return $self;
}
sub dir_exists {
my ($self, $dir) = @_;
- return $self->vcs_revision
+ return $self->vcs_revision
? $self->vcs->dir_exists($self->vcs_revision, $dir)
: -d $dir
;
my ($self, $filename, $last_field) = @_;
if ( $self->vcs_revision ) {
- my $fh = $self->vcs->get_fh($self->vcs_revision, $filename);
- CIL::Utils->parse_from_fh($fh, $last_field);
+ my $fh = $self->vcs->get_fh($self->vcs_revision, $filename);
+ CIL::Utils->parse_from_fh($fh, $last_field);
}
else {
- CIL::Utils->parse_cil_file($filename, $last_field);
+ CIL::Utils->parse_cil_file($filename, $last_field);
}
}
sub save {
- my ($self, $filename, $data, @fields) = @_;
+ my ($self, $filename, $data, @fields) = @_;
if ( $self->vcs_revision ) {
confess "tried to ->save on alternate revision";
}
else {
- CIL::Utils->write_cil_file( $filename, $data, @fields );
+ CIL::Utils->write_cil_file( $filename, $data, @fields );
}
}
# only support globbing the last element
my ($dir, $pattern) = $path =~ m{^([^\*]*/)([^/]*)$}
- or croak "unsupported pattern '$path'";
+ or croak "unsupported pattern '$path'";
$pattern =~ s{([\\\.])}{\\$1}g;
$pattern =~ s{\*}{.*}g;
my @match;
for ( $self->git->command("ls-tree", $rev, $dir) ) {
chomp;
my ($blobid, $path) = m{([0-9a-f]{40})\s+(.*)} or die;
- if ( $path =~ m{^\Q$dir\E$pattern$} ) {
- push @match, $path;
- }
+ if ( $path =~ m{^\Q$dir\E$pattern$} ) {
+ push @match, $path;
+ }
}
@match;
}