Merge branch 'master' of https://rodney.nethack.org:20040/git/NHsource
This commit is contained in:
+35
-4
@@ -13,7 +13,8 @@ my $rawin = 0; # feed diff to stdin for testing (do NOT set $debug=1)
|
|||||||
# this first block because it's expensive and dumpfile() hangs with $rawin.
|
# this first block because it's expensive and dumpfile() hangs with $rawin.
|
||||||
my $sink = ($^O eq "MSWin32") ? "NUL" : "/dev/null";
|
my $sink = ($^O eq "MSWin32") ? "NUL" : "/dev/null";
|
||||||
my $dbgfile = ($^O eq "MSWin32") ? "$ENV{TEMP}.$$" : "/tmp/trace.$$";
|
my $dbgfile = ($^O eq "MSWin32") ? "$ENV{TEMP}.$$" : "/tmp/trace.$$";
|
||||||
open TRACE, ">>", ($debug==0)? $sink : $dbgfile;
|
open TRACE, ">>", $rawin?"/dev/tty":(($debug==0)? $sink : $dbgfile);
|
||||||
|
print TRACE "TEST TRACE\n";
|
||||||
if($debug){
|
if($debug){
|
||||||
print TRACE "START CLIENT ARGV:\n";
|
print TRACE "START CLIENT ARGV:\n";
|
||||||
print TRACE "[0] $0\n";
|
print TRACE "[0] $0\n";
|
||||||
@@ -233,7 +234,7 @@ sub merge_one_line_maybe {
|
|||||||
$theirval = $1;
|
$theirval = $1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
print TRACE "MID: $ourstype/$oursval $theirtype/$theirval\n";
|
||||||
# are we done?
|
# are we done?
|
||||||
if(pos($ours)==length $ours && pos($theirs) == length $theirs){
|
if(pos($ours)==length $ours && pos($theirs) == length $theirs){
|
||||||
$more = 0;
|
$more = 0;
|
||||||
@@ -245,6 +246,12 @@ sub merge_one_line_maybe {
|
|||||||
# now see if ours and their match or can be resolved
|
# now see if ours and their match or can be resolved
|
||||||
# text
|
# text
|
||||||
if($ourstype == 3 && $theirtype == 3){
|
if($ourstype == 3 && $theirtype == 3){
|
||||||
|
#mismatch is \s vs \s\s - where is this coming from?
|
||||||
|
# HACK - hopefully temporary
|
||||||
|
if($oursval =~ m/^\s+$/ && $theirval =~ m/^\s+$/){
|
||||||
|
$out .= $oursval;
|
||||||
|
next;
|
||||||
|
}
|
||||||
if($oursval eq $theirval){
|
if($oursval eq $theirval){
|
||||||
$out .= $oursval;
|
$out .= $oursval;
|
||||||
next;
|
next;
|
||||||
@@ -273,6 +280,7 @@ sub merge_one_line_maybe {
|
|||||||
# return undef if we can't merge the values; $NAME: VALUE $ or $NAME$ (as appropriate) if we can.
|
# return undef if we can't merge the values; $NAME: VALUE $ or $NAME$ (as appropriate) if we can.
|
||||||
sub merge_one_var_maybe {
|
sub merge_one_var_maybe {
|
||||||
my($varname, $oursval, $theirval) = @_;
|
my($varname, $oursval, $theirval) = @_;
|
||||||
|
print TRACE "MVM: -$varname-$oursval-$theirval-\n";
|
||||||
my $resolvedas;
|
my $resolvedas;
|
||||||
{
|
{
|
||||||
no strict;
|
no strict;
|
||||||
@@ -309,12 +317,28 @@ sub Date {
|
|||||||
|
|
||||||
sub Branch {
|
sub Branch {
|
||||||
my($PREFIX, $varname, $mine, $theirs) = @_;
|
my($PREFIX, $varname, $mine, $theirs) = @_;
|
||||||
return "\$$PREFIX-$varname: $mine \$";
|
$mine =~ s/^\s+//; $mine =~ s/\s+$//;
|
||||||
|
$theirs =~ s/^\s+//; $theirs =~ s/\s+$//;
|
||||||
|
return "\$$PREFIX-$varname: $mine \$" if(length $mine);
|
||||||
|
return "\$$PREFIX-$varname: $theirs \$" if(length $theirs);
|
||||||
|
return "\$$PREFIX-$varname\$" if(length $theirs);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub Revision {
|
sub Revision {
|
||||||
my($PREFIX, $varname, $mine, $theirs) = @_;
|
my($PREFIX, $varname, $mine, $theirs) = @_;
|
||||||
return "\$$PREFIX-$varname: $mine \$";
|
my($m) = ($mine =~ m/1.(\d+)/);
|
||||||
|
my($t) = ($theirs =~ m/1.(\d+)/);
|
||||||
|
if($m > 0 && $t > 0){
|
||||||
|
my $q = ($m > $t) ? $m : $t;
|
||||||
|
return "\$$PREFIX-$varname: 1.$q \$";
|
||||||
|
}
|
||||||
|
if($m > 0){
|
||||||
|
return "\$$PREFIX-$varname: 1.$m \$";
|
||||||
|
}
|
||||||
|
if($t > 0){
|
||||||
|
return "\$$PREFIX-$varname: 1.$t \$";
|
||||||
|
}
|
||||||
|
return "\$$PREFIX-$varname\$";
|
||||||
}
|
}
|
||||||
__END__
|
__END__
|
||||||
|
|
||||||
@@ -364,3 +388,10 @@ $TEST-Branch: mine $
|
|||||||
===
|
===
|
||||||
$TEST-Branch: theirs $
|
$TEST-Branch: theirs $
|
||||||
>>> d3
|
>>> d3
|
||||||
|
|
||||||
|
TEST 8:
|
||||||
|
<<< d1
|
||||||
|
/* NetHack 3.5 objnam.c $TEST-Date$ $TEST-Branch$:$TEST-Revision$ */
|
||||||
|
===
|
||||||
|
/* NetHack 3.5 objnam.c $TEST-Date: 1426977394 2015/03/21 22:36:34 $ $TEST-Branch: master $:$TEST-Revision: 1.108 $ */
|
||||||
|
>>> d3
|
||||||
|
|||||||
Reference in New Issue
Block a user