Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Common/VersionedAsset.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ enum State
kMetaFile = 1 << 15,
kMovedLocal = 1 << 16, // only used plugin side for perforce.
kMovedRemote = 1 << 17, // only used plugin side for perforce.
kUnversioned = 1 << 18
kUnversioned = 1 << 18,
kExclusiveCheckout = 1 << 19, // Only one user at a time can open this file for editing.
};

class VersionedAsset
Expand Down
2 changes: 1 addition & 1 deletion P4Plugin/P4Plugin.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ _SCL_SECURE_NO_DEPRECATE
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(ProjectDir)Source\r16.1\lib\win32debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>$(ProjectDir)Source\r16.1\lib\win32debug;$(ProjectDir)Source\r16.1\lib\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>libclient.lib;libeay32.lib;ssleay32.lib;librpc.lib;libsupp.lib;ws2_32.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
Expand Down
8 changes: 4 additions & 4 deletions P4Plugin/Source/P4StatusBaseCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ void P4StatusBaseCommand::OutputStat( StrDict *varList )
std::string headRev;
std::string haveRev;
std::string depotFile;
bool exclLockType = false;

// Dump out the variables, using the GetVar( x ) interface.
// Don't display the function, which is only relevant to rpc.
Expand All @@ -42,7 +41,8 @@ void P4StatusBaseCommand::OutputStat( StrDict *varList )

if (key == "headType")
{
exclLockType = value.find("+l") != std::string::npos;
if (value.find("+l") != std::string::npos)
current.AddState(kExclusiveCheckout);
}
else if (key == "clientFile")
{
Expand All @@ -59,7 +59,7 @@ void P4StatusBaseCommand::OutputStat( StrDict *varList )
else if (key == "action")
{
action = value;
if (value == "edit" && exclLockType)
if (value == "edit" && current.HasState(kExclusiveCheckout))
current.AddState(kLockedLocal);
}
else if (key == "ourLock")
Expand All @@ -73,7 +73,7 @@ void P4StatusBaseCommand::OutputStat( StrDict *varList )
else if (key == "otherOpen")
{
current.AddState(kCheckedOutRemote);
if (exclLockType)
if (current.HasState(kExclusiveCheckout))
current.AddState(kLockedRemote);
}
else if (StartsWith(key, "otherAction") && value == "delete")
Expand Down
1 change: 0 additions & 1 deletion Test/Perforce/GetLatest.test
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ c32:enableCommand revert
c32:enableCommand status
c32:enableCommand submit
c32:enableCommand unlock
w1:./... - no such file(s).\n
o1:-1
d1:end of list
r1:end of response
Expand Down
28 changes: 27 additions & 1 deletion Test/Perforce/PerforceTest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ sub PerforceIntegrationTests
$ENV{'VCS_P4CLIENT'} = "testclient";
$ENV{'VCS_P4USER'} = "vcs_test_user";
$ENV{'P4CHARSET'} = 'utf8';
$ENV{'VCS_P4PASSWD'} = 'secret';
$ENV{'VCS_P4PASSWD'} = 'Secret';
$ENV{'P4EXECABS'} = getcwd() . "/" . $ENV{'P4EXEC'};

if ($ENV{'TARGET'} eq "win32")
{
$ENV{'VCS_P4ROOT'} =~ s/\//\\/g;
$ENV{'VCS_P4CLIENTROOT'} =~ s/\//\\/g;
$ENV{'VCS_P4CLIENTROOTABS'} =~ s/\//\\/g;
$ENV{'P4EXECABS'} =~ s/\//\\/g;
}

$ENV{'VCS_P4ROOT'} = abs_path($ENV{'VCS_P4ROOT'});
Expand Down Expand Up @@ -81,6 +83,7 @@ sub RunTests()
chdir $clientroot;
mkdir "./Assets";
mkdir "./Library";
AddExclusiveFile();
$output = `$testserver $pluginexec $cwd $i $option`;
$res = $? >> 8;
print $output;
Expand All @@ -101,12 +104,35 @@ sub RunTests()
return 1;
}
$total++;
RemoveExclusiveFile();
}
print "Done: $success of $total tests passed.\n";
chdir $cwd;
return 0;
}

sub RunCommand
{
my $command = $_[0];
system("$ENV{'P4EXECABS'} -p $ENV{'VCS_P4PORT'} -u $ENV{'VCS_P4USER'} -P $ENV{'VCS_P4PASSWD'} -c $ENV{'VCS_P4CLIENT'} -d $ENV{'VCS_P4CLIENTROOTABS'} $command");
}

sub AddExclusiveFile
{
open(FH, '>', 'Assets/exclusivefile.txt') or die $!;
print(FH 'File with exclusive open file type modifier.');
close(FH) or die $1;

RunCommand('add -t text+l Assets/exclusivefile.txt');
RunCommand('submit -d "Add Assets/exclusivefile.txt." Assets/exclusivefile.txt');
}

sub RemoveExclusiveFile
{
RunCommand('delete Assets/exclusivefile.txt');
RunCommand('submit -d "Delete Assets/exclusivefile.txt." Assets/exclusivefile.txt');
}

sub SetupServer
{
$root = $ENV{'VCS_P4ROOT'};
Expand Down
1 change: 0 additions & 1 deletion Test/Perforce/SecureGetLatest.test
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ c32:enableCommand revert
c32:enableCommand status
c32:enableCommand submit
c32:enableCommand unlock
w1:./... - no such file(s).\n
o1:-1
d1:end of list
r1:end of response
Expand Down
14 changes: 14 additions & 0 deletions Test/Perforce/Status.test
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,18 @@ o1:./Assets/excludedfile.txt
o1:262144
v1:./Assets/excludedfile.txt - file(s) not in client view.
d1:end of list
r1:end of response
--
c:status recurse
1
./Assets/exclusivefile.txt
0
--
o1:-1
v1:fstat "./Assets/exclusivefile.txt"
==:v1:User vcs_test_user ticket expires in
v1:<absroot>/Assets/exclusivefile.txt
o1:<absroot>/Assets/exclusivefile.txt
o1:540675
d1:end of list
r1:end of response