my $key = shift;
# Ensure our variable exist
- if ( defined($ENV{$key}) ) {
+ if ( defined($ENV{$key}) ) {
# Ensure we don't get empty variables
- if ( length($ENV{$key}) > 0 ) {
+ if ( length($ENV{$key}) > 0 ) {
return $ENV{$key};
- }
- }
+ }
+ }
return undef;
}
close C;
$new =~ s/\s+$//;
- open I, "< $new/skel.ChangeLog"
+ open I, "< $new/skel.ChangeLog"
or die "Can't open $new/skel.ChangeLog for input: $!\n";
{ local $/ = undef; $text = <I>; }
close I;
push @conflicts, $1;
next;
}
-
+
push @conflicts, $1;
next;
} elsif (/^\?\s+(\S+)/) {
} else {
push @unknown, $1;
}
-
+
$actions{$1} = '+';
next;
} elsif (/^([ARMD])\s+\+?\s*(\S+)/) {
my ($status, $filename) = ($1,$2);
-
+
if($vcs eq "git") {
open P, "git rev-parse --sq --show-prefix |";
my $prefix = <P>;
$prefix = substr($prefix, 0, -1);
close P;
-
+
if ($filename =~ /$prefix(\S*)/) {
$filename = $1 ;
}
next;
}
}
-
+
if( -d $filename ) {
next;
}
-
+
push @files, $filename;
($actions{$filename} = $status) =~ tr/DARM/-+-/d;
}
# Ignore empty directories - git doesn't version them and cvs removes them.
if ( (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) && ! -d _ ) {
open C, $vcs." status $_ 2>&1 1>/dev/null |";
-
+
while (<C>) {
$_ = <C>;
push @unknown, $object;
};
-
+
close C;
};
}
# compare suffix number
return +5 if defined $sna and !defined $snb;
return -5 if defined $snb and !defined $sna;
-
+
if (defined $sna) { # and defined $snb
$retval = ($sna <=> $snb);
return $retval if $retval;
#
return +6 if defined $ra and !defined $rb;
return -6 if defined $rb and !defined $ra;
-
+
if (defined $ra) { # and defined $rb
return ($ra <=> $rb);
}
if ($vcs eq "git") {
my $version = $2;
-
+
while (<C>) {
last if /^deleted file mode|^index/;
if (/^new file mode/) {
mypush(@files, $1);
mypush(@new_versions, $2);
}
-
+
$_ = <C>;
}
}
unlink('ChangeLog.new') if -f 'ChangeLog.new';
}
}
-
+
unless ($editor) {
print "Please type the log entry: use Ctrl-d to finish, Ctrl-c to abort...\n";
local $/ = undef;
if (@new_versions) {
# Insert at the top with a new version marker
$text =~ s/^( .*? ) # grab header
- \s*\n(?=\ \ \d|\*|\z) # suck up trailing whitespace
+ \s*\n(?=\ \ \d|\*|\z) # suck up trailing whitespace
/"$1\n\n" .
join("\n", map "*$_ ($date)", reverse @new_versions) .
"\n\n$entry\n\n"/sxe