p4_unmanaged
bill fumerola
billf at mu.org
Tue Nov 23 07:50:03 GMT 2004
On Mon, Nov 22, 2004 at 06:55:46PM +0300, Roman Kurakin wrote:
> That were the question. I was sure that this should be possible, since
> this is important
> for most (but probably only free) projects. I hoped that I just didn't
> find it.
>
> So it is imposible.
impossible? that sounds pretty bleak.
the attached perl script landed in my lap one day.
usage:
$ p4differ //depot/vendor/foo_orig/... //depot/projects/foo/...
--
- bill fumerola / fumerola at yahoo-inc.com / billf at FreeBSD.org
-------------- next part --------------
#!/usr/bin/perl
# new usage: ./p4patch
# Usage: p4 diff2 -du base_view your_view
use POSIX qw(strftime);
$ENV{P4DIFF} = qw%-I'\$FreeBSD: .* \$'%;
$src_base = $ARGV[0];
$dst_base = $ARGV[1];
$cmd = "p4 diff2 -du $src_base $dst_base";
open(P, "$cmd |") || die $!;
$time = localtime();
$time = strftime "%a %b %e %H:%M:%S %Y", localtime;
$time = strftime "%Y/%m/%d %T", localtime;
while (<P>) {
next if /- <none> =/;
($f1, $f2, $r) = m|^==== (.+) - (.+) ==== ?(.*)| or print, next;
next if $r eq 'identical';
$src_base =~ s%\/\.\.\..*%%g;
$dst_base =~ s%\/\.\.\..*%%g;
$src_base =~ s%(.*)src/.*%$1src%g;
$dst_base =~ s%(.*)src/.*%$1src%g;
#print "XXX - $src_base\n";
($src, $srcrev) = ($f1 =~ m|$src_base/([^#]*)#(\d+)|);
($dst, $dstrev) = ($f2 =~ m|$dst_base/([^#]*)#(\d+)|);
print "Index: $dst\n";
print '=' x 75 . "\n";
if ($r eq '') {
$file = "/tmp/_p4patch.$$";
`p4 print -q $f2 > $file`;
print `diff -I'\$FreeBSD: .* \$' -Nc /dev/null $file | sed "s#$file#$dst#"`;
`rm -f /tmp/_p4patch.$$`;
next;
}
print "--- $src\t$time\t#$srcrev\n";
print "+++ $dst\t$time\n";
}
More information about the trustedbsd-cvs
mailing list