cvsserver status: provide real sticky info

Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Matthew Ogilvie 2012-10-13 23:42:23 -06:00 committed by Junio C Hamano
parent bed8a19743
commit abd66f2207
2 changed files with 55 additions and 4 deletions

View File

@ -502,7 +502,7 @@ sub req_Entry
#$log->debug("req_Entry : $data");
my @data = split(/\//, $data);
my @data = split(/\//, $data, -1);
$state->{entries}{$state->{directory}.$data[1]} = {
revision => $data[2],
@ -1681,9 +1681,25 @@ sub req_status
print "M Repository revision:\t" .
$meta->{revision} .
"\t$state->{CVSROOT}/$state->{module}/$filename,v\n";
print "M Sticky Tag:\t\t(none)\n";
print "M Sticky Date:\t\t(none)\n";
print "M Sticky Options:\t\t(none)\n";
my($tagOrDate)=$state->{entries}{$filename}{tag_or_date};
my($tag)=($tagOrDate=~m/^T(.+)$/);
if( !defined($tag) )
{
$tag="(none)";
}
print "M Sticky Tag:\t\t$tag\n";
my($date)=($tagOrDate=~m/^D(.+)$/);
if( !defined($date) )
{
$date="(none)";
}
print "M Sticky Date:\t\t$date\n";
my($options)=$state->{entries}{$filename}{options};
if( $options eq "" )
{
$options="(none)";
}
print "M Sticky Options:\t\t$options\n";
} else {
print "M Repository revision:\tNo revision control file\n";
}

View File

@ -38,6 +38,25 @@ not_present() {
fi
}
check_status_options() {
(cd "$1" &&
GIT_CONFIG="$git_config" cvs -Q status "$2" > "${WORKDIR}/status.out" 2>&1
)
if [ x"$?" != x"0" ] ; then
echo "Error from cvs status: $1 $2" >> "${WORKDIR}/marked.log"
return 1;
fi
got="$(sed -n -e 's/^\s*Sticky Options:\s*//p' "${WORKDIR}/status.out")"
expect="$3"
if [ x"$expect" = x"" ] ; then
expect="(none)"
fi
test x"$got" = x"$expect"
stat=$?
echo "cvs status: $1 $2 $stat '$3' '$got'" >> "${WORKDIR}/marked.log"
return $stat
}
cvs >/dev/null 2>&1
if test $? -ne 1
then
@ -233,6 +252,22 @@ test_expect_success 'cvs co another copy (guess)' '
marked_as cvswork2/subdir newfile.c ""
'
test_expect_success 'cvs status - sticky options' '
check_status_options cvswork2 textfile.c "" &&
check_status_options cvswork2 binfile.bin -kb &&
check_status_options cvswork2 .gitattributes "" &&
check_status_options cvswork2 mixedUp.c -kb &&
check_status_options cvswork2 multiline.c -kb &&
check_status_options cvswork2 multilineTxt.c "" &&
check_status_options cvswork2/subdir withCr.bin -kb &&
check_status_options cvswork2 subdir/withCr.bin -kb &&
check_status_options cvswork2/subdir file.h "" &&
check_status_options cvswork2 subdir/file.h "" &&
check_status_options cvswork2/subdir unspecified.other "" &&
check_status_options cvswork2/subdir newfile.bin "" &&
check_status_options cvswork2/subdir newfile.c ""
'
test_expect_success 'add text (guess)' '
(cd cvswork &&
echo "simpleText" > simpleText.c &&