# while we are within range
if ($cur) {
- if (m|^\.\.\. (//depot/.+?#\d+) add$|) {
+ if (m|^\.\.\. (//depot/.+?#\d+) (add|branch)$|) {
my $newfile = $1;
push @addfiles, $newfile;
warn "$newfile add, revision != 1!\n" unless $newfile =~ /#1$/;
my $addfile;
my $ret = "";
for $addfile (@addfiles) {
- my $type = `p4 -p $p4port files $addfile`;
+ my $type = `p4 -p $p4port files '$addfile'`;
if ($?) {
- warn "$0: `p4 -p $p4port print $addfile` failed, status[$?]\n";
+ warn "$0: `p4 -p $p4port print '$addfile'` failed, status[$?]\n";
next;
}
$type =~ m|^//.*\((.+)\)$| or next;
$ret .= "\n==== $addfile ($type) ====\n\n";
next;
}
- my @new = `p4 -p $p4port print $addfile`;
+ my @new = `p4 -p $p4port print '$addfile'`;
if ($?) {
- die "$0: `p4 -p $p4port print $addfile` failed, status[$?]\n";
+ die "$0: `p4 -p $p4port print '$addfile'` failed, status[$?]\n";
}
my $desc = shift @new; # discard initial description
$ret .= "\n==== $addfile ($type) ====\n\n";
$lines = "" if @new < 2;
$ret .= "\@\@ -0,0 +1$lines \@\@\n";
$ret .= join("+","",@new);
+ $ret .= "\n\\ No newline at end of file\n" if $ret !~ /\n$/;
}
@addfiles = ();
return $ret;