├── .github └── pull_request_template.md ├── .gitignore ├── .yamato ├── linux-build.yml ├── osx-build.yml ├── windows-build.yml └── zipVCSPlugins.yml ├── Common ├── Changes.cpp ├── Changes.h ├── Command.cpp ├── Command.h ├── CommandLine.cpp ├── CommandLine.h ├── Commands │ ├── Add.h │ ├── AllReqResp.h │ ├── Base.h │ ├── BaseFileSet.h │ ├── ChangeDescription.h │ ├── Config.h │ ├── Download.h │ ├── Incoming.h │ ├── IncomingAssets.h │ ├── MoveChangelist.h │ ├── Outgoing.h │ ├── OutgoingAssets.h │ └── Submit.h ├── Connection.cpp ├── Connection.h ├── Dispatch.h ├── FileSystem.cpp ├── FileSystem.h ├── Log.cpp ├── Log.h ├── POpen.cpp ├── POpen.h ├── Pipe.cpp ├── Pipe.h ├── Status.cpp ├── Status.h ├── Utility.cpp ├── Utility.h ├── VersionedAsset.cpp └── VersionedAsset.h ├── License ├── MFA ├── README.md ├── mfa-trigger.ps1 └── mfa-trigger.sh ├── Makefile.gnu ├── Makefile.osx ├── Makefile.srcs ├── P4Plugin ├── OpenSSL-license.txt ├── P4Plugin.vcxproj ├── P4Plugin.vcxproj.filters └── Source │ ├── P4AddCommand.cpp │ ├── P4ChangeDescriptionCommand.cpp │ ├── P4ChangeMoveCommand.cpp │ ├── P4ChangeStatusCommand.cpp │ ├── P4ChangesCommand.cpp │ ├── P4CheckoutCommand.cpp │ ├── P4Command.cpp │ ├── P4Command.h │ ├── P4ConfigCommand.cpp │ ├── P4DeleteChangesCommand.cpp │ ├── P4DeleteCommand.cpp │ ├── P4DownloadCommand.cpp │ ├── P4ExitCommand.cpp │ ├── P4FileModeCommand.cpp │ ├── P4FileSetBaseCommand.cpp │ ├── P4FileSetBaseCommand.h │ ├── P4GetLatestCommand.cpp │ ├── P4IncomingChangeAssetsCommand.cpp │ ├── P4IncomingCommand.cpp │ ├── P4Info.h │ ├── P4InfoCommand.cpp │ ├── P4LockCommand.cpp │ ├── P4Login2Command.cpp │ ├── P4LoginCommand.cpp │ ├── P4LogoutCommand.cpp │ ├── P4MFA.cpp │ ├── P4MFA.h │ ├── P4MoveCommand.cpp │ ├── P4OSX.mm │ ├── P4Plugin_Posix.cpp │ ├── P4Plugin_WIN.cpp │ ├── P4QueryConfigParametersCommand.cpp │ ├── P4ResolveCommand.cpp │ ├── P4RevertChangesCommand.cpp │ ├── P4RevertCommand.cpp │ ├── P4SpecCommand.cpp │ ├── P4StatusBaseCommand.cpp │ ├── P4StatusBaseCommand.h │ ├── P4StatusCommand.cpp │ ├── P4StatusCommand.h │ ├── P4Stream.h │ ├── P4StreamsCommand.cpp │ ├── P4SubmitCommand.cpp │ ├── P4Task.cpp │ ├── P4Task.h │ ├── P4UnlockCommand.cpp │ ├── P4Utility.cpp │ ├── P4Utility.h │ └── r19.1 │ ├── include │ └── p4 │ │ ├── base64.h │ │ ├── charcvt.h │ │ ├── charman.h │ │ ├── charset.h │ │ ├── clientapi.h │ │ ├── clientmerge.h │ │ ├── clientprog.h │ │ ├── clientresolvea.h │ │ ├── clientscript.h │ │ ├── clientuser.h │ │ ├── datetime.h │ │ ├── debug.h │ │ ├── diff.h │ │ ├── diffmerge.h │ │ ├── dmextension.h │ │ ├── dmextension_c.h │ │ ├── dmextensiondata.h │ │ ├── dmextensiondata_c.h │ │ ├── echoctl.h │ │ ├── enviro.h │ │ ├── error.h │ │ ├── errorlog.h │ │ ├── errornum.h │ │ ├── filesys.h │ │ ├── handler.h │ │ ├── hostenv.h │ │ ├── i18napi.h │ │ ├── ident.h │ │ ├── ignore.h │ │ ├── keepalive.h │ │ ├── macfile.h │ │ ├── macutil.h │ │ ├── mangle.h │ │ ├── mapapi.h │ │ ├── md5.h │ │ ├── msgclient.h │ │ ├── msgdb.h │ │ ├── msgdm.h │ │ ├── msggraph.h │ │ ├── msgos.h │ │ ├── msgrpc.h │ │ ├── msgserver.h │ │ ├── msgsupp.h │ │ ├── netbuffer.h │ │ ├── netconnect.h │ │ ├── netportparser.h │ │ ├── ntmangle.h │ │ ├── ntservice.h │ │ ├── options.h │ │ ├── p4tags.h │ │ ├── pathsys.h │ │ ├── runcmd.h │ │ ├── serverhelperapi.h │ │ ├── sha1.h │ │ ├── sha256.h │ │ ├── signaler.h │ │ ├── spec.h │ │ ├── stdhdrs.h │ │ ├── strarray.h │ │ ├── strbuf.h │ │ ├── strdict.h │ │ ├── strops.h │ │ ├── strtable.h │ │ ├── strxml.h │ │ ├── threading.h │ │ ├── ticket.h │ │ ├── validate.h │ │ ├── vararray.h │ │ └── web822.h │ └── lib │ ├── linux32 │ ├── libclient.a │ ├── libp4script.a │ ├── libp4script_c.a │ ├── libp4script_curl.a │ ├── libp4script_sqlite.a │ ├── libp4sslstub.a │ ├── librpc.a │ └── libsupp.a │ ├── linux64 │ ├── libclient.a │ ├── libcrypto.a │ ├── libp4script.a │ ├── libp4script_c.a │ ├── libp4script_curl.a │ ├── libp4script_sqlite.a │ ├── librpc.a │ ├── libssl.a │ └── libsupp.a │ ├── osx32 │ ├── libclient.a │ ├── libp4script.a │ ├── libp4script_c.a │ ├── libp4script_curl.a │ ├── libp4script_sqlite.a │ ├── libp4sslstub.a │ ├── librpc.a │ └── libsupp.a │ ├── osx64 │ ├── libclient.a │ ├── libcrypto.a │ ├── libp4script.a │ ├── libp4script_c.a │ ├── libp4script_curl.a │ ├── libp4script_sqlite.a │ ├── librpc.a │ ├── libssl.a │ └── libsupp.a │ ├── win32 │ ├── libclient.lib │ ├── libeay32.lib │ ├── libp4script.lib │ ├── libp4script_c.lib │ ├── libp4script_curl.lib │ ├── libp4script_sqlite.lib │ ├── librpc.lib │ ├── libsupp.lib │ └── ssleay32.lib │ └── win32debug │ ├── libclient.lib │ ├── libeay32.lib │ ├── libp4script.lib │ ├── libp4script_c.lib │ ├── libp4script_curl.lib │ ├── libp4script_sqlite.lib │ ├── librpc.lib │ ├── libsupp.lib │ └── ssleay32.lib ├── README.md ├── TFSPlugin ├── Binaries │ ├── TfsPlugin readme.txt │ ├── TfsPlugin.exe │ └── TfsPlugin.exe.config ├── Packages │ └── Microsoft.TeamFoundation │ │ ├── 12.0 │ │ ├── Microsoft.TeamFoundation.Client.dll │ │ ├── Microsoft.TeamFoundation.Common.dll │ │ ├── Microsoft.TeamFoundation.Diff.dll │ │ ├── Microsoft.TeamFoundation.VersionControl.Client.dll │ │ ├── Microsoft.TeamFoundation.VersionControl.Common.dll │ │ ├── Microsoft.VisualStudio.Services.Client.dll │ │ └── Microsoft.VisualStudio.Services.Common.dll │ │ └── 14.0 │ │ ├── Microsoft.TeamFoundation.Client.dll │ │ ├── Microsoft.TeamFoundation.Common.dll │ │ ├── Microsoft.TeamFoundation.Diff.dll │ │ ├── Microsoft.TeamFoundation.VersionControl.Client.dll │ │ ├── Microsoft.TeamFoundation.VersionControl.Common.dll │ │ ├── Microsoft.VisualStudio.Services.Client.dll │ │ └── Microsoft.VisualStudio.Services.Common.dll ├── TfsPlugin readme.txt ├── TfsPlugin.UnitTestProject │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── TestResources │ │ ├── TfsSettings │ │ │ ├── NoOverrideSettings.xml │ │ │ └── OverrideAllSettings.xml │ │ └── UnityProjects │ │ │ └── TestOne │ │ │ ├── Assets │ │ │ ├── Scenes.meta │ │ │ └── Scenes │ │ │ │ ├── Development.meta │ │ │ │ ├── Development │ │ │ │ ├── Jake.meta │ │ │ │ └── Jake │ │ │ │ │ ├── main.unity │ │ │ │ │ └── main.unity.meta │ │ │ │ ├── main.unity │ │ │ │ └── main.unity.meta │ │ │ └── ProjectSettings │ │ │ ├── AudioManager.asset │ │ │ ├── DynamicsManager.asset │ │ │ ├── EditorBuildSettings.asset │ │ │ ├── EditorSettings.asset │ │ │ ├── GraphicsSettings.asset │ │ │ ├── InputManager.asset │ │ │ ├── NavMeshLayers.asset │ │ │ ├── NetworkManager.asset │ │ │ ├── Physics2DSettings.asset │ │ │ ├── ProjectSettings.asset │ │ │ ├── QualitySettings.asset │ │ │ ├── TagManager.asset │ │ │ └── TimeManager.asset │ ├── TfsCommandUnitTests.cs │ ├── TfsPlugin.UnitTestProject.csproj │ ├── TfsSettingsTests.cs │ ├── TfsTempWorkspace.cs │ ├── UnitTestSettings.Designer.cs │ ├── UnitTestSettings.settings │ └── app.config ├── TfsPlugin │ ├── Common │ │ ├── Changes.cs │ │ ├── Command.cs │ │ ├── Commands │ │ │ ├── Base.cs │ │ │ ├── BaseFileSet.cs │ │ │ ├── ChangeDescription.cs │ │ │ ├── Config.cs │ │ │ ├── Download.cs │ │ │ ├── Incoming.cs │ │ │ ├── IncomingAssets.cs │ │ │ ├── MoveChangelist.cs │ │ │ ├── Outgoing.cs │ │ │ ├── OutgoingAssets.cs │ │ │ ├── RevertChanges.cs │ │ │ └── Submit.cs │ │ └── VersionedAsset.cs │ ├── Connection.cs │ ├── Pipe.cs │ ├── Plugin │ │ ├── TfsAddCommand.cs │ │ ├── TfsChangeDescriptionCommand.cs │ │ ├── TfsChangeStatusCommand.cs │ │ ├── TfsCheckoutCommand.cs │ │ ├── TfsConfigCommand.cs │ │ ├── TfsDeleteCommand.cs │ │ ├── TfsDownloadCommand.cs │ │ ├── TfsFileModeCommand.cs │ │ ├── TfsFileStatus.cs │ │ ├── TfsGetLatestCommand.cs │ │ ├── TfsIncomingAssetsCommand.cs │ │ ├── TfsIncomingCommand.cs │ │ ├── TfsLockCommand.cs │ │ ├── TfsMoveChangelistCommand.cs │ │ ├── TfsMoveCommand.cs │ │ ├── TfsOutgoingCommand.cs │ │ ├── TfsResolveCommand.cs │ │ ├── TfsRevertChangesCommand.cs │ │ ├── TfsRevertCommand.cs │ │ ├── TfsStatusCommand.cs │ │ ├── TfsSubmitCommand.cs │ │ ├── TfsSubmitDialogCommand.cs │ │ ├── TfsTask.cs │ │ └── TfsUnlockCommand.cs │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Settings.Designer.cs │ ├── Settings.settings │ ├── TfsPlugin.csproj │ ├── TfsSettings.cs │ └── app.config └── VersionControl.sln ├── TODO.txt ├── Test ├── Perforce │ ├── Add.test │ ├── Add2.test │ ├── BadConnectionParams.test │ ├── BadProjectRoot.test │ ├── BaseIPv4 │ │ ├── 02_Configure.txt │ │ ├── 03_GetLatest.txt │ │ ├── 04_Add.txt │ │ ├── 05_RevertAdd.txt │ │ ├── 06_Add2.txt │ │ ├── 07_Submit.txt │ │ ├── 08_Delete.txt │ │ ├── 09_Submit2.txt │ │ ├── 10_Move.txt │ │ ├── 11_MoveNoLocal.txt │ │ ├── 12_BadConnectionParams.txt │ │ ├── 13_BadProjectRoot.txt │ │ └── 14_Status.txt │ ├── BaseIPv6 │ │ ├── 02_Configure.txt │ │ ├── 03_GetLatest.txt │ │ ├── 04_Add.txt │ │ ├── 05_RevertAdd.txt │ │ ├── 06_Add2.txt │ │ ├── 07_Submit.txt │ │ ├── 08_Delete.txt │ │ ├── 09_Submit2.txt │ │ ├── 10_Move.txt │ │ ├── 11_MoveNoLocal.txt │ │ ├── 12_BadConnectionParams.txt │ │ ├── 13_BadProjectRoot.txt │ │ └── 14_Status.txt │ ├── Common │ │ ├── 01_Traits.txt │ │ └── 02_P4Addresses.txt │ ├── ConfigureBaseIPv4.test │ ├── ConfigureBaseIPv6.test │ ├── ConfigureSecureBaseIPv4.test │ ├── ConfigureSecureSquareBracketIPv6.test │ ├── ConfigureSquareBracketIPv4.test │ ├── ConfigureSquareBracketIPv6.test │ ├── Delete.test │ ├── GetLatest.test │ ├── Login2.test │ ├── Move.test │ ├── MoveNoLocal.test │ ├── MultiFactorAuthentication │ │ └── 01_Login2.txt │ ├── PerforceTest.pm │ ├── RevertAdd.test │ ├── SecureAdd.test │ ├── SecureAdd2.test │ ├── SecureBaseIPv4 │ │ ├── 02_Configure.txt │ │ ├── 03_GetLatest.txt │ │ ├── 04_Add.txt │ │ ├── 05_RevertAdd.txt │ │ ├── 06_Add2.txt │ │ ├── 07_Submit.txt │ │ ├── 08_Delete.txt │ │ ├── 09_Submit2.txt │ │ ├── 10_Move.txt │ │ ├── 11_MoveNoLocal.txt │ │ ├── 12_BadConnectionParams.txt │ │ ├── 13_BadProjectRoot.txt │ │ └── 14_Status.txt │ ├── SecureDelete.test │ ├── SecureGetLatest.test │ ├── SecureMove.test │ ├── SecureMoveNoLocal.test │ ├── SecureRevertAdd.test │ ├── SecureSquareBracketIPv6 │ │ ├── 02_Configure.txt │ │ ├── 03_GetLatest.txt │ │ ├── 04_Add.txt │ │ ├── 05_RevertAdd.txt │ │ ├── 06_Add2.txt │ │ ├── 07_Submit.txt │ │ ├── 08_Delete.txt │ │ ├── 09_Submit2.txt │ │ ├── 10_Move.txt │ │ ├── 11_MoveNoLocal.txt │ │ ├── 12_BadConnectionParams.txt │ │ ├── 13_BadProjectRoot.txt │ │ └── 14_Status.txt │ ├── SecureStatus.test │ ├── SecureSubmit.test │ ├── SecureSubmit2.test │ ├── SquareBracketIPv4 │ │ ├── 02_Configure.txt │ │ ├── 03_GetLatest.txt │ │ ├── 04_Add.txt │ │ ├── 05_RevertAdd.txt │ │ ├── 06_Add2.txt │ │ ├── 07_Submit.txt │ │ ├── 08_Delete.txt │ │ ├── 09_Submit2.txt │ │ ├── 10_Move.txt │ │ ├── 11_MoveNoLocal.txt │ │ ├── 12_BadConnectionParams.txt │ │ ├── 13_BadProjectRoot.txt │ │ └── 14_Status.txt │ ├── SquareBracketIPv6 │ │ ├── 02_Configure.txt │ │ ├── 03_GetLatest.txt │ │ ├── 04_Add.txt │ │ ├── 05_RevertAdd.txt │ │ ├── 06_Add2.txt │ │ ├── 07_Submit.txt │ │ ├── 08_Delete.txt │ │ ├── 09_Submit2.txt │ │ ├── 10_Move.txt │ │ ├── 11_MoveNoLocal.txt │ │ ├── 12_BadConnectionParams.txt │ │ ├── 13_BadProjectRoot.txt │ │ └── 14_Status.txt │ ├── Status.test │ ├── Submit.test │ └── Submit2.test ├── Plugin │ └── ProtocolNegotiation.txt ├── Readme ├── Source │ ├── ExternalProcess.h │ ├── ExternalProcess_Posix.cpp │ ├── ExternalProcess_WIN.cpp │ └── TestServer.cpp ├── TestServer │ ├── TestServer.vcxproj │ └── TestServer.vcxproj.filters ├── VCSTest.pm ├── run_tests.bat └── run_tests.sh ├── VersionControl.sln ├── build.pl └── msbuilder.cmd /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ### Purpose of this PR 2 | Why is this PR needed? What problem does it solve/fix? 3 | 4 | --- 5 | ### Testing status 6 | 7 | **Manual Tests**: What did you do? 8 | - [ ] Verified that plugins work in the Editor 9 | - [ ] Ran local tests on your machine 10 | - Other: 11 | 12 | **Automated Tests**: What did you setup? (Add a screenshot or the reference image of the test please) 13 | 14 | **Yamato**: (Select your branch): 15 | https://yamato.prd.cds.internal.unity3d.com/jobs/421-NativeVersionControlPlugins 16 | 17 | Any test projects to go with this to help reviewers? 18 | 19 | --- 20 | ### Comments to reviewers 21 | Notes for the reviewers you have assigned. 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Specific 2 | Build/ 3 | PerforceBinaries/ 4 | Library/ 5 | *.BASE.*.cpp 6 | *.LOCAL.*.cpp 7 | *.BACKUP.*.cpp 8 | *.REMOTE.*.cpp 9 | *.orig 10 | Test/tmp/* 11 | PerforcePlugin 12 | SubversionPlugin 13 | 14 | # Compiled Object files 15 | *.slo 16 | *.lo 17 | *.o 18 | *.obj 19 | 20 | # Precompiled Headers 21 | *.gch 22 | *.pch 23 | *.ipch 24 | 25 | # Compiled Dynamic libraries 26 | *.so 27 | *.dylib 28 | *.dll 29 | 30 | # Fortran module files 31 | *.mod 32 | 33 | # Compiled Static libraries 34 | *.lai 35 | *.la 36 | *.a 37 | *.lib 38 | 39 | # Executables 40 | *.exe 41 | *.out 42 | *.app 43 | 44 | # Output folders 45 | [Dd]ebug/ 46 | [Rr]elease/ 47 | [Bb]in/ 48 | [Oo]bj/ 49 | 50 | # Visual Studio 2010 local files 51 | *.vcxproj.user 52 | *.opensdf 53 | *.sdf 54 | *.suo 55 | 56 | # Visual Studio 2015 local files 57 | .vs/ 58 | 59 | # Test Ouput 60 | TestResults/ 61 | 62 | # Sublime files 63 | *.sublime-project 64 | *.sublime-workspace 65 | server.pid 66 | 67 | # VI files 68 | *.swp 69 | 70 | # CLion files 71 | .idea 72 | -------------------------------------------------------------------------------- /.yamato/linux-build.yml: -------------------------------------------------------------------------------- 1 | name: Linux - Build & Test VCS plugins 2 | agent: 3 | type: Unity::VM 4 | image: cds-ops/ubuntu-16.04-katana-agent 5 | flavor: b1.large 6 | 7 | commands: 8 | - hg clone --config extensions.largefiles= http://hg-mirror-slo.hq.unity3d.com/unity-extra/perforce PerforceBinaries 9 | - perl build.pl | tee linux_build.txt 10 | - perl build.pl -test | tee linux_test.txt 11 | artifacts: 12 | builds: 13 | paths: 14 | - "Build/linux64/PerforcePlugin" 15 | logs: 16 | paths: 17 | - "linux_build.txt" 18 | - "linux_test.txt" -------------------------------------------------------------------------------- /.yamato/osx-build.yml: -------------------------------------------------------------------------------- 1 | name: Mac - Build & Test VCS plugins 2 | agent: 3 | type: Unity::VM::osx 4 | image: desktop/unity-macos-10.15-xcode-12.2:stable 5 | flavor: b1.large 6 | 7 | commands: 8 | - hg clone --config extensions.largefiles= http://hg-mirror-slo.hq.unity3d.com/unity-extra/perforce PerforceBinaries 9 | - perl build.pl | tee mac_build.txt 10 | - perl build.pl -test | tee mac_test.txt 11 | 12 | artifacts: 13 | builds: 14 | paths: 15 | - "Build/OSXx64/PerforcePlugin" 16 | logs: 17 | paths: 18 | - "mac_build.txt" 19 | - "mac_test.txt" 20 | -------------------------------------------------------------------------------- /.yamato/windows-build.yml: -------------------------------------------------------------------------------- 1 | name: Win - Build & Test VCS plugins 2 | agent: 3 | type: Unity::VM 4 | image: core-kaunas/win10-vs2010:latest 5 | flavor: b1.large 6 | 7 | interpreter: powershell 8 | commands: 9 | - perl build.pl | tee win_build.txt 10 | - hg clone --config extensions.largefiles= http://hg-mirror-slo.hq.unity3d.com/unity-extra/perforce PerforceBinaries 11 | - perl build.pl -test | tee win_test.txt 12 | 13 | artifacts: 14 | builds: 15 | paths: 16 | - "Build/Win32/PerforcePlugin.exe" 17 | - "Build/Win32/PerforcePlugin.pdb" 18 | logs: 19 | paths: 20 | - "win_build.txt" 21 | - "win_test.txt" -------------------------------------------------------------------------------- /.yamato/zipVCSPlugins.yml: -------------------------------------------------------------------------------- 1 | name: Zip VCS plugins 2 | agent: 3 | type: Unity::VM 4 | image: core-kaunas/win10-vs2010:latest 5 | flavor: b1.small 6 | 7 | interpreter: powershell 8 | commands: 9 | - mkdir linux64 10 | - mkdir OSXx64 11 | - mkdir Win32 12 | - Copy-Item Build/linux64/* linux64 -Recurse 13 | - Copy-Item Build/OSXx64/* OSXx64 -Recurse 14 | - Copy-Item Build/Win32/* Win32 -Recurse 15 | 16 | artifacts: 17 | builds: 18 | paths: 19 | - "linux64/**" 20 | - "OSXx64/**" 21 | - "Win32/**" 22 | 23 | dependencies: 24 | - .yamato/windows-build.yml 25 | - .yamato/linux-build.yml 26 | - .yamato/osx-build.yml 27 | 28 | triggers: 29 | branches: 30 | only: 31 | - "/.*/" 32 | pull_requests: 33 | - sources: 34 | only: 35 | - "/.*/" -------------------------------------------------------------------------------- /Common/Changes.cpp: -------------------------------------------------------------------------------- 1 | #include "Changes.h" 2 | #include "Connection.h" 3 | #include 4 | 5 | const char * kDefaultListRevision = "-1"; 6 | const char * kNewListRevision = "-2"; 7 | 8 | Changelist::Changelist() { } 9 | // Changelist(std::string const& description); 10 | 11 | ChangelistRevision Changelist::GetRevision() const 12 | { 13 | return m_Revision; 14 | } 15 | 16 | void Changelist::SetRevision(const ChangelistRevision& revison) 17 | { 18 | m_Revision = revison; 19 | } 20 | 21 | std::string Changelist::GetDescription() const 22 | { 23 | return m_Description; 24 | } 25 | 26 | void Changelist::SetDescription(const std::string& description) 27 | { 28 | m_Description = description; 29 | } 30 | 31 | std::string Changelist::GetTimestamp() const 32 | { 33 | return m_Timestamp; 34 | } 35 | 36 | void Changelist::SetTimestamp(const std::string& timestamp) 37 | { 38 | m_Timestamp = timestamp; 39 | } 40 | 41 | std::string Changelist::GetCommitter() const 42 | { 43 | return m_Committer; 44 | } 45 | 46 | void Changelist::SetCommitter(const std::string& committer) 47 | { 48 | m_Committer = committer; 49 | } 50 | 51 | //Connection& operator<<(Connection& p, ChangelistRevision revision) 52 | //{ 53 | // p << revision.c_str(); 54 | // return p; 55 | //} 56 | 57 | Connection& operator>>(Connection& p, ChangelistRevision& revision) 58 | { 59 | std::string line; 60 | p.ReadLine(line); 61 | revision = line; 62 | return p; 63 | } 64 | 65 | Connection& operator<<(Connection& p, const Changelist& changelist) 66 | { 67 | p.DataLine(changelist.GetRevision().c_str()); 68 | p.DataLine(changelist.GetDescription()); 69 | return p; 70 | } 71 | 72 | Connection& operator>>(Connection& p, Changelist& cl) 73 | { 74 | std::string line; 75 | p.ReadLine(line); 76 | cl.SetRevision(line); 77 | p.ReadLine(line); 78 | cl.SetDescription(line); 79 | return p; 80 | } 81 | -------------------------------------------------------------------------------- /Common/Changes.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | typedef std::string ChangelistRevision; 7 | extern const char * kDefaultListRevision; 8 | extern const char * kNewListRevision; 9 | 10 | class Changelist 11 | { 12 | public: 13 | Changelist(); 14 | // Changelist(std::string const& description); 15 | 16 | ChangelistRevision GetRevision() const; 17 | void SetRevision(ChangelistRevision const& revison); 18 | 19 | std::string GetDescription() const; 20 | void SetDescription(const std::string& description); 21 | 22 | std::string GetTimestamp() const; 23 | void SetTimestamp(const std::string& timestamp); 24 | 25 | std::string GetCommitter() const; 26 | void SetCommitter(const std::string& committer); 27 | 28 | private: 29 | ChangelistRevision m_Revision; 30 | std::string m_Description; 31 | std::string m_Timestamp; 32 | std::string m_Committer; 33 | }; 34 | 35 | typedef std::vector Changes; 36 | typedef std::vector ChangelistRevisions; 37 | 38 | class Connection; 39 | //Connection& operator<<(Connection& p, ChangelistRevision revision); 40 | Connection& operator>>(Connection& p, ChangelistRevision& revision); 41 | Connection& operator<<(Connection& p, const Changelist& changelist); 42 | Connection& operator>>(Connection& p, Changelist& changelist); 43 | -------------------------------------------------------------------------------- /Common/Command.cpp: -------------------------------------------------------------------------------- 1 | #include "Command.h" 2 | #include "string.h" 3 | 4 | struct CmdInfo 5 | { 6 | UnityCommand id; 7 | const char* name; 8 | }; 9 | 10 | static const CmdInfo infos[] = { 11 | { UCOM_Shutdown, "shutdown" }, 12 | { UCOM_Add, "add" }, // 13 | { UCOM_ChangeDescription, "changeDescription" }, // 14 | { UCOM_ChangeMove, "changeMove" }, // 15 | { UCOM_ChangeStatus, "changeStatus" }, // 16 | { UCOM_Changes, "changes" }, // 17 | { UCOM_Checkout, "checkout" }, // 18 | { UCOM_Config, "pluginConfig" }, // 19 | { UCOM_DeleteChanges, "deleteChanges" }, // 20 | { UCOM_Delete, "delete" }, // 21 | { UCOM_Download, "download" }, // 22 | { UCOM_Exit, "exit" }, // 23 | { UCOM_GetLatest, "getLatest" }, // 24 | { UCOM_IncomingChangeAssets, "incomingChangeAssets" }, // 25 | { UCOM_Incoming, "incoming" }, // 26 | { UCOM_Lock, "lock" }, // 27 | { UCOM_Login, "login" }, // 28 | { UCOM_Login2, "login2" }, // 29 | { UCOM_Move, "move" }, // 30 | { UCOM_QueryConfigParameters, "queryConfigParameters" }, // 31 | { UCOM_Resolve, "resolve" }, // 32 | { UCOM_RevertChanges, "revertChanges" }, // 33 | { UCOM_Revert, "revert" }, // 34 | { UCOM_Status, "status" }, // 35 | { UCOM_Submit, "submit" }, // 36 | { UCOM_Unlock, "unlock" }, // 37 | { UCOM_FileMode, "filemode" }, // 38 | { UCOM_CustomCommand, "customCommand" }, // 39 | { UCOM_Invalid, 0 } // delimiter 40 | }; 41 | 42 | const char* UnityCommandToString(UnityCommand c) 43 | { 44 | const CmdInfo* cur = infos; 45 | while (cur->name && cur->id != c) { cur++; } 46 | return cur->name ? cur->name : "invalid"; 47 | } 48 | 49 | 50 | UnityCommand StringToUnityCommand(const char* name) 51 | { 52 | const CmdInfo* cur = infos; 53 | while (cur->name && strncmp(cur->name, name, 50)) { cur++; } 54 | return cur->id; 55 | } 56 | 57 | CommandException::CommandException(UnityCommand c, const std::string& about) 58 | { 59 | m_What += UnityCommandToString(c); 60 | m_What += "Command"; 61 | m_What += " => "; 62 | m_What += about; 63 | } 64 | 65 | 66 | const char* CommandException::what() const throw() 67 | { 68 | return m_What.c_str(); 69 | } 70 | -------------------------------------------------------------------------------- /Common/Command.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | enum UnityCommand 7 | { 8 | UCOM_Invalid, 9 | UCOM_Shutdown, 10 | UCOM_Add, 11 | UCOM_ChangeDescription, 12 | UCOM_ChangeMove, 13 | UCOM_ChangeStatus, 14 | UCOM_Changes, 15 | UCOM_Checkout, 16 | UCOM_Config, 17 | UCOM_DeleteChanges, 18 | UCOM_Delete, 19 | UCOM_Download, 20 | UCOM_Exit, 21 | UCOM_GetLatest, 22 | UCOM_IncomingChangeAssets, 23 | UCOM_Incoming, 24 | UCOM_Lock, 25 | UCOM_Login, 26 | UCOM_Login2, 27 | UCOM_Move, 28 | UCOM_QueryConfigParameters, 29 | UCOM_Resolve, 30 | UCOM_RevertChanges, 31 | UCOM_Revert, 32 | UCOM_Status, 33 | UCOM_Submit, 34 | UCOM_Unlock, 35 | UCOM_FileMode, 36 | UCOM_CustomCommand, 37 | }; 38 | 39 | // Command string as received from unity pipe 40 | const char* UnityCommandToString(UnityCommand c); 41 | UnityCommand StringToUnityCommand(const char* name); 42 | 43 | class CommandException : public std::exception 44 | { 45 | public: 46 | CommandException(UnityCommand c, const std::string& about); 47 | ~CommandException() throw() {} 48 | virtual const char* what() const throw(); 49 | private: 50 | std::string m_What; 51 | }; 52 | 53 | typedef std::vector CommandArgs; 54 | -------------------------------------------------------------------------------- /Common/CommandLine.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Simple utilities for parsing command lines 4 | void CommandLineFreeArgs(char** argv); 5 | char** CommandLineToArgv( const char* CmdLine, int* _argc ); 6 | void Trace( const char msg[], ... ); 7 | -------------------------------------------------------------------------------- /Common/Commands/Add.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Command.h" 3 | 4 | class AddRequest : public BaseRequest 5 | { 6 | public: 7 | AddRequest(const CommandArgs& args, Connection& conn) : BaseRequest(args, conn) 8 | { 9 | conn >> assetList; 10 | } 11 | 12 | VersionedAssetList assetList; 13 | }; 14 | 15 | class AddResponse : public BaseReponse 16 | { 17 | public: 18 | }; 19 | -------------------------------------------------------------------------------- /Common/Commands/AllReqResp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "BaseFileSet.h" 3 | #include "Config.h" 4 | #include "Incoming.h" 5 | #include "IncomingAssets.h" 6 | #include "Outgoing.h" 7 | #include "OutgoingAssets.h" 8 | #include "Submit.h" 9 | #include "MoveChangelist.h" 10 | #include "Download.h" 11 | #include "ChangeDescription.h" 12 | -------------------------------------------------------------------------------- /Common/Commands/Base.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class BaseRequest 4 | { 5 | public: 6 | BaseRequest(const CommandArgs& args, Connection& conn) : args(args), conn(conn), invalid(false) 7 | { 8 | } 9 | 10 | const CommandArgs& args; 11 | Connection& conn; 12 | bool invalid; 13 | }; 14 | 15 | class BaseResponse 16 | { 17 | public: 18 | }; 19 | -------------------------------------------------------------------------------- /Common/Commands/ChangeDescription.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Command.h" 3 | #include "Changes.h" 4 | #include "VersionedAsset.h" 5 | 6 | class ChangeDescriptionRequest : public BaseRequest 7 | { 8 | public: 9 | ChangeDescriptionRequest(const CommandArgs& args, Connection& conn) : BaseRequest(args, conn) 10 | { 11 | conn >> revision; 12 | 13 | if (revision.empty()) 14 | { 15 | VersionedAssetList assets; 16 | conn << assets; 17 | conn.ErrorLine("Cannot get assets for empty revision"); 18 | conn.EndResponse(); 19 | invalid = true; 20 | } 21 | } 22 | 23 | ChangelistRevision revision; 24 | }; 25 | 26 | class ChangeDescriptionResponse : public BaseResponse 27 | { 28 | public: 29 | ChangeDescriptionResponse(ChangeDescriptionRequest& req) : request(req), conn(req.conn) {} 30 | 31 | void Write() 32 | { 33 | if (request.invalid) 34 | return; 35 | 36 | conn.DataLine(description); 37 | conn.EndResponse(); 38 | } 39 | 40 | ChangeDescriptionRequest& request; 41 | Connection& conn; 42 | std::string description; 43 | }; 44 | -------------------------------------------------------------------------------- /Common/Commands/Download.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Base.h" 3 | #include "VersionedAsset.h" 4 | 5 | class DownloadRequest : public BaseRequest 6 | { 7 | public: 8 | DownloadRequest(const CommandArgs& args, Connection& conn) : BaseRequest(args, conn) 9 | { 10 | assets.clear(); 11 | conn >> targetDir; 12 | conn >> revisions; 13 | conn >> assets; 14 | 15 | if (assets.empty() || revisions.empty()) 16 | { 17 | assets.clear(); 18 | conn << assets; 19 | conn.EndResponse(); 20 | invalid = true; 21 | } 22 | } 23 | 24 | // One revisions per asset ie. the two containers are of same size 25 | std::string targetDir; 26 | ChangelistRevisions revisions; 27 | VersionedAssetList assets; 28 | }; 29 | 30 | 31 | class DownloadResponse : public BaseResponse 32 | { 33 | public: 34 | DownloadResponse(DownloadRequest& req) : request(req), conn(req.conn) {} 35 | 36 | void Write() 37 | { 38 | if (request.invalid) 39 | return; 40 | 41 | conn << assets; 42 | conn.EndResponse(); 43 | } 44 | 45 | DownloadRequest& request; 46 | Connection& conn; 47 | VersionedAssetList assets; 48 | }; 49 | -------------------------------------------------------------------------------- /Common/Commands/Incoming.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Command.h" 3 | #include "Changes.h" 4 | 5 | class IncomingRequest : public BaseRequest 6 | { 7 | public: 8 | IncomingRequest(const CommandArgs& args, Connection& conn) : BaseRequest(args, conn) 9 | { 10 | } 11 | }; 12 | 13 | class IncomingResponse : public BaseResponse 14 | { 15 | public: 16 | IncomingResponse(IncomingRequest& req) : request(req), conn(req.conn) {} 17 | 18 | void AddChangeSet(const Changelist& cl) 19 | { 20 | changeSets.push_back(cl); 21 | } 22 | 23 | void Write() 24 | { 25 | if (request.invalid) 26 | return; 27 | 28 | conn << changeSets; 29 | conn.EndResponse(); 30 | } 31 | 32 | IncomingRequest& request; 33 | Connection& conn; 34 | Changes changeSets; 35 | }; 36 | 37 | -------------------------------------------------------------------------------- /Common/Commands/IncomingAssets.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Command.h" 3 | #include "Changes.h" 4 | #include "VersionedAsset.h" 5 | 6 | class IncomingAssetsRequest : public BaseRequest 7 | { 8 | public: 9 | IncomingAssetsRequest(const CommandArgs& args, Connection& conn) : BaseRequest(args, conn) 10 | { 11 | conn >> revision; 12 | 13 | if (revision.empty()) 14 | { 15 | VersionedAssetList assets; 16 | conn << assets; 17 | conn.ErrorLine("Cannot get assets for empty revision"); 18 | conn.EndResponse(); 19 | invalid = true; 20 | } 21 | } 22 | 23 | ChangelistRevision revision; 24 | }; 25 | 26 | class IncomingAssetsResponse : public BaseResponse 27 | { 28 | public: 29 | IncomingAssetsResponse(IncomingAssetsRequest& req) : request(req), conn(req.conn) {} 30 | 31 | void Write() 32 | { 33 | if (request.invalid) 34 | return; 35 | 36 | conn << assets; 37 | conn.EndResponse(); 38 | } 39 | 40 | IncomingAssetsRequest& request; 41 | Connection& conn; 42 | VersionedAssetList assets; 43 | }; 44 | 45 | -------------------------------------------------------------------------------- /Common/Commands/MoveChangelist.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Base.h" 3 | #include "VersionedAsset.h" 4 | 5 | // Move asset from one changelist to another 6 | class MoveChangelistRequest : public BaseRequest 7 | { 8 | public: 9 | MoveChangelistRequest(const CommandArgs& args, Connection& conn) : BaseRequest(args, conn) 10 | { 11 | assets.clear(); 12 | conn >> changelist; 13 | conn >> assets; 14 | 15 | if (assets.empty()) 16 | { 17 | assets.clear(); 18 | conn << assets; 19 | conn.EndResponse(); 20 | invalid = true; 21 | } 22 | } 23 | 24 | VersionedAssetList assets; 25 | ChangelistRevision changelist; 26 | }; 27 | 28 | 29 | class MoveChangelistResponse : public BaseResponse 30 | { 31 | public: 32 | MoveChangelistResponse(MoveChangelistRequest& req) : request(req), conn(req.conn) {} 33 | 34 | void Write() 35 | { 36 | if (request.invalid) 37 | return; 38 | 39 | conn << assets; 40 | conn.EndResponse(); 41 | } 42 | 43 | MoveChangelistRequest& request; 44 | Connection& conn; 45 | VersionedAssetList assets; 46 | }; 47 | -------------------------------------------------------------------------------- /Common/Commands/Outgoing.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Command.h" 3 | #include "Changes.h" 4 | 5 | class OutgoingRequest : public BaseRequest 6 | { 7 | public: 8 | OutgoingRequest(const CommandArgs& args, Connection& conn) : BaseRequest(args, conn) 9 | { 10 | } 11 | }; 12 | 13 | class OutgoingResponse : public BaseResponse 14 | { 15 | public: 16 | OutgoingResponse(OutgoingRequest& req) : request(req), conn(req.conn) {} 17 | 18 | void AddChangeSet(const std::string& name, const std::string& revision) 19 | { 20 | Changelist cl; 21 | cl.SetDescription(name); 22 | cl.SetRevision(revision); 23 | changeSets.push_back(cl); 24 | } 25 | 26 | void Write() 27 | { 28 | if (request.invalid) 29 | return; 30 | 31 | conn << changeSets; 32 | conn.EndResponse(); 33 | } 34 | 35 | OutgoingRequest& request; 36 | Connection& conn; 37 | Changes changeSets; 38 | }; 39 | -------------------------------------------------------------------------------- /Common/Commands/OutgoingAssets.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Command.h" 3 | #include "Changes.h" 4 | #include "VersionedAsset.h" 5 | 6 | class OutgoingAssetsRequest : public BaseRequest 7 | { 8 | public: 9 | OutgoingAssetsRequest(const CommandArgs& args, Connection& conn) : BaseRequest(args, conn) 10 | { 11 | conn >> revision; 12 | 13 | if (revision.empty()) 14 | { 15 | VersionedAssetList assets; 16 | conn << assets; 17 | conn.ErrorLine("Cannot get assets for empty revision"); 18 | conn.EndResponse(); 19 | invalid = true; 20 | } 21 | } 22 | 23 | ChangelistRevision revision; 24 | }; 25 | 26 | class OutgoingAssetsResponse : public BaseResponse 27 | { 28 | public: 29 | OutgoingAssetsResponse(OutgoingAssetsRequest& req) : request(req), conn(req.conn) {} 30 | 31 | void Write() 32 | { 33 | if (request.invalid) 34 | return; 35 | 36 | conn << assets; 37 | conn.EndResponse(); 38 | } 39 | 40 | OutgoingAssetsRequest& request; 41 | Connection& conn; 42 | VersionedAssetList assets; 43 | }; 44 | -------------------------------------------------------------------------------- /Common/Commands/Submit.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Base.h" 3 | #include "VersionedAsset.h" 4 | 5 | class SubmitRequest : public BaseRequest 6 | { 7 | public: 8 | SubmitRequest(const CommandArgs& args, Connection& conn) : BaseRequest(args, conn) 9 | { 10 | assets.clear(); 11 | conn >> changelist; 12 | conn >> assets; 13 | 14 | if (assets.empty()) 15 | { 16 | assets.clear(); 17 | conn << assets; 18 | conn.EndResponse(); 19 | invalid = true; 20 | } 21 | } 22 | 23 | VersionedAssetList assets; 24 | Changelist changelist; 25 | }; 26 | 27 | 28 | class SubmitResponse : public BaseResponse 29 | { 30 | public: 31 | SubmitResponse(SubmitRequest& req) : request(req), conn(req.conn) {} 32 | 33 | void Write() 34 | { 35 | if (request.invalid) 36 | return; 37 | 38 | conn << assets; 39 | conn.EndResponse(); 40 | } 41 | 42 | SubmitRequest& request; 43 | Connection& conn; 44 | VersionedAssetList assets; 45 | }; 46 | 47 | -------------------------------------------------------------------------------- /Common/FileSystem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File system related functions 3 | */ 4 | #pragma once 5 | #include 6 | 7 | bool IsReadOnly(const std::string& path); 8 | bool EnsureDirectory(const std::string& path); 9 | bool DeleteRecursive(const std::string& path); 10 | bool CopyAFile(const std::string& fromPath, const std::string& toPath, bool createMissingFolders); 11 | bool MoveAFile(const std::string& fromPath, const std::string& toPath); 12 | bool IsDirectory(const std::string& path); 13 | bool PathExists(const std::string& path); 14 | bool ChangeCWD(const std::string& path); 15 | size_t GetFileLength(const std::string& path); 16 | 17 | #if WIN32 18 | #include "windows.h" 19 | const size_t kDefaultPathBufferSize = 1024; 20 | void ConvertUnityPathName( const char* utf8, wchar_t* outBuffer, int outBufferSize ); 21 | std::string PluginPath(); 22 | #endif 23 | -------------------------------------------------------------------------------- /Common/Log.cpp: -------------------------------------------------------------------------------- 1 | #include "Log.h" 2 | 3 | 4 | LogWriter::LogWriter(LogStream& stream, bool isOn) : m_Stream(stream), m_On(isOn) 5 | { 6 | } 7 | 8 | LogWriter& Flush(LogWriter& w) 9 | { 10 | w.Flush(); 11 | return w; 12 | } 13 | 14 | LogWriter& Endl(LogWriter& w) 15 | { 16 | w.Write("\n"); 17 | w.Flush(); 18 | return w; 19 | } 20 | 21 | 22 | LogStream::LogStream(const std::string& path, LogLevel level) 23 | : m_LogLevel(level), 24 | m_Stream(path.c_str(), std::ios_base::app), 25 | m_OnWriter(Self(), true), 26 | m_OffWriter(Self(), false) 27 | { 28 | } 29 | 30 | LogStream& LogStream::Self(void) 31 | { 32 | // Work around C4355 33 | return *this; 34 | } 35 | 36 | LogStream::~LogStream() 37 | { 38 | m_Stream.flush(); 39 | m_Stream.close(); 40 | } 41 | 42 | void LogStream::SetLogLevel(LogLevel l) 43 | { 44 | m_LogLevel = l; 45 | } 46 | 47 | LogLevel LogStream::GetLogLevel() const 48 | { 49 | return m_LogLevel; 50 | } 51 | 52 | LogWriter& LogStream::Debug() 53 | { 54 | return m_LogLevel <= LOG_DEBUG ? m_OnWriter : m_OffWriter; 55 | } 56 | 57 | LogWriter& LogStream::Info() 58 | { 59 | return m_LogLevel <= LOG_INFO ? m_OnWriter : m_OffWriter; 60 | } 61 | 62 | LogWriter& LogStream::Notice() 63 | { 64 | return m_LogLevel <= LOG_NOTICE ? m_OnWriter : m_OffWriter; 65 | } 66 | 67 | LogWriter& LogStream::Fatal() 68 | { 69 | return m_LogLevel <= LOG_FATAL ? m_OnWriter : m_OffWriter; 70 | } 71 | 72 | LogStream& LogStream::Flush() 73 | { 74 | m_Stream << std::flush; 75 | return *this; 76 | } 77 | 78 | LogWriter& operator<<(LogWriter& w, LogWriter& (*pf)(LogWriter&)) 79 | { 80 | return pf(w); 81 | } 82 | 83 | LogStream& operator<<(LogStream& w, LogStream& (*pf)(LogStream&)) 84 | { 85 | return pf(w); 86 | } 87 | 88 | LogWriter& LogWriter::Flush() 89 | { 90 | if (m_On) m_Stream.Flush(); 91 | return *this; 92 | } 93 | 94 | LogStream& Flush(LogStream& w) 95 | { 96 | w.Flush(); 97 | return w; 98 | } 99 | 100 | LogStream& Endl(LogStream& w) 101 | { 102 | w.Write("\n"); 103 | w.Flush(); 104 | return w; 105 | } 106 | 107 | -------------------------------------------------------------------------------- /Common/Log.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | // Log levels. 5 | // Lower levels are included in highers levels automatically. 6 | enum LogLevel 7 | { 8 | LOG_DEBUG, // protocol messages 9 | LOG_INFO, // commands 10 | LOG_NOTICE, // warnings 11 | LOG_FATAL, // errors and exceptions 12 | }; 13 | 14 | 15 | class LogStream; 16 | 17 | 18 | // A convenient way of disabling certain log levels 19 | // in a returned object. 20 | class LogWriter 21 | { 22 | public: 23 | LogWriter(LogStream& stream, bool isOn); 24 | LogWriter& Flush(); 25 | template LogWriter& Write(const T& v); 26 | 27 | private: 28 | LogStream& m_Stream; 29 | bool m_On; 30 | }; 31 | 32 | template 33 | LogWriter& LogWriter::Write(const T& v) 34 | { 35 | if (m_On) 36 | m_Stream << v; 37 | return *this; 38 | } 39 | 40 | template 41 | LogWriter& operator<<(LogWriter& w, const T& v) 42 | { 43 | return w.Write(v); 44 | } 45 | 46 | LogWriter& operator<<(LogWriter& w, LogWriter& (*pf)(LogWriter&)); 47 | LogWriter& Flush(LogWriter& w); 48 | LogWriter& Endl(LogWriter& w); 49 | 50 | class LogStream 51 | { 52 | public: 53 | LogStream(const std::string& path, LogLevel level = LOG_NOTICE); 54 | ~LogStream(); 55 | 56 | LogStream& Self(void); 57 | 58 | void SetLogLevel(LogLevel l); 59 | LogLevel GetLogLevel() const; 60 | 61 | LogWriter& Debug(); 62 | LogWriter& Info(); 63 | LogWriter& Notice(); 64 | LogWriter& Fatal(); 65 | 66 | LogStream& Flush(); 67 | 68 | template LogStream& Write(const T& v); 69 | private: 70 | LogLevel m_LogLevel; 71 | std::ofstream m_Stream; 72 | LogWriter m_OnWriter; // write logs to file 73 | LogWriter m_OffWriter; // throw away logs 74 | }; 75 | 76 | 77 | template 78 | LogStream& LogStream::Write(const T& v) 79 | { 80 | m_Stream << v; 81 | return *this; 82 | } 83 | 84 | template 85 | LogStream& operator<<(LogStream& s, const T& v) 86 | { 87 | return s.Write(v); 88 | } 89 | 90 | LogStream& operator<<(LogStream& w, LogStream& (*pf)(LogStream&)); 91 | LogStream& Flush(LogStream& w); 92 | LogStream& Endl(LogStream& w); 93 | 94 | -------------------------------------------------------------------------------- /Common/POpen.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #if defined(_WINDOWS) 3 | #include 4 | #endif 5 | 6 | // Run a command line read result. 7 | // This is done blocking which is ok since Unity will timeout 8 | class POpen 9 | { 10 | public: 11 | POpen(const std::string& cmd); 12 | ~POpen(); 13 | bool ReadLine(std::string& result); 14 | void ReadIntoFile(const std::string& path); 15 | private: 16 | std::string m_Command; 17 | #if defined(_WINDOWS) 18 | HANDLE m_ChildStd_IN_Rd; 19 | HANDLE m_ChildStd_IN_Wr; 20 | HANDLE m_ChildStd_OUT_Rd; 21 | HANDLE m_ChildStd_OUT_Wr; 22 | PROCESS_INFORMATION m_ProcInfo; 23 | CHAR m_Buf[4096]; 24 | DWORD m_BufSize; 25 | 26 | #else // posix 27 | FILE* m_Handle; 28 | #endif 29 | }; 30 | 31 | typedef std::auto_ptr APOpen; 32 | -------------------------------------------------------------------------------- /Common/Pipe.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "Utility.h" 7 | 8 | #if defined(_WINDOWS) 9 | #include 10 | #include 11 | #else 12 | #include 13 | #endif 14 | 15 | class PipeException : public std::exception 16 | { 17 | public: 18 | PipeException(const std::string& about) : m_What(about) {} 19 | ~PipeException() throw() {} 20 | virtual const char* what() const throw() { return m_What.c_str(); } 21 | private: 22 | std::string m_What; 23 | }; 24 | 25 | // Pipe that uses unix pipes on mac and linux. NamedPipes on windows 26 | struct Pipe { 27 | public: 28 | Pipe(); 29 | ~Pipe(); 30 | 31 | void Flush(); 32 | 33 | template 34 | Pipe& Write(const T& v) 35 | { 36 | #if defined(_WINDOWS) 37 | std::stringstream ss; 38 | ss << v; 39 | std::string str = ss.str(); 40 | Write(ss.str()); 41 | #else 42 | std::cout << v; 43 | #endif 44 | return *this; 45 | } 46 | 47 | Pipe& Write(const std::string& str); 48 | std::string& ReadLine(std::string& target); 49 | std::string& PeekLine(std::string& dest); 50 | bool IsEOF() const; 51 | 52 | private: 53 | bool m_LineBufferValid; 54 | std::string m_LineBuffer; 55 | 56 | #if defined(_WINDOWS) 57 | HANDLE m_NamedPipe; 58 | std::string m_Buffer; 59 | #endif 60 | }; 61 | 62 | -------------------------------------------------------------------------------- /Common/Status.cpp: -------------------------------------------------------------------------------- 1 | #include "Status.h" 2 | 3 | const char* VCSSeverityToString(VCSSeverity s) 4 | { 5 | switch (s) 6 | { 7 | case VCSSEV_OK: return "OK"; 8 | case VCSSEV_Info: return "Info"; 9 | case VCSSEV_Warn: return "Warn"; 10 | case VCSSEV_Error: return "Error"; 11 | case VCSSEV_Command: return "Command"; 12 | default: break; 13 | } 14 | return ""; 15 | } 16 | 17 | bool StatusContains( const VCSStatus& status, const std::string& needle ) 18 | { 19 | for (VCSStatus::const_iterator i = status.begin(); i != status.end(); ++i) 20 | { 21 | if (i->message.find(needle) != std::string::npos) 22 | { 23 | return true; 24 | } 25 | } 26 | return false; 27 | } 28 | -------------------------------------------------------------------------------- /Common/Status.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | enum VCSSeverity 6 | { 7 | VCSSEV_OK, 8 | VCSSEV_Info, 9 | VCSSEV_Warn, 10 | VCSSEV_Error, 11 | VCSSEV_Command 12 | }; 13 | 14 | const char* VCSSeverityToString(VCSSeverity s); 15 | 16 | struct VCSStatusItem 17 | { 18 | VCSStatusItem(VCSSeverity sev, const std::string& msg) : severity(sev), message(msg) { } 19 | VCSSeverity severity; 20 | std::string message; 21 | }; 22 | 23 | // Sort higher severity as before when iterating a set 24 | struct VCSStatusItemCmp 25 | { 26 | bool operator()(const VCSStatusItem& a, const VCSStatusItem& b) const 27 | { 28 | if (a.severity > b.severity) 29 | return true; 30 | else if (a.severity < b.severity) 31 | return false; 32 | return a.message < b.message; 33 | } 34 | }; 35 | 36 | typedef std::set VCSStatus; 37 | 38 | bool StatusContains(const VCSStatus& status, const std::string& needle); 39 | -------------------------------------------------------------------------------- /License: -------------------------------------------------------------------------------- 1 | Perforce headers and libraries are subject to Perforce own license to be found at: 2 | http://www.perforce.com/downloads/terms-use 3 | http://www.perforce.com/product/components/apis 4 | 5 | The rest of the source code is licensed under public domain. 6 | -------------------------------------------------------------------------------- /Makefile.gnu: -------------------------------------------------------------------------------- 1 | include Makefile.srcs 2 | 3 | CC = gcc 4 | CXX = g++ 5 | AR = ar 6 | 7 | GTK3_INCLUDE = -I/usr/include/gtk-3.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/atk-1.0 -I/usr/include/harfbuzz 8 | GTK3_LIBRARIES = -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 9 | 10 | CXXFLAGS += -O2 -g -fpermissive -Wno-deprecated-declarations $(GTK3_INCLUDE) $(P4PLUGIN_INCLUDE) 11 | LDFLAGS += -g 12 | LIBRARIES = -lstdc++ -lrt $(GTK3_LIBRARIES) 13 | 14 | COMMON_MODULES = $(COMMON_SRCS:.c=.o) 15 | COMMON_MODULES := $(COMMON_MODULES:.cpp=.o) 16 | 17 | TESTSERVER_MODULES = $(TESTSERVER_SRCS:.c=.o) 18 | TESTSERVER_MODULES := $(TESTSERVER_SRCS:.cpp=.o) 19 | TESTSERVER_TARGET= Build/$(PLATFORM)/TestServer 20 | 21 | P4PLUGIN_MODULES = $(P4PLUGIN_SRCS:.c=.o) 22 | P4PLUGIN_MODULES := $(P4PLUGIN_MODULES:.cpp=.o) 23 | P4PLUGIN_TARGET = PerforcePlugin 24 | P4PLUGIN_LINK += $(LIBRARIES) -ldl -fPIC -no-pie 25 | 26 | default: all 27 | 28 | all: P4Plugin testserver 29 | 30 | testserver: $(TESTSERVER_TARGET) 31 | @mkdir -p Build/$(PLATFORM) 32 | 33 | P4Plugin: $(P4PLUGIN_TARGET) 34 | mkdir -p Build/$(PLATFORM) 35 | cp $(P4PLUGIN_TARGET) Build/$(PLATFORM) 36 | 37 | Common: $(COMMON_MODULES) 38 | 39 | Common/%.o : Common/%.cpp $(COMMON_INCLS) 40 | $(CXX) $(CXXFLAGS) $(INCLUDE) -c $< -o $@ 41 | 42 | Test/Source/%.o : Test/Source/%.cpp $(TESTSERVER_INCLS) 43 | $(CXX) $(CXXFLAGS) $(TESTSERVER_INCLUDE) -c $< -o $@ 44 | 45 | P4Plugin/Source/%.o : P4Plugin/Source/%.cpp $(COMMON_INCLS) $(P4PLUGIN_INCLS) 46 | $(CXX) $(CXXFLAGS) $(P4PLUGIN_INCLUDE) -D_LINUX -c $< -o $@ 47 | 48 | $(TESTSERVER_TARGET): $(COMMON_MODULES) $(TESTSERVER_MODULES) 49 | $(CXX) -g $(LDFLAGS) -o $@ $^ 50 | 51 | $(P4PLUGIN_TARGET): $(COMMON_MODULES) $(P4PLUGIN_MODULES) 52 | $(CXX) $(LDFLAGS) -o $@ $^ $(P4PLUGIN_LINK) -L./P4Plugin/Source/r19.1/lib/$(PLATFORM) 53 | 54 | clean: 55 | rm -f Build/*.* $(COMMON_MODULES) $(P4PLUGIN_MODULES) $(TESTSERVER_MODULES) 56 | -------------------------------------------------------------------------------- /Makefile.osx: -------------------------------------------------------------------------------- 1 | include Makefile.srcs 2 | 3 | CC = gcc 4 | CXX = g++ 5 | AR = ar 6 | 7 | CXXFLAGS = -O2 -arch x86_64 -mmacosx-version-min=10.11 8 | LDFLAGS = -arch x86_64 -lstdc++ -mmacosx-version-min=10.11 9 | PLATFORM = OSXx64 10 | 11 | COMMON_MODULES = $(COMMON_SRCS:.c=.o) 12 | COMMON_MODULES := $(COMMON_MODULES:.cpp=.o) 13 | 14 | TESTSERVER_MODULES = $(TESTSERVER_SRCS:.c=.o) 15 | TESTSERVER_MODULES := $(TESTSERVER_SRCS:.cpp=.o) 16 | TESTSERVER_TARGET= Build/$(PLATFORM)/TestServer 17 | 18 | P4PLUGIN_MODULES = $(P4PLUGIN_SRCS:.c=.o) 19 | P4PLUGIN_MODULES := $(P4PLUGIN_MODULES:.cpp=.o) 20 | P4PLUGIN_TARGET = PerforcePlugin 21 | 22 | OSX_SRCS = ./P4Plugin/Source/P4OSX.mm 23 | OSX_MODULES = $(OSX_SRCS:.mm=.o) 24 | P4PLUGIN_MODULES += $(OSX_MODULES) 25 | 26 | default: all 27 | 28 | all: P4Plugin testserver 29 | @mkdir -p Build/$(PLATFORM) 30 | 31 | testserver: $(TESTSERVER_TARGET) 32 | @mkdir -p Build/$(PLATFORM) 33 | 34 | P4Plugin: $(P4PLUGIN_TARGET) 35 | @mkdir -p Build/$(PLATFORM) 36 | cp $(P4PLUGIN_TARGET) Build/$(PLATFORM) 37 | 38 | Common: $(COMMON_MODULES) 39 | 40 | Common/%.o : Common/%.cpp $(COMMON_INCLS) 41 | $(CXX) $(CXXFLAGS) $(INCLUDE) -c $< -o $@ 42 | 43 | Test/Source/%.o : Test/Source/%.cpp $(TESTSERVER_INCLS) 44 | $(CXX) $(CXXFLAGS) $(TESTSERVER_INCLUDE) -c $< -o $@ 45 | 46 | P4Plugin/Source/%.o : P4Plugin/Source/%.cpp $(COMMON_INCLS) $(P4PLUGIN_INCLS) 47 | $(CXX) $(CXXFLAGS) $(P4PLUGIN_INCLUDE) -D_MACOS -c $< -o $@ 48 | 49 | P4Plugin/Source/%.o : P4Plugin/Source/%.mm $(COMMON_INCLS) $(P4PLUGIN_INCLS) 50 | $(CXX) $(CXXFLAGS) $(P4PLUGIN_INCLUDE) -c $< -o $@ 51 | 52 | $(TESTSERVER_TARGET): $(COMMON_MODULES) $(TESTSERVER_MODULES) 53 | $(CXX) -g $(LDFLAGS) -o $@ $^ 54 | 55 | $(P4PLUGIN_TARGET): $(COMMON_MODULES) $(P4PLUGIN_MODULES) 56 | $(CXX) $(LDFLAGS) -o $@ -framework Cocoa $^ -L./P4Plugin/Source/r19.1/lib/osx64 $(P4PLUGIN_LINK) 57 | 58 | clean: 59 | rm -f Build/*.* $(COMMON_MODULES) $(P4PLUGIN_MODULES) $(TESTSERVER_MODULES) 60 | -------------------------------------------------------------------------------- /P4Plugin/Source/P4ChangeDescriptionCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "Changes.h" 2 | #include "P4Command.h" 3 | #include "P4Task.h" 4 | #include 5 | 6 | class P4ChangeDescriptionCommand : public P4Command 7 | { 8 | public: 9 | P4ChangeDescriptionCommand(const char* name) : P4Command(name) {} 10 | virtual bool Run(P4Task& task, const CommandArgs& args) 11 | { 12 | ClearStatus(); 13 | Conn().Log().Info() << "ChangeDescriptionCommand::Run()" << Endl; 14 | 15 | ChangelistRevision cl; 16 | Conn() >> cl; 17 | 18 | const std::string cmd = std::string("change -o ") + (cl == kDefaultListRevision ? std::string("") : cl); 19 | 20 | task.CommandRun(cmd, this); 21 | Conn() << GetStatus(); 22 | 23 | // The OutputState and other callbacks will now output to stdout. 24 | // We just wrap up the communication here. 25 | Conn().EndResponse(); 26 | 27 | return true; 28 | } 29 | 30 | // Called once 31 | void OutputInfo( char level, const char *data ) 32 | { 33 | std::string result; 34 | Conn().VerboseLine(data); 35 | ReadDescription(data, result); 36 | if (result == "\n\n") 37 | result.clear(); 38 | Conn().DataLine(result); 39 | } 40 | 41 | int ReadDescription(const char *data, std::string& result) 42 | { 43 | std::stringstream ss(data); 44 | char buf[512]; 45 | 46 | const std::string kFind = "Description:"; 47 | const std::string kFiles = "Files:"; 48 | const std::string kJobs = "Jobs:"; 49 | int lines = 0; 50 | 51 | while ( ! ss.getline(buf, 512).fail() ) 52 | { 53 | if (kFind == buf) 54 | { 55 | while ( (! ss.getline(buf, 512).fail() ) && kFiles != buf && kJobs != buf) 56 | { 57 | if (buf[0] == '\t') 58 | result += buf+1; 59 | else 60 | result += buf; 61 | 62 | result += "\n"; 63 | ++lines; 64 | } 65 | 66 | return lines; 67 | } 68 | } 69 | 70 | return lines; 71 | } 72 | 73 | 74 | } cChangeDescription("changeDescription"); 75 | 76 | -------------------------------------------------------------------------------- /P4Plugin/Source/P4ChangeMoveCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "Changes.h" 2 | #include "P4FileSetBaseCommand.h" 3 | #include "P4Task.h" 4 | #include "P4Utility.h" 5 | 6 | class P4ChangeMoveCommand : public P4FileSetBaseCommand 7 | { 8 | public: 9 | P4ChangeMoveCommand() : P4FileSetBaseCommand("changeMove") {} 10 | 11 | virtual void ReadConnection() 12 | { 13 | Conn() >> m_ChangeRevision; 14 | } 15 | 16 | virtual std::string SetupCommand(const CommandArgs& args) 17 | { 18 | std::string cmd("reopen -c "); 19 | if (m_ChangeRevision == kDefaultListRevision) 20 | return cmd + "default"; 21 | else 22 | return cmd + m_ChangeRevision; 23 | } 24 | 25 | private: 26 | ChangelistRevision m_ChangeRevision; 27 | 28 | } cChangeMove; 29 | -------------------------------------------------------------------------------- /P4Plugin/Source/P4ChangesCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "Changes.h" 2 | #include "P4Command.h" 3 | #include "P4Task.h" 4 | 5 | /* 6 | * Returns the Changelists that are pending to be submitted to perforce server. 7 | * The assets associated with the changelists are not included. 8 | */ 9 | class P4ChangesCommand : public P4Command 10 | { 11 | public: 12 | P4ChangesCommand(const char* name) : P4Command(name) {} 13 | virtual bool Run(P4Task& task, const CommandArgs& args) 14 | { 15 | ClearStatus(); 16 | Conn().Log().Info() << args[0] << "::Run()" << Endl; 17 | const std::string cmd = std::string("changes -l -s pending -u ") + Quote(task.GetP4User()) + " -c " + Quote(task.GetP4Client()); 18 | 19 | Conn().BeginList(); 20 | 21 | // The default list is always there 22 | Changelist defaultItem; 23 | const char * kDefaultList = "default"; 24 | defaultItem.SetDescription(kDefaultList); 25 | defaultItem.SetRevision(kDefaultListRevision); 26 | 27 | Conn() << defaultItem; 28 | 29 | task.CommandRun(cmd, this); 30 | Conn().EndList(); 31 | Conn() << GetStatus(); 32 | 33 | // The OutputState and other callbacks will now output to stdout. 34 | // We just wrap up the communication here. 35 | Conn().EndResponse(); 36 | 37 | return true; 38 | } 39 | 40 | // Called once per changelist 41 | void OutputInfo( char level, const char *data ) 42 | { 43 | std::string d(data); 44 | const size_t minLength = 8; // "Change x".length() 45 | 46 | Conn().VerboseLine(d); 47 | 48 | if (d.length() <= minLength) 49 | { 50 | Conn().WarnLine(std::string("p4 changelist too short: ") + d); 51 | return; 52 | } 53 | 54 | // Parse the change list 55 | std::string::size_type i = d.find(' ', 8); 56 | if (i == std::string::npos) 57 | { 58 | Conn().WarnLine(std::string("p4 couldn't locate revision: ") + d); 59 | return; 60 | } 61 | 62 | Changelist item; 63 | item.SetDescription(d.substr(i)); 64 | item.SetRevision(d.substr(minLength-1, i - (minLength-1))); 65 | Conn() << item; 66 | } 67 | 68 | } cChanges("changes"); 69 | -------------------------------------------------------------------------------- /P4Plugin/Source/P4CheckoutCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "P4FileSetBaseCommand.h" 2 | 3 | P4FileSetBaseCommand cCheckout("checkout", "edit"); 4 | -------------------------------------------------------------------------------- /P4Plugin/Source/P4DeleteChangesCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "Changes.h" 2 | #include "P4Command.h" 3 | #include "P4Task.h" 4 | 5 | class P4DeleteChangesCommand : public P4Command 6 | { 7 | public: 8 | P4DeleteChangesCommand(const char* name) : P4Command(name){} 9 | virtual bool Run(P4Task& task, const CommandArgs& args) 10 | { 11 | ClearStatus(); 12 | Conn().Log().Info() << args[0] << "::Run()" << Endl; 13 | std::string errorMessage; 14 | 15 | const std::string cmd = "change -d"; 16 | 17 | ChangelistRevisions changes; 18 | Conn() >> changes; 19 | 20 | if (changes.empty()) 21 | { 22 | 23 | Conn().WarnLine("Changes to delete is empty"); 24 | Conn().EndResponse(); 25 | return true; 26 | } 27 | 28 | std::string cl; 29 | for (ChangelistRevisions::const_iterator i = changes.begin(); i != changes.end(); ++i) 30 | { 31 | std::string rev = *i == kDefaultListRevision ? std::string("default") : *i; 32 | std::string cmdr = cmd + " \"" + rev + "\""; 33 | if (!task.CommandRun(cmdr, this)) 34 | break; 35 | } 36 | 37 | // The OutputState and other callbacks will now output to stdout. 38 | // We just wrap up the communication here. 39 | 40 | Conn() << GetStatus(); 41 | 42 | // @TODO: send changed assets 43 | VersionedAssetList dummy; 44 | Conn() << dummy; 45 | 46 | Conn().EndResponse(); 47 | 48 | return true; 49 | } 50 | } cDeleteChanges("deleteChanges"); 51 | -------------------------------------------------------------------------------- /P4Plugin/Source/P4ExitCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "P4Command.h" 2 | #include "P4Task.h" 3 | 4 | class P4ExitCommand : public P4Command 5 | { 6 | public: 7 | P4ExitCommand(const char* name) : P4Command(name) {} 8 | virtual bool Run(P4Task& task, const CommandArgs& args) 9 | { 10 | return false; 11 | } 12 | } cExit("exit"); 13 | -------------------------------------------------------------------------------- /P4Plugin/Source/P4FileModeCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "P4Command.h" 2 | #include "P4Utility.h" 3 | #include "FileSystem.h" 4 | 5 | class P4FileModeCommand : public P4Command 6 | { 7 | public: 8 | P4FileModeCommand() : P4Command("filemode") { } 9 | 10 | bool Run(P4Task& task, const CommandArgs& args) 11 | { 12 | ClearStatus(); 13 | 14 | Conn().Log().Info() << args[0] << "::Run()" << Endl; 15 | 16 | std::string cmd = SetupCommand(args); 17 | if (cmd.empty()) 18 | { 19 | Conn().BeginList(); 20 | Conn().EndList(); 21 | Conn().EndResponse(); 22 | return true; 23 | } 24 | 25 | VersionedAssetList assetList; 26 | Conn() >> assetList; 27 | std::string paths = ResolvePaths(assetList, kPathWild | kPathSkipFolders); 28 | 29 | Conn().Log().Debug() << "Paths resolved are: " << paths << Endl; 30 | 31 | if (paths.empty()) 32 | { 33 | Conn().BeginList(); 34 | Conn().WarnLine("No paths for filemode command", MARemote); 35 | Conn().EndList(); 36 | Conn().EndResponse(); 37 | return true; 38 | } 39 | 40 | cmd += " " + paths; 41 | 42 | task.CommandRun(cmd, this); 43 | 44 | assetList.clear(); 45 | Conn() << assetList; 46 | assetList.clear(); 47 | Conn() << GetStatus(); 48 | 49 | // The OutputState and other callbacks will now output to stdout. 50 | // We just wrap up the communication here. 51 | Conn().EndResponse(); 52 | return true; 53 | } 54 | 55 | std::string SetupCommand(const CommandArgs& args) 56 | { 57 | if (args.size() < 3) 58 | { 59 | Conn().WarnLine("Too few arguments for filemode command"); 60 | return ""; // no command 61 | } 62 | 63 | std::string method = args[1]; 64 | std::string mode = args[2]; 65 | 66 | if (method == "set") 67 | { 68 | if (mode == "binary") 69 | { 70 | return "reopen -t binary "; 71 | } 72 | else if (mode == "text") 73 | { 74 | return "reopen -t text "; 75 | } 76 | else 77 | { 78 | Conn().WarnLine(std::string("Unknown filemode flag ") + mode); 79 | } 80 | } 81 | else 82 | { 83 | Conn().WarnLine(std::string("Unknown filemode method ") + method); 84 | } 85 | return ""; 86 | } 87 | 88 | } cFileModePt; 89 | -------------------------------------------------------------------------------- /P4Plugin/Source/P4FileSetBaseCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "P4FileSetBaseCommand.h" 2 | #include "P4Task.h" 3 | #include "P4Utility.h" 4 | 5 | P4FileSetBaseCommand::P4FileSetBaseCommand(const char* name, const char* cmdstr) 6 | : P4Command(name), m_CmdStr(cmdstr) 7 | { 8 | } 9 | 10 | bool P4FileSetBaseCommand::Run(P4Task& task, const CommandArgs& args) 11 | { 12 | ClearStatus(); 13 | Conn().Log().Info() << args[0] << "::Run()" << Endl; 14 | 15 | ReadConnection(); 16 | 17 | VersionedAssetList assetList; 18 | Conn() >> assetList; 19 | 20 | if (Run(task, args, assetList)) 21 | { 22 | // Stat the files to get the most recent state. 23 | // This could probably be optimized by reading the output of the specific 24 | // commands and figure out the new state. 25 | RunAndSendStatus(task, assetList); 26 | } 27 | 28 | // The OutputState and other callbacks will now output to stdout. 29 | // We just wrap up the communication here. 30 | Conn().EndResponse(); 31 | return true; 32 | } 33 | 34 | bool P4FileSetBaseCommand::Run(P4Task& task, const CommandArgs& args, const VersionedAssetList& assetList) 35 | { 36 | std::string cmd = SetupCommand(args); 37 | std::string paths = ResolvePaths(assetList, GetResolvePathFlags()); 38 | 39 | Conn().Log().Debug() << "Paths resolved are: " << paths << Endl; 40 | 41 | if (paths.empty()) 42 | { 43 | Conn().WarnLine("No paths in fileset perforce command", MARemote); 44 | return false; 45 | } 46 | 47 | cmd += " " + paths; 48 | 49 | task.CommandRun(cmd, this); 50 | Conn() << GetStatus(); 51 | return true; 52 | } 53 | 54 | std::string P4FileSetBaseCommand::SetupCommand(const CommandArgs& args) 55 | { 56 | return m_CmdStr; 57 | } 58 | 59 | int P4FileSetBaseCommand::GetResolvePathFlags() const 60 | { 61 | return kPathWild | kPathRecursive; 62 | } 63 | -------------------------------------------------------------------------------- /P4Plugin/Source/P4FileSetBaseCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "P4Command.h" 3 | 4 | class P4Task; 5 | 6 | class P4FileSetBaseCommand : public P4Command 7 | { 8 | public: 9 | P4FileSetBaseCommand(const char* name, const char* cmdstr = ""); 10 | virtual bool Run(P4Task& task, const CommandArgs& args); 11 | virtual void ReadConnection() { } 12 | virtual std::string SetupCommand(const CommandArgs& args); 13 | virtual int GetResolvePathFlags() const; 14 | protected: 15 | bool Run(P4Task& task, const CommandArgs& args, const VersionedAssetList& assetList); 16 | 17 | private: 18 | const std::string m_CmdStr; 19 | }; 20 | 21 | -------------------------------------------------------------------------------- /P4Plugin/Source/P4Info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | struct P4Info 5 | { 6 | bool clientIsKnown; 7 | std::string clientName; 8 | std::string currentDir; 9 | std::string peerAddress; 10 | std::string clientAddress; 11 | std::string serverAddress; 12 | std::string serverRoot; 13 | std::string serverVersion; 14 | std::string serverLicense; 15 | std::string caseHandling; 16 | }; 17 | -------------------------------------------------------------------------------- /P4Plugin/Source/P4LockCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "P4FileSetBaseCommand.h" 2 | 3 | static class P4LockCommand : public P4FileSetBaseCommand 4 | { 5 | public: 6 | P4LockCommand() : P4FileSetBaseCommand("lock", "lock") {} 7 | 8 | virtual void OutputInfo( char level, const char *data ) 9 | { 10 | std::string d(data); 11 | 12 | if (d.find("already locked by") != std::string::npos) 13 | { 14 | Conn().WarnLine(data, MARemote); 15 | } 16 | else 17 | { 18 | P4Command::OutputInfo(level, data); 19 | } 20 | } 21 | 22 | } cLock; 23 | -------------------------------------------------------------------------------- /P4Plugin/Source/P4LogoutCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "P4Command.h" 2 | #include "P4Task.h" 3 | #include "Utility.h" 4 | #include 5 | 6 | class P4LogoutCommand : public P4Command 7 | { 8 | public: 9 | P4LogoutCommand(const char* name) : P4Command(name) { } 10 | virtual bool Run(P4Task& task, const CommandArgs& args) 11 | { 12 | 13 | if (!task.IsConnected()) 14 | task.Reconnect(); 15 | 16 | if (!task.IsConnected()) 17 | { 18 | Conn().Log().Debug() << "Cannot logout with no connection" << Endl; 19 | return true; 20 | } 21 | 22 | if (!task.CommandRunNoLogin("logout", this)) 23 | { 24 | std::string errorMessage = GetStatusMessage(); 25 | Conn().Log().Fatal() << errorMessage << Endl; 26 | } 27 | 28 | return true; 29 | } 30 | 31 | // Default handler of P4 error output. Called by the default P4Command::Message() handler. 32 | void HandleError( Error *err ) 33 | { 34 | return; 35 | } 36 | 37 | } cLogout("logout"); 38 | -------------------------------------------------------------------------------- /P4Plugin/Source/P4MFA.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Connection.h" 3 | 4 | class P4MFA 5 | { 6 | public: 7 | P4MFA(); 8 | ~P4MFA(); 9 | 10 | bool WaitForHelixMFA(Connection& conn, std::string port, std::string user, std::string& error); 11 | 12 | static P4MFA* s_Singleton; 13 | }; -------------------------------------------------------------------------------- /P4Plugin/Source/P4OSX.mm: -------------------------------------------------------------------------------- 1 | #include "P4Task.h" 2 | #import 3 | 4 | bool P4Task::ShowOKCancelDialogBox(const std::string& windowTitle, const std::string& message) 5 | { 6 | NSString *nsWindowTitle = [NSString stringWithUTF8String:windowTitle.c_str()]; 7 | NSString *nsMessage = [NSString stringWithUTF8String:message.c_str()]; 8 | 9 | CFOptionFlags cfRes; 10 | CFUserNotificationDisplayAlert(0, kCFUserNotificationNoteAlertLevel, 11 | NULL, NULL, NULL, 12 | (__bridge CFStringRef)nsWindowTitle, 13 | (__bridge CFStringRef)nsMessage, 14 | CFSTR("Cancel"), 15 | CFSTR("OK"), 16 | NULL, 17 | &cfRes); 18 | 19 | return cfRes == kCFUserNotificationAlternateResponse; 20 | } 21 | -------------------------------------------------------------------------------- /P4Plugin/Source/P4Plugin_Posix.cpp: -------------------------------------------------------------------------------- 1 | #include "P4Task.h" 2 | #include "CommandLine.h" 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | // Program Entry point and set-up for OSX 9 | int main(int argc, char **argv) 10 | { 11 | const bool istestmode = argc > 1 ? std::string(argv[1]) == "-test" : false; 12 | P4Task task; 13 | return task.Run(istestmode); 14 | } 15 | -------------------------------------------------------------------------------- /P4Plugin/Source/P4Plugin_WIN.cpp: -------------------------------------------------------------------------------- 1 | #include "P4Task.h" 2 | #include "CommandLine.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | // Program Entry point and set-up for windows 9 | int __stdcall WinMain(HINSTANCE instance, HINSTANCE prevInstance, char* cmdLine, int cmdShow) 10 | { 11 | std::string args(cmdLine); 12 | const bool istestmode = args.find("-test") != std::string::npos ? true : false; 13 | P4Task task; 14 | return task.Run(istestmode); 15 | } 16 | -------------------------------------------------------------------------------- /P4Plugin/Source/P4QueryConfigParametersCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "P4Command.h" 2 | #include "P4Task.h" 3 | 4 | class P4QueryConfigParametersCommand : public P4Command 5 | { 6 | public: 7 | P4QueryConfigParametersCommand(const char* name) : P4Command(name) {} 8 | virtual bool Run(P4Task& task, const CommandArgs& args) 9 | { 10 | Conn().DataLine("text username"); 11 | Conn().DataLine("text password"); 12 | Conn().DataLine("hostAndPort server localhost 1666"); 13 | Conn().DataLine("text workspace"); 14 | Conn().DataLine(""); 15 | 16 | return true; 17 | } 18 | } cQueryConfigParameters("queryConfigParameters"); 19 | -------------------------------------------------------------------------------- /P4Plugin/Source/P4ResolveCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "VersionedAsset.h" 2 | #include "Changes.h" 3 | #include "P4FileSetBaseCommand.h" 4 | #include "P4Task.h" 5 | #include "P4Utility.h" 6 | 7 | class P4ResolveCommand : public P4FileSetBaseCommand 8 | { 9 | public: 10 | P4ResolveCommand() : P4FileSetBaseCommand("resolve") { } 11 | 12 | virtual std::string SetupCommand(const CommandArgs& args) 13 | { 14 | // 'mine' in p4 is always the actual source file. Unity merges 15 | // into the actual source file which makes them the same case. 16 | // This is in contrast to e.g. svn which have a specific .mine 17 | return 18 | args.size() > 1 && (args[1] == "mine" || args[1] == "merged") ? 19 | "resolve -ay " : 20 | "resolve -at "; 21 | } 22 | 23 | } cResolve; 24 | -------------------------------------------------------------------------------- /P4Plugin/Source/P4RevertChangesCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "Changes.h" 2 | #include "P4Command.h" 3 | #include "P4Task.h" 4 | 5 | class P4RevertChangesCommand : public P4Command 6 | { 7 | public: 8 | P4RevertChangesCommand(const char* name) : P4Command(name){} 9 | virtual bool Run(P4Task& task, const CommandArgs& args) 10 | { 11 | ClearStatus(); 12 | Conn().Log().Info() << args[0] << "::Run()" << Endl; 13 | std::string errorMessage; 14 | 15 | const std::string cmd = args.size() > 1 && args[1] == "unchangedOnly" ? 16 | "revert -a -c " : 17 | "revert -c "; 18 | 19 | ChangelistRevisions changes; 20 | Conn() >> changes; 21 | 22 | if (changes.empty()) 23 | { 24 | Conn().WarnLine("Changes to revert is empty", MARemote); 25 | Conn().EndResponse(); 26 | return true; 27 | } 28 | 29 | std::string cl; 30 | for (ChangelistRevisions::const_iterator i = changes.begin(); i != changes.end(); ++i) 31 | { 32 | std::string rev = *i == kDefaultListRevision ? std::string("default") : *i; 33 | std::string cmdr = cmd + " \"" + rev + "\""; 34 | 35 | if (!task.CommandRun(cmdr, this)) 36 | break; 37 | } 38 | 39 | // The OutputState and other callbacks will now output to stdout. 40 | // We just wrap up the communication here. 41 | Conn() << GetStatus(); 42 | 43 | // @TODO: send changed assets 44 | VersionedAssetList dummy; 45 | Conn() << dummy; 46 | 47 | Conn().EndResponse(); 48 | 49 | return true; 50 | } 51 | } cRevertChanges("revertChanges"); 52 | -------------------------------------------------------------------------------- /P4Plugin/Source/P4StatusBaseCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "P4Command.h" 3 | class VersionedAsset; 4 | 5 | // Base for status commands 6 | class P4StatusBaseCommand : public P4Command 7 | { 8 | public: 9 | P4StatusBaseCommand(const char* name, bool streamResultToConnection = true); 10 | 11 | // Called once per file for status commands 12 | virtual void OutputStat( StrDict *varList ); 13 | virtual void HandleError( Error *err ); 14 | bool AddUnknown(VersionedAsset& current, const std::string& value); 15 | protected: 16 | bool m_StreamResultToConnection; 17 | VersionedAssetList m_StatusResult; 18 | }; 19 | -------------------------------------------------------------------------------- /P4Plugin/Source/P4StatusCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "P4StatusBaseCommand.h" 3 | 4 | class P4StatusCommand : public P4StatusBaseCommand 5 | { 6 | public: 7 | P4StatusCommand(const char* name); 8 | virtual bool Run(P4Task& task, const CommandArgs& args); 9 | void RunAndSend(P4Task& task, const VersionedAssetList& assets, bool recursive); 10 | void Run(P4Task& task, const VersionedAssetList& assetList, bool recursive, VersionedAssetList& result); 11 | private: 12 | void PreStatus(); 13 | void PostStatus(); 14 | bool m_WasOnline; 15 | }; 16 | -------------------------------------------------------------------------------- /P4Plugin/Source/P4Stream.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | struct P4Stream 6 | { 7 | std::string stream; 8 | std::string type; 9 | }; 10 | 11 | typedef std::vector P4Streams; 12 | -------------------------------------------------------------------------------- /P4Plugin/Source/P4StreamsCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "P4Command.h" 2 | #include "P4Task.h" 3 | #include "P4Stream.h" 4 | #include "Utility.h" 5 | #include 6 | 7 | class P4StreamsCommand : public P4Command 8 | { 9 | public: 10 | P4StreamsCommand(const char* name) : P4Command(name) { } 11 | virtual bool Run(P4Task& task, const CommandArgs& args) 12 | { 13 | ClearStatus(); 14 | m_Streams.clear(); 15 | 16 | if (!task.CommandRun("streams", this)) 17 | { 18 | std::string errorMessage = GetStatusMessage(); 19 | Conn().Log().Fatal() << errorMessage << Endl; 20 | return false; 21 | } 22 | else 23 | { 24 | task.SetP4Streams(m_Streams); 25 | return true; 26 | } 27 | } 28 | 29 | // Called with entire spec file as data 30 | void OutputInfo( char level, const char *data ) 31 | { 32 | std::stringstream ss(data); 33 | Conn().VerboseLine(data); 34 | size_t minlen = 5; // "Root:" 35 | 36 | std::string line; 37 | const std::string streamPrefix = "Stream "; 38 | while ( getline(ss, line) ) 39 | { 40 | if (StartsWith(line, streamPrefix)) 41 | { 42 | // TODO: safety 43 | std::vector toks; 44 | Tokenize(toks, line); 45 | 46 | P4Stream s; 47 | s.stream = toks[1]; 48 | s.type = toks[2]; 49 | m_Streams.push_back(s); 50 | } 51 | } 52 | } 53 | 54 | 55 | void HandleError( Error *err ) 56 | { 57 | if ( err == 0 ) 58 | return; 59 | 60 | StrBuf buf; 61 | err->Fmt(&buf); 62 | std::string value(buf.Text()); 63 | 64 | if (value.find("No such stream.") != std::string::npos) 65 | { 66 | Conn().Log().Debug() << value << Endl; 67 | return; 68 | } 69 | 70 | P4Command::HandleError(err); 71 | } 72 | 73 | private: 74 | P4Streams m_Streams; 75 | 76 | } cStreams("streams"); 77 | -------------------------------------------------------------------------------- /P4Plugin/Source/P4UnlockCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "P4FileSetBaseCommand.h" 2 | 3 | P4FileSetBaseCommand cUnlock("unlock", "unlock"); 4 | -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/include/p4/base64.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995, 1996 Perforce Software. All rights reserved. 3 | * 4 | * This file is part of Perforce - the FAST SCM System. 5 | */ 6 | 7 | 8 | /* 9 | * BASE64 - decode base64 strings 10 | * 11 | */ 12 | 13 | class Base64 14 | { 15 | public: 16 | static int Decode( StrPtr &in, StrBuf &out ); 17 | static void Encode( StrPtr &in, StrBuf &out ); 18 | } ; 19 | -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/include/p4/charset.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005 Perforce Software. All rights reserved. 3 | * 4 | * This file is part of Perforce - the FAST SCM System. 5 | */ 6 | 7 | /* 8 | * GlobalCharSet -- a static charSet index across the process. 9 | */ 10 | 11 | class GlobalCharSet { 12 | 13 | public: 14 | static void Set( int x = 0 ) { globCharSet = x; } 15 | static int Get() { return globCharSet; } 16 | 17 | private: 18 | static int globCharSet; 19 | } ; 20 | -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/include/p4/clientprog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995, 2011 Perforce Software. All rights reserved. 3 | * 4 | * This file is part of Perforce - the FAST SCM System. 5 | */ 6 | 7 | // client Progress type 8 | 9 | #define CPT_SENDFILE 1 10 | #define CPT_RECVFILE 2 11 | #define CPT_FILESTRANS 3 12 | #define CPT_COMPUTATION 4 13 | 14 | #define CPU_UNSPECIFIED 0 15 | #define CPU_PERCENT 1 16 | #define CPU_FILES 2 17 | #define CPU_KBYTES 3 18 | #define CPU_MBYTES 4 19 | 20 | class ClientProgress 21 | { 22 | public: 23 | virtual ~ClientProgress() {}; 24 | virtual void Description( const StrPtr *desc, int units ) = 0; 25 | virtual void Total( long ) = 0; 26 | virtual int Update( long ) = 0; 27 | virtual void Done( int fail ) = 0; 28 | }; 29 | 30 | class ClientProgressText : public ClientProgress 31 | { 32 | public: 33 | ClientProgressText( int ); 34 | virtual ~ClientProgressText(); 35 | void Description( const StrPtr *description, int units ); 36 | void Total( long ); 37 | int Update( long ); 38 | void Done( int fail ); 39 | private: 40 | int cnt; 41 | long total; 42 | int typeOfProgress; 43 | int backup; 44 | StrBuf desc; 45 | }; 46 | -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/include/p4/dmextensiondata_c.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995, 2019 Perforce Software. All rights reserved. 3 | * 4 | * This file is part of Perforce - the FAST SCM System. 5 | */ 6 | 7 | # ifdef HAS_EXTENSIONS 8 | 9 | # include 10 | # include 11 | # include 12 | # include 13 | # include 14 | # include 15 | # include 16 | 17 | # include 18 | 19 | // Manage extension metadata and storage. 20 | 21 | class ExtensionDataClient : public ExtensionData 22 | { 23 | public: 24 | 25 | // Pre-install validation and installation. 26 | ExtensionDataClient( const StrBuf& archiveFile, 27 | std::optional< StrBuf > unzipPath, Error* e ); 28 | 29 | // Load an existing, installed ext. 30 | ExtensionDataClient( const StrBuf& depotFile, const int& depotRev, 31 | const StrBuf& srvExtsDir, 32 | const std::optional< StrBuf > archiveFile, 33 | Error* e ); 34 | 35 | static const std::string nameDelimiter; 36 | 37 | private: 38 | 39 | } ; 40 | 41 | # else 42 | 43 | class ExtensionDataClient 44 | { 45 | public: 46 | 47 | ExtensionDataClient( const StrBuf& archiveFile, Error* e ) {} 48 | 49 | ExtensionDataClient( const StrBuf& depotFile, const int& depotRev, 50 | const StrBuf& srvExtsDir, 51 | StrBuf archiveFile, Error* e ) {} 52 | 53 | } ; 54 | 55 | # endif 56 | -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/include/p4/echoctl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2001 Perforce Software. All rights reserved. 3 | * 4 | * This file is part of Perforce - the FAST SCM System. 5 | */ 6 | 7 | /* 8 | * NoEcho -- Turn terminal echoing off/on 9 | * 10 | * Declaring a NoEcho object turns off terminal echoing (if possible). 11 | * Deleting it turns it back on. 12 | */ 13 | 14 | struct EchoContext; 15 | 16 | class NoEcho { 17 | 18 | public: 19 | NoEcho(); 20 | ~NoEcho(); 21 | 22 | void SetCleanup( bool v ); 23 | 24 | private: 25 | EchoContext *context; 26 | bool cleanup; 27 | 28 | } ; 29 | -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/include/p4/errornum.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995, 1996 Perforce Software. All rights reserved. 3 | */ 4 | 5 | /* 6 | * Errornum.h - error number definitions 7 | */ 8 | 9 | enum ErrorGeneric { 10 | 11 | EV_NONE = 0, // misc 12 | 13 | // The fault of the user 14 | 15 | EV_USAGE = 0x01, // request not consistent with dox 16 | EV_UNKNOWN = 0x02, // using unknown entity 17 | EV_CONTEXT = 0x03, // using entity in wrong context 18 | EV_ILLEGAL = 0x04, // trying to do something you can't 19 | EV_NOTYET = 0x05, // something must be corrected first 20 | EV_PROTECT = 0x06, // protections prevented operation 21 | 22 | // No fault at all 23 | 24 | EV_EMPTY = 0x11, // action returned empty results 25 | 26 | // not the fault of the user 27 | 28 | EV_FAULT = 0x21, // inexplicable program fault 29 | EV_CLIENT = 0x22, // client side program errors 30 | EV_ADMIN = 0x23, // server administrative action required 31 | EV_CONFIG = 0x24, // client configuration inadequate 32 | EV_UPGRADE = 0x25, // client or server too old to interact 33 | EV_COMM = 0x26, // communications error 34 | EV_TOOBIG = 0x27 // not ever Perforce can handle this much 35 | 36 | } ; 37 | 38 | enum ErrorSubsystem { 39 | 40 | ES_OS = 0, // OS error 41 | ES_SUPP = 1, // Misc support 42 | ES_LBR = 2, // librarian 43 | ES_RPC = 3, // messaging 44 | ES_DB = 4, // database 45 | ES_DBSUPP = 5, // database support 46 | ES_DM = 6, // data manager 47 | ES_SERVER = 7, // top level of server 48 | ES_CLIENT = 8, // top level of client 49 | ES_INFO = 9, // pseudo subsystem for information messages 50 | ES_HELP = 10, // pseudo subsystem for help messages 51 | ES_SPEC = 11, // pseudo subsystem for spec/comment messages 52 | ES_FTPD = 12, // P4FTP server 53 | ES_BROKER = 13, // Perforce Broker 54 | ES_P4QT = 14, // P4V and other Qt based clients 55 | ES_X3SERVER = 15, // P4X3 server 56 | ES_GRAPH = 16, // graph depot messages 57 | ES_SCRIPT = 17, // scripting 58 | ES_SERVER2 = 18, // server overflow 59 | } ; 60 | -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/include/p4/hostenv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995, 1996 Perforce Software. All rights reserved. 3 | * 4 | * This file is part of Perforce - the FAST SCM System. 5 | */ 6 | 7 | /* 8 | * Hostenv.h - describe user's environment 9 | * 10 | * Fills result and returns for cwd/host/user. Returns 0 if not found. 11 | * 12 | * Public methods: 13 | * 14 | * HostEnv::GetCwd() - return the processes current working directory 15 | * HostEnv::GetHost() - return the host name 16 | * HostEnv::GetUser() - return the invoking user name 17 | * HostEnv::GetTicketFile() - return the user ticket file location 18 | * HostEnv::GetUid() - return the user id #, platform specific 19 | */ 20 | 21 | class Enviro; 22 | class Error; 23 | 24 | class HostEnv { 25 | 26 | public: 27 | static void GetCwdbyCS( StrBuf &result, int charset ); 28 | int GetCwd( StrBuf &result, Enviro * = 0 ); 29 | static void GetCwdbyCS( StrBuf &result, Error *e, int charset ); 30 | int GetCwd( StrBuf &result, Error *e, Enviro * = 0 ); 31 | int GetHost( StrBuf &result ); 32 | int GetUser( StrBuf &result, Enviro * = 0 ); 33 | int GetTicketFile( StrBuf &result, Enviro * = 0 ); 34 | int GetTrustFile( StrBuf &result, Enviro * = 0 ); 35 | int GetAliasesFile( StrBuf &result, Enviro * = 0 ); 36 | int GetUid( int &result ); 37 | 38 | private: 39 | int GetHomeName( const StrRef &, StrBuf &, 40 | Enviro *, const char *varName ); 41 | } ; 42 | -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/include/p4/i18napi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003 Perforce Software. All rights reserved. 3 | * 4 | * This file is part of Perforce - the FAST SCM System. 5 | */ 6 | 7 | /* 8 | * I18NAPI.h - API support for charset conversion identifiers 9 | * 10 | */ 11 | 12 | class Enviro; 13 | class StrBuf; 14 | 15 | class CharSetApi { 16 | public: 17 | /* 18 | * The CharSet enum provides the values for the ClientApi::SetTrans 19 | * api call. You may need to cast to (int) 20 | */ 21 | 22 | enum CharSet { 23 | CSLOOKUP_ERROR = -1, // Do not change this value - compatibility 24 | NOCONV = 0, UTF_8, ISO8859_1, UTF_16, SHIFTJIS, EUCJP, 25 | WIN_US_ANSI, WIN_US_OEM, MACOS_ROMAN, ISO8859_15, ISO8859_5, 26 | KOI8_R, WIN_CP_1251, UTF_16_LE, UTF_16_BE, 27 | UTF_16_LE_BOM, UTF_16_BE_BOM, UTF_16_BOM, UTF_8_BOM, UTF_32, 28 | UTF_32_LE, UTF_32_BE, UTF_32_LE_BOM, UTF_32_BE_BOM, UTF_32_BOM, 29 | UTF_8_UNCHECKED, UTF_8_UNCHECKED_BOM, CP949, CP936, CP950, 30 | CP850, CP858, CP1253, CP737, ISO8859_7, CP1250, CP852, ISO8859_2 31 | }; 32 | 33 | static CharSet Lookup(const char *, Enviro * = 0); 34 | 35 | static CharSet Discover(Enviro * = 0); 36 | 37 | static const char *Name(CharSet); 38 | 39 | static int Granularity(CharSet); 40 | 41 | static int isUnicode(CharSet); 42 | 43 | static unsigned int CharSetCount(); 44 | 45 | static void NormalizeLanguage( StrBuf& lang ); 46 | }; 47 | -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/include/p4/ident.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995, 1996 Perforce Software. All rights reserved. 3 | * 4 | * This file is part of Perforce - the FAST SCM System. 5 | */ 6 | 7 | # define IdentMagic "@(#)" 8 | 9 | class Ident { 10 | 11 | public: 12 | void GetMessage( StrBuf *s, int isServer = 0 ); 13 | const char * GetIdent() { return ident + sizeof( IdentMagic ) - 1; } 14 | const char * GetDate() { return supportDate; } 15 | 16 | // private, but statically initialized 17 | 18 | const char *ident; 19 | const char *supportDate; 20 | 21 | }; 22 | -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/include/p4/ignore.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995, 2003 Perforce Software. All rights reserved. 3 | * 4 | * This file is part of Perforce - the FAST SCM System. 5 | */ 6 | 7 | # define DEBUG_MATCH ( p4debug.GetLevel( DT_MAP ) >= 3 ) 8 | # define DEBUG_LIST ( p4debug.GetLevel( DT_MAP ) >= 4 ) 9 | 10 | 11 | class IgnoreTable; 12 | struct IgnoreItem; 13 | class StrArray; 14 | class FileSys; 15 | 16 | class Ignore { 17 | 18 | public: 19 | Ignore(); 20 | ~Ignore(); 21 | 22 | int Reject( const StrPtr &path, const StrPtr &ignoreName ) 23 | { return Reject( path, ignoreName, (char *)NULL ); } 24 | 25 | int List( const StrPtr &path, const StrPtr &ignoreName, 26 | const char *configName, StrArray *outList ); 27 | int Reject( const StrPtr &path, const StrPtr &ignName, 28 | const char *configName, StrBuf *line = 0 ); 29 | int RejectDir( const StrPtr &path, const StrPtr &ignName, 30 | const char *configName, StrBuf *line = 0 ); 31 | int RejectCheck( const StrPtr &path, int isDir, 32 | StrBuf *line = 0 ); 33 | 34 | int GetIgnoreFiles( const StrPtr &ignoreName, int absolute, 35 | int relative, StrArray &ignoreFiles ); 36 | 37 | private: 38 | void BuildIgnoreFiles( const StrPtr &ignoreName ); 39 | int Build( const StrPtr &path, const StrPtr &ignoreName, 40 | const char *configName ); 41 | void InsertDefaults( StrArray *list, const char *cfgName ); 42 | void Insert( StrArray *subList, const char *ignore, 43 | const char *cwd, int lineno ); 44 | 45 | int ParseFile( FileSys *f, const char *cwd, 46 | StrArray *list ); 47 | 48 | IgnoreTable *ignoreTable; 49 | StrArray *ignoreList; 50 | StrBuf dirDepth; 51 | StrBuf foundDepth; 52 | 53 | StrArray *ignoreFiles; 54 | StrBuf ignoreStr; 55 | }; 56 | -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/include/p4/keepalive.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995, 1996 Perforce Software. All rights reserved. 3 | * 4 | * This file is part of Perforce - the FAST SCM System. 5 | */ 6 | 7 | /* 8 | * This class has a method IsAlive() which can be called in either the 9 | * client or the server. 10 | * The other method, PollMs() is an advisory number of milliseconds 11 | * between poll calls to IsAlive(). 12 | * 13 | * 14 | * client: 15 | * KeepAlive is subclassed and an implementation of IsAlive() is 16 | * written that checks to see if the server request should be 17 | * terminated or not. Note, this feature can be programmed using 18 | * the API but must be instantiated using SetBreak() after the call 19 | * to client.Init(). 20 | * 21 | * server: 22 | * The server has a couple of places where long running queries can 23 | * stop and check to see if the client is still waiting (i.e. has not 24 | * been terminated). 25 | */ 26 | 27 | class KeepAlive { 28 | 29 | public: 30 | virtual ~KeepAlive() {}; 31 | 32 | virtual int IsAlive() = 0; 33 | virtual void Clear(){}; 34 | virtual int PollMs() { return 500; } 35 | 36 | }; 37 | -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/include/p4/macutil.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995, 1996 Perforce Software. All rights reserved. 3 | * 4 | * This file is part of Perforce - the FAST SCM System. 5 | */ 6 | 7 | #ifndef __MACUTIL_H__ 8 | #define __MACUTIL_H__ 9 | 10 | #include 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | bool WindowServicesAvailable(); 17 | bool RunCommandInNewTerminalWithCFStrRef( CFStringRef command ); 18 | bool RunCommandInNewTerminal( const char * command ); 19 | char * CreateFullPathToApplicationBundle( const char * path ); 20 | bool PathIsAFile( const char * path ); 21 | 22 | #ifdef __cplusplus 23 | }; 24 | #endif 25 | 26 | #endif // __MACUTIL_H__ 27 | 28 | -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/include/p4/mangle.h: -------------------------------------------------------------------------------- 1 | /* 2 | * mangle.h -- Mangle (encrypt/decrypt string with private key) interface 3 | */ 4 | 5 | class Mangle { 6 | 7 | public: 8 | Mangle(); 9 | 10 | void In( const StrPtr &data, const StrPtr &key, 11 | StrBuf &result, Error *e ) ; 12 | 13 | void InMD5( const StrPtr &data, const StrPtr &key, 14 | StrBuf &result, Error *e ) 15 | { 16 | DoIt( data, key, result, 0, 1, e ); 17 | }; 18 | 19 | void Out( const StrPtr &data, const StrPtr &key, 20 | StrBuf &result, Error *e ) ; 21 | 22 | void OutMD5( const StrPtr &data, const StrPtr &key, 23 | StrBuf &result, Error *e ) 24 | { 25 | DoIt( data, key, result, 1, 1, e ); 26 | }; 27 | 28 | void XOR( StrBuf &data, const StrPtr &key, Error *e ); 29 | 30 | void Mix( const char *buf ) 31 | { 32 | s2[0] = (int) *buf++; s2[1] = (int) *buf++; 33 | s2[2] = (int) *buf++; s2[3] = (int) *buf++; 34 | s2[4] = (int) *buf++; s2[5] = (int) *buf++; 35 | s2[6] = (int) *buf++; s2[7] = (int) *buf++; 36 | }; 37 | 38 | private: 39 | 40 | void DoIt( const StrPtr &data, const StrPtr &key, 41 | StrBuf &result, int direction, int digest, 42 | Error *e ); 43 | 44 | void Getdval( int direction, int m[], int k[] ); 45 | 46 | 47 | int o[8]; 48 | int pr[8]; 49 | int s0[16]; 50 | int s1[16]; 51 | int s2[8]; 52 | }; 53 | -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/include/p4/mapapi.h: -------------------------------------------------------------------------------- 1 | class MapTable; 2 | class StrPtr; 3 | class StrBuf; 4 | class StrArray; 5 | 6 | enum MapType { MapInclude, MapExclude, MapOverlay, MapOneToMany }; 7 | enum MapDir { MapLeftRight, MapRightLeft }; 8 | enum MapCase { Sensitive, Insensitive }; 9 | 10 | class MapApi 11 | { 12 | public: 13 | MapApi(void); 14 | ~MapApi(void); 15 | 16 | //Functions for getting the contents of the mapping. 17 | int Count(); 18 | const StrPtr* GetLeft ( int i ); 19 | const StrPtr* GetRight( int i ); 20 | MapType GetType ( int i ); 21 | 22 | //Functions for changing the contents of the mapping. 23 | void Clear(); 24 | void Insert( const StrPtr& lr, MapType t = MapInclude ); 25 | void Insert( const StrPtr& l, const StrPtr& r, MapType t = MapInclude ); 26 | void SetCaseSensitivity( MapCase mode ); 27 | 28 | //Functions for doing interesting things with the mapping. 29 | int Translate( const StrPtr& from, StrBuf& to, MapDir d = MapLeftRight ); 30 | int Translate( const StrPtr& from, StrArray& to, MapDir d = MapLeftRight ); 31 | 32 | static MapApi* Join( MapApi* left, MapApi* right ) 33 | { return Join( left, MapLeftRight, right, MapLeftRight ); } 34 | static MapApi* Join( MapApi* m1, MapDir d1, MapApi* m2, MapDir d2 ); 35 | 36 | private: 37 | MapTable* table; 38 | MapApi( MapTable* t ); 39 | void Init(); 40 | 41 | int ambiguous; 42 | void Disambiguate(); 43 | }; 44 | -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/include/p4/msgos.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995, 2000 Perforce Software. All rights reserved. 3 | * 4 | * This file is part of Perforce - the FAST SCM System. 5 | */ 6 | 7 | /* 8 | * msgos.h - definitions of operating system specific errors 9 | */ 10 | 11 | class MsgOs { 12 | 13 | public: 14 | 15 | static ErrorId Sys; 16 | static ErrorId Sys2; 17 | static ErrorId SysUn; 18 | static ErrorId SysUn2; 19 | static ErrorId Net; 20 | static ErrorId NetUn; 21 | 22 | static ErrorId TooMany; 23 | static ErrorId Deleted; 24 | static ErrorId NoSuch; 25 | static ErrorId ChmodBetrayal; 26 | 27 | static ErrorId EmptyFork; 28 | static ErrorId NameTooLong; 29 | 30 | static ErrorId ZipExists; 31 | static ErrorId ZipOpenEntryFailed; 32 | static ErrorId ZipCloseEntryFailed; 33 | static ErrorId ZipWriteFailed; 34 | static ErrorId ZipMissing; 35 | static ErrorId ZipNoEntry; 36 | static ErrorId ZipOpenEntry; 37 | static ErrorId ZipReadFailed; 38 | static ErrorId ZlibInflateInit; 39 | static ErrorId ZlibInflateEOF; 40 | static ErrorId ZlibInflate; 41 | static ErrorId ZlibDeflateInit; 42 | static ErrorId ZlibInflateInitSeek; 43 | 44 | // Retired ErrorIds. We need to keep these so that clients 45 | // built with newer apis can commnunicate with older servers 46 | // still sending these. 47 | } ; 48 | -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/include/p4/ntmangle.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995, 1997 Perforce Software. All rights reserved. 3 | * 4 | * This file is part of Perforce - the FAST SCM System. 5 | */ 6 | 7 | /* 8 | * ntmangle.h -- demangle paths on NT 9 | * 10 | * Public functions: 11 | * 12 | * NtDemanglePath() - set a StrBuf's value using a mangled path. 13 | * The demangled value is actually saved. 14 | */ 15 | 16 | void NtDemanglePath( char *path83, StrBuf *dest ); 17 | 18 | -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/include/p4/sha1.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995, 1996 Perforce Software. All rights reserved. 3 | * 4 | * This file is part of Perforce - the FAST SCM System. 5 | */ 6 | 7 | 8 | /* 9 | * SHA1 - compute sha1 checksum given a bunch of blocks of data. This header 10 | * file includes two related classes: 11 | * 12 | * Sha1Digester: utility wrapper around the OpenSSL SHA1 libraries 13 | * to simplify computing a SHA1 of some data. 14 | * 15 | * Sha1: encapsulation of a 160-bit SHA1 value. 16 | */ 17 | 18 | # define Sha1Length 20 19 | 20 | class Sha1 21 | { 22 | public: 23 | Sha1() { Clear(); } 24 | Sha1( unsigned const char *bytes) { Import( bytes ); } 25 | 26 | ~Sha1() {} 27 | 28 | void Clear() { memset( data, 0, Sha1Length ); } 29 | 30 | void Import( unsigned const char *bytes ) 31 | { memcpy( data, bytes, Sha1Length ); } 32 | 33 | void Export( unsigned char *bytes ) const 34 | { memcpy( bytes, data, Sha1Length ); } 35 | 36 | int Compare( const Sha1 &other ) const 37 | { return memcmp( data, other.data, Sha1Length ); } 38 | 39 | int Compare( unsigned const char *bytes ) const 40 | { return memcmp( data, bytes, Sha1Length ); } 41 | 42 | void FromString( const StrPtr *sha ); 43 | 44 | void Fmt( StrBuf &buf ) const; 45 | 46 | int IsSet() const; 47 | 48 | unsigned char data [ Sha1Length ]; 49 | } ; 50 | 51 | class Sha1Digester 52 | { 53 | 54 | public: 55 | Sha1Digester(); 56 | ~Sha1Digester(); 57 | void Update( const StrPtr &buf ); 58 | void Final( StrBuf &output ); 59 | void Final( unsigned char digest[ Sha1Length ] ); 60 | void Final( Sha1 &sha ); 61 | 62 | private: 63 | void *ctx; 64 | 65 | }; 66 | 67 | -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/include/p4/sha256.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995, 1996 Perforce Software. All rights reserved. 3 | * 4 | * This file is part of Perforce - the FAST SCM System. 5 | */ 6 | 7 | 8 | /* 9 | * SHA256 - compute sha256 checksum given a bunch of blocks of data. This header 10 | * file includes two related classes: 11 | * 12 | * Sha256Digester: utility wrapper around the OpenSSL SHA256 libraries 13 | * to simplify computing a SHA256 of some data. 14 | * 15 | * Sha256: encapsulation of a 256-bit SHA256 value. 16 | */ 17 | 18 | # define Sha256Length 32 19 | 20 | class Sha256 21 | { 22 | public: 23 | Sha256() { Clear(); } 24 | Sha256( unsigned const char *bytes) { Import( bytes ); } 25 | 26 | ~Sha256() {} 27 | 28 | void Clear() { memset( data, 0, Sha256Length ); } 29 | 30 | void Import( unsigned const char *bytes ) 31 | { memcpy( data, bytes, Sha256Length ); } 32 | 33 | void Export( unsigned char *bytes ) const 34 | { memcpy( bytes, data, Sha256Length ); } 35 | 36 | int Compare( const Sha256 &other ) const 37 | { return memcmp( data, other.data, Sha256Length ); } 38 | 39 | int Compare( unsigned const char *bytes ) const 40 | { return memcmp( data, bytes, Sha256Length ); } 41 | 42 | void FromString( const StrPtr *sha ); 43 | 44 | void Fmt( StrBuf &buf ) const; 45 | 46 | int IsSet() const; 47 | 48 | unsigned char data [ Sha256Length ]; 49 | } ; 50 | 51 | class Sha256Digester 52 | { 53 | 54 | public: 55 | Sha256Digester(); 56 | ~Sha256Digester(); 57 | void Update( const StrPtr &buf ); 58 | void Final( StrBuf &output ); 59 | void Final( unsigned char digest[ Sha256Length ] ); 60 | void Final( Sha256 &sha ); 61 | 62 | private: 63 | void *ctx; 64 | 65 | }; 66 | 67 | -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/include/p4/signaler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995, 1996 Perforce Software. All rights reserved. 3 | * 4 | * This file is part of Perforce - the FAST SCM System. 5 | */ 6 | 7 | /* 8 | * Signaler.h - catch ^C and delete temp files 9 | * 10 | * A single Signaler is declared globally. 11 | * 12 | * Public methods: 13 | * 14 | * Signaler::Block() -- don't catch the signal until Catch() 15 | * Signaler::Catch() -- catch and handle SIGINT 16 | * Signaler::OnIntr() -- call a designated function on SIGINT 17 | * Signaler::DeleteOnIntr() -- undo OnIntr() call 18 | * 19 | * Signaler::Intr() -- call functions registered by OnIntr() 20 | * 21 | * Requires cooperation from the TempFile objects to delete files. 22 | */ 23 | 24 | # ifdef HAS_CPP11 25 | # include 26 | # include 27 | # else 28 | # if OS_NT 29 | typedef void *HANDLE; 30 | # endif // OS_NT 31 | # endif // HAS_CPP11 32 | 33 | struct SignalMan; 34 | 35 | typedef void (*SignalFunc)( void *ptr ); 36 | 37 | class Signaler { 38 | 39 | public: 40 | Signaler(); 41 | ~Signaler(); 42 | 43 | void Block(); 44 | void Catch(); 45 | void Disable(); 46 | void Enable(); 47 | bool GetState() const; 48 | bool IsIntr() const; 49 | 50 | void OnIntr( SignalFunc callback, void *ptr ); 51 | void DeleteOnIntr( void *ptr ); 52 | 53 | void Intr(); 54 | 55 | private: 56 | 57 | SignalMan *list; 58 | int disable; 59 | bool isIntr; 60 | 61 | // If we're compiling with the C++11 standard or higher, we use 62 | // the built-in thread support on all platforms. If not, we fall 63 | // back to only having synchronization on Windows. 64 | 65 | # ifdef HAS_CPP11 66 | std::mutex* mutex; 67 | 68 | std::mutex& GetMutex(); 69 | # else 70 | # if OS_NT 71 | HANDLE hmutex; 72 | # endif // OS_NT 73 | # endif // HAS_CPP11 74 | 75 | } ; 76 | 77 | extern Signaler signaler; 78 | -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/include/p4/strarray.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995, 1996 Perforce Software. All rights reserved. 3 | */ 4 | 5 | /* 6 | * strarray.h - 0 based arrays of StrBufs, StrPtrs 7 | * 8 | * Class Defined: 9 | * 10 | * StrArray - a linear list of StrBufs 11 | * StrPtrArray - a linear list of StrPtrs 12 | * 13 | * Public methods: 14 | * 15 | * Private methods: 16 | */ 17 | 18 | class StrVarArray; 19 | 20 | class StrArray { 21 | 22 | public: 23 | 24 | StrArray(); 25 | ~StrArray(); 26 | 27 | StrBuf * Put(); 28 | const StrBuf * Get(int i) const; 29 | StrBuf * Edit(int i); 30 | int Count() const ; 31 | void Clear(); 32 | void Sort( int caseFolding ); 33 | void Remove( int i ); 34 | int Search( const StrBuf *key ); 35 | const StrBuf * Find( const StrBuf *key ); 36 | 37 | private: 38 | 39 | StrVarArray *array; 40 | } ; 41 | 42 | class StrPtrArray { 43 | 44 | public: 45 | StrPtrArray(); 46 | ~StrPtrArray(); 47 | 48 | void Put( const StrPtr &val ); 49 | const StrPtr * Get( int i ) const { return &tabVal[i]; } 50 | void Clear() { tabLength = 0; } 51 | int Count() const { return tabLength; } 52 | StrPtr * Table() const { return tabVal; } 53 | 54 | private: 55 | 56 | // our own VarArray-like implementation 57 | 58 | StrRef *tabVal; 59 | int tabSize; 60 | int tabLength; 61 | 62 | } ; 63 | 64 | -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/include/p4/strxml.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2008 Perforce Software. All rights reserved. 3 | // 4 | // This file is part of Perforce - the FAST SCM System. 5 | // 6 | // StrXml: 7 | // XML output methods class 8 | 9 | #ifndef StrXml_H 10 | #define StrXml_H 11 | 12 | class StrBuf; 13 | class StrBufDict; 14 | 15 | class StrXml : public StrBuf { 16 | 17 | public: 18 | StrXml() {}; 19 | virtual ~StrXml() {}; 20 | 21 | void XMLHeader( const StrPtr *cmd, const StrPtr *args, const StrPtr *port, 22 | const StrPtr *user, const StrPtr *client, int bUnicode=0 ); 23 | void XMLOutputStat( StrDict * varList ); 24 | void XMLOutputError( char *data ); 25 | void XMLOutputText( char *data ); 26 | void XMLOutputInfo( char *data, char level ); 27 | void XMLEnd(); 28 | 29 | private: 30 | 31 | int XMLlist( StrDict * varList, int i, char * remove=NULL, char *nextup=NULL ); 32 | StrBuf& EscapeHTML( const StrPtr &s, int isUnicode=0 ); 33 | 34 | int fUnicode; 35 | StrBuf fP4Cmd; 36 | StrBuf fExtraTag; 37 | StrBuf fEscapeBuf; 38 | }; 39 | 40 | #endif // StrXml_H 41 | -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/include/p4/ticket.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004, Perforce Software. All rights reserved. 3 | * 4 | * This file is part of Perforce - the FAST SCM System. 5 | */ 6 | 7 | /* 8 | * ticket.h - get/set tickets in local ticketfile. 9 | * 10 | * Public methods: 11 | * 12 | * Ticket::GetTicket() - get a stored ticket from the ticketfile 13 | * Ticket::ReplaceTicket() - change stored ticket value 14 | * Ticket::DeleteTicket() - remove stored ticket value 15 | * Ticket::List() - list all current tickets 16 | * Ticket::List() - list current tickets of a specific user 17 | */ 18 | 19 | class FileSys; 20 | class TicketTable; 21 | 22 | class Ticket { 23 | 24 | public: 25 | Ticket( const StrPtr *path ); 26 | ~Ticket(); 27 | 28 | char *GetTicket( StrPtr &port, StrPtr &user ); 29 | 30 | void ReplaceTicket( const StrPtr &port, StrPtr &user, 31 | StrPtr &ticket, Error *e ) 32 | { UpdateTicket( port, user, ticket, 0, e ); } 33 | 34 | void DeleteTicket( const StrPtr &port, StrPtr &user, 35 | Error *e ) 36 | { UpdateTicket( port, user, user, 1, e ); } 37 | 38 | void List( StrBuf & ); 39 | 40 | void ListUser( const StrPtr &, StrBuf & ); 41 | 42 | private: 43 | 44 | int Init( ); 45 | void ReadTicketFile( Error *e ); 46 | void WriteTicketFile( Error *e ); 47 | void UpdateTicket( const StrPtr &port, StrPtr &user, 48 | StrPtr &ticket, int remove, Error *e ); 49 | 50 | TicketTable *ticketTab; 51 | FileSys *ticketFile; 52 | const StrPtr *path; 53 | }; 54 | -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/include/p4/validate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995, 2003 Perforce Software. All rights reserved. 3 | * 4 | * This file is part of Perforce - the FAST SCM System. 5 | */ 6 | 7 | /* 8 | * ValidateCharSet 9 | */ 10 | 11 | class CharSetValid { 12 | public: 13 | virtual ~CharSetValid(); 14 | virtual void Reset() = 0; 15 | virtual int Valid( const char *buf, int len, const char **retp = 0 ) = 0; 16 | }; 17 | 18 | class CharSetUTF8Valid : public CharSetValid { 19 | int followcnt; 20 | int magic; 21 | static unsigned char validmap[256]; 22 | public: 23 | CharSetUTF8Valid(); 24 | void Reset(); 25 | int Valid( const char *buf, int len, const char **retp = 0 ); 26 | }; 27 | -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/linux32/libclient.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/linux32/libclient.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/linux32/libp4script.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/linux32/libp4script.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/linux32/libp4script_c.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/linux32/libp4script_c.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/linux32/libp4script_curl.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/linux32/libp4script_curl.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/linux32/libp4script_sqlite.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/linux32/libp4script_sqlite.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/linux32/libp4sslstub.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/linux32/libp4sslstub.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/linux32/librpc.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/linux32/librpc.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/linux32/libsupp.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/linux32/libsupp.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/linux64/libclient.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/linux64/libclient.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/linux64/libcrypto.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/linux64/libcrypto.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/linux64/libp4script.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/linux64/libp4script.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/linux64/libp4script_c.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/linux64/libp4script_c.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/linux64/libp4script_curl.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/linux64/libp4script_curl.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/linux64/libp4script_sqlite.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/linux64/libp4script_sqlite.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/linux64/librpc.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/linux64/librpc.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/linux64/libssl.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/linux64/libssl.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/linux64/libsupp.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/linux64/libsupp.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/osx32/libclient.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/osx32/libclient.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/osx32/libp4script.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/osx32/libp4script.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/osx32/libp4script_c.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/osx32/libp4script_c.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/osx32/libp4script_curl.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/osx32/libp4script_curl.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/osx32/libp4script_sqlite.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/osx32/libp4script_sqlite.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/osx32/libp4sslstub.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/osx32/libp4sslstub.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/osx32/librpc.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/osx32/librpc.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/osx32/libsupp.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/osx32/libsupp.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/osx64/libclient.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/osx64/libclient.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/osx64/libcrypto.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/osx64/libcrypto.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/osx64/libp4script.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/osx64/libp4script.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/osx64/libp4script_c.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/osx64/libp4script_c.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/osx64/libp4script_curl.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/osx64/libp4script_curl.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/osx64/libp4script_sqlite.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/osx64/libp4script_sqlite.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/osx64/librpc.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/osx64/librpc.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/osx64/libssl.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/osx64/libssl.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/osx64/libsupp.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/osx64/libsupp.a -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/win32/libclient.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/win32/libclient.lib -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/win32/libeay32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/win32/libeay32.lib -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/win32/libp4script.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/win32/libp4script.lib -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/win32/libp4script_c.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/win32/libp4script_c.lib -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/win32/libp4script_curl.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/win32/libp4script_curl.lib -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/win32/libp4script_sqlite.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/win32/libp4script_sqlite.lib -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/win32/librpc.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/win32/librpc.lib -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/win32/libsupp.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/win32/libsupp.lib -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/win32/ssleay32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/win32/ssleay32.lib -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/win32debug/libclient.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/win32debug/libclient.lib -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/win32debug/libeay32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/win32debug/libeay32.lib -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/win32debug/libp4script.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/win32debug/libp4script.lib -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/win32debug/libp4script_c.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/win32debug/libp4script_c.lib -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/win32debug/libp4script_curl.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/win32debug/libp4script_curl.lib -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/win32debug/libp4script_sqlite.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/win32debug/libp4script_sqlite.lib -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/win32debug/librpc.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/win32debug/librpc.lib -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/win32debug/libsupp.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/win32debug/libsupp.lib -------------------------------------------------------------------------------- /P4Plugin/Source/r19.1/lib/win32debug/ssleay32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/P4Plugin/Source/r19.1/lib/win32debug/ssleay32.lib -------------------------------------------------------------------------------- /TFSPlugin/Binaries/TfsPlugin readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/TFSPlugin/Binaries/TfsPlugin readme.txt -------------------------------------------------------------------------------- /TFSPlugin/Binaries/TfsPlugin.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/TFSPlugin/Binaries/TfsPlugin.exe -------------------------------------------------------------------------------- /TFSPlugin/Packages/Microsoft.TeamFoundation/12.0/Microsoft.TeamFoundation.Client.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/TFSPlugin/Packages/Microsoft.TeamFoundation/12.0/Microsoft.TeamFoundation.Client.dll -------------------------------------------------------------------------------- /TFSPlugin/Packages/Microsoft.TeamFoundation/12.0/Microsoft.TeamFoundation.Common.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/TFSPlugin/Packages/Microsoft.TeamFoundation/12.0/Microsoft.TeamFoundation.Common.dll -------------------------------------------------------------------------------- /TFSPlugin/Packages/Microsoft.TeamFoundation/12.0/Microsoft.TeamFoundation.Diff.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/TFSPlugin/Packages/Microsoft.TeamFoundation/12.0/Microsoft.TeamFoundation.Diff.dll -------------------------------------------------------------------------------- /TFSPlugin/Packages/Microsoft.TeamFoundation/12.0/Microsoft.TeamFoundation.VersionControl.Client.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/TFSPlugin/Packages/Microsoft.TeamFoundation/12.0/Microsoft.TeamFoundation.VersionControl.Client.dll -------------------------------------------------------------------------------- /TFSPlugin/Packages/Microsoft.TeamFoundation/12.0/Microsoft.TeamFoundation.VersionControl.Common.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/TFSPlugin/Packages/Microsoft.TeamFoundation/12.0/Microsoft.TeamFoundation.VersionControl.Common.dll -------------------------------------------------------------------------------- /TFSPlugin/Packages/Microsoft.TeamFoundation/12.0/Microsoft.VisualStudio.Services.Client.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/TFSPlugin/Packages/Microsoft.TeamFoundation/12.0/Microsoft.VisualStudio.Services.Client.dll -------------------------------------------------------------------------------- /TFSPlugin/Packages/Microsoft.TeamFoundation/12.0/Microsoft.VisualStudio.Services.Common.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/TFSPlugin/Packages/Microsoft.TeamFoundation/12.0/Microsoft.VisualStudio.Services.Common.dll -------------------------------------------------------------------------------- /TFSPlugin/Packages/Microsoft.TeamFoundation/14.0/Microsoft.TeamFoundation.Client.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/TFSPlugin/Packages/Microsoft.TeamFoundation/14.0/Microsoft.TeamFoundation.Client.dll -------------------------------------------------------------------------------- /TFSPlugin/Packages/Microsoft.TeamFoundation/14.0/Microsoft.TeamFoundation.Common.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/TFSPlugin/Packages/Microsoft.TeamFoundation/14.0/Microsoft.TeamFoundation.Common.dll -------------------------------------------------------------------------------- /TFSPlugin/Packages/Microsoft.TeamFoundation/14.0/Microsoft.TeamFoundation.Diff.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/TFSPlugin/Packages/Microsoft.TeamFoundation/14.0/Microsoft.TeamFoundation.Diff.dll -------------------------------------------------------------------------------- /TFSPlugin/Packages/Microsoft.TeamFoundation/14.0/Microsoft.TeamFoundation.VersionControl.Client.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/TFSPlugin/Packages/Microsoft.TeamFoundation/14.0/Microsoft.TeamFoundation.VersionControl.Client.dll -------------------------------------------------------------------------------- /TFSPlugin/Packages/Microsoft.TeamFoundation/14.0/Microsoft.TeamFoundation.VersionControl.Common.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/TFSPlugin/Packages/Microsoft.TeamFoundation/14.0/Microsoft.TeamFoundation.VersionControl.Common.dll -------------------------------------------------------------------------------- /TFSPlugin/Packages/Microsoft.TeamFoundation/14.0/Microsoft.VisualStudio.Services.Client.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/TFSPlugin/Packages/Microsoft.TeamFoundation/14.0/Microsoft.VisualStudio.Services.Client.dll -------------------------------------------------------------------------------- /TFSPlugin/Packages/Microsoft.TeamFoundation/14.0/Microsoft.VisualStudio.Services.Common.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/TFSPlugin/Packages/Microsoft.TeamFoundation/14.0/Microsoft.VisualStudio.Services.Common.dll -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/TFSPlugin/TfsPlugin readme.txt -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin.UnitTestProject/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("TfsPlugin.UnitTestProject")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("TfsPlugin.UnitTestProject")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("a00eac02-e642-45af-aba4-3e465458b0cd")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin.UnitTestProject/TestResources/TfsSettings/NoOverrideSettings.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/Assets/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ccdbcd78fb05e18448c31bef5dd80138 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/Assets/Scenes/Development.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c5753b5be8215c740a00b43a28c6d40d 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/Assets/Scenes/Development/Jake.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b425c89241e9fe042a52c0746599c4bf 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/Assets/Scenes/Development/Jake/main.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/Assets/Scenes/Development/Jake/main.unity -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/Assets/Scenes/Development/Jake/main.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 40c8376db6c191846a6c5334ed257ced 3 | DefaultImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/Assets/Scenes/main.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/Assets/Scenes/main.unity -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/Assets/Scenes/main.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0018c4dcf8754864f8b9bbfe8b6d4919 3 | DefaultImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/ProjectSettings/AudioManager.asset -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/ProjectSettings/DynamicsManager.asset -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/ProjectSettings/EditorBuildSettings.asset -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/ProjectSettings/EditorSettings.asset -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/ProjectSettings/GraphicsSettings.asset -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/ProjectSettings/InputManager.asset -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/ProjectSettings/NavMeshLayers.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/ProjectSettings/NavMeshLayers.asset -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/ProjectSettings/NetworkManager.asset -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/ProjectSettings/Physics2DSettings.asset -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/ProjectSettings/ProjectSettings.asset -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/ProjectSettings/QualitySettings.asset -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/ProjectSettings/TagManager.asset -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeVersionControlPlugins/7df550c73ff297399f3fe36171ed49c0844eae45/TFSPlugin/TfsPlugin.UnitTestProject/TestResources/UnityProjects/TestOne/ProjectSettings/TimeManager.asset -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin.UnitTestProject/UnitTestSettings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | <enter ServerItem here>/TfsPlugin.UnitTestProject 7 | 8 | 9 | <enter tfs url here> 10 | 11 | 12 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin.UnitTestProject/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | <enter ServerItem here>/TfsPlugin.UnitTestProject 12 | 13 | 14 | <enter tfs url here> 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin/Common/Command.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace TfsPlugin 5 | { 6 | public enum UnityCommand 7 | { 8 | UCOM_Invalid, 9 | UCOM_Shutdown, 10 | UCOM_Add, 11 | UCOM_ChangeDescription, 12 | UCOM_ChangeMove, 13 | UCOM_ChangeStatus, 14 | UCOM_Changes, 15 | UCOM_Checkout, 16 | UCOM_Config, 17 | UCOM_DeleteChanges, 18 | UCOM_Delete, 19 | UCOM_Download, 20 | UCOM_Exit, 21 | UCOM_GetLatest, 22 | UCOM_IncomingChangeAssets, 23 | UCOM_Incoming, 24 | UCOM_Lock, 25 | UCOM_Login, 26 | UCOM_Move, 27 | UCOM_QueryConfigParameters, 28 | UCOM_Resolve, 29 | UCOM_RevertChanges, 30 | UCOM_Revert, 31 | UCOM_Status, 32 | UCOM_Submit, 33 | UCOM_Unlock, 34 | UCOM_FileMode, 35 | UCOM_CustomCommand, 36 | }; 37 | 38 | 39 | public class CommandArgs : List 40 | { 41 | 42 | } 43 | 44 | public interface ICommand 45 | where Req : BaseRequest 46 | where Resp : BaseResponse 47 | { 48 | bool Run(Sess task, Req req, Resp resp); 49 | } 50 | 51 | [Serializable] 52 | public class CommandException : Exception 53 | { 54 | public CommandException() { } 55 | public CommandException(string message) : base(message) { } 56 | public CommandException(string message, Exception inner) : base(message, inner) { } 57 | protected CommandException( 58 | System.Runtime.Serialization.SerializationInfo info, 59 | System.Runtime.Serialization.StreamingContext context) 60 | : base(info, context) { } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin/Common/Commands/Base.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace TfsPlugin 3 | { 4 | public class BaseRequest 5 | { 6 | public BaseRequest(CommandArgs args, Connection conn) 7 | { 8 | this.Args = args; 9 | this.Conn = conn; 10 | this.Invalid = false; 11 | } 12 | 13 | public CommandArgs Args { get; set; } 14 | public Connection Conn { get; set; } 15 | public bool Invalid { get; set; } 16 | } 17 | 18 | public class BaseResponse 19 | { 20 | public virtual void Write() 21 | { 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin/Common/Commands/BaseFileSet.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace TfsPlugin 3 | { 4 | public class BaseFileSetRequest : BaseRequest 5 | { 6 | public BaseFileSetRequest() 7 | : base(null, null) 8 | { 9 | 10 | } 11 | 12 | public BaseFileSetRequest(CommandArgs args, Connection conn) 13 | : base(args, conn) 14 | { 15 | Assets.Clear(); 16 | conn.Read(Assets); 17 | 18 | if (Assets.Count == 0) 19 | { 20 | Assets.Clear(); 21 | conn.Write(Assets); 22 | conn.EndResponse(); 23 | Invalid = true; 24 | } 25 | } 26 | 27 | VersionedAssetList assets = new VersionedAssetList(); 28 | public VersionedAssetList Assets { get { return assets; } } 29 | } 30 | 31 | public class BaseFileSetResponse : BaseResponse where Req : BaseFileSetRequest 32 | { 33 | 34 | public BaseFileSetResponse(Req req) 35 | { 36 | this.request = req; 37 | this.conn = req.Conn; 38 | } 39 | 40 | public override void Write() 41 | { 42 | if (request.Invalid) 43 | return; 44 | 45 | conn.Write(Assets); 46 | conn.EndResponse(); 47 | } 48 | 49 | Req request; 50 | Connection conn; 51 | 52 | VersionedAssetList assets = new VersionedAssetList(); 53 | public VersionedAssetList Assets { get { return assets; } } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin/Common/Commands/ChangeDescription.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace TfsPlugin 3 | { 4 | public class ChangeDescriptionRequest : BaseRequest 5 | { 6 | 7 | public ChangeDescriptionRequest(CommandArgs args, Connection conn) 8 | : base(args, conn) 9 | { 10 | Revision = conn.Read(); 11 | 12 | if (string.IsNullOrEmpty(Revision)) 13 | { 14 | conn.DataLine("unknown"); 15 | conn.ErrorLine("Cannot get description for empty revision"); 16 | conn.EndResponse(); 17 | Invalid = true; 18 | } 19 | } 20 | 21 | public ChangelistRevision Revision { get; set; } 22 | }; 23 | 24 | public class ChangeDescriptionResponse : BaseResponse 25 | { 26 | 27 | public ChangeDescriptionResponse(ChangeDescriptionRequest req) 28 | { 29 | request = req; 30 | conn = req.Conn; 31 | } 32 | 33 | public override void Write() 34 | { 35 | if (request.Invalid) 36 | return; 37 | 38 | conn.DataLine(Description); 39 | conn.EndResponse(); 40 | } 41 | 42 | ChangeDescriptionRequest request; 43 | Connection conn; 44 | public string Description { get; set; } 45 | }; 46 | 47 | } 48 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin/Common/Commands/Download.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace TfsPlugin 3 | { 4 | class DownloadRequest : BaseRequest 5 | { 6 | public DownloadRequest(CommandArgs args, Connection conn) 7 | : base(args, conn) 8 | { 9 | TargetDir = conn.ReadLine(); 10 | conn.Read(Revisions); 11 | conn.Read(Assets); 12 | 13 | if (Assets.Count == 0 || Revisions.Count == 0) 14 | { 15 | Assets.Clear(); 16 | conn.Write(Assets); 17 | conn.EndResponse(); 18 | Invalid = true; 19 | } 20 | } 21 | 22 | // One revisions per asset ie. the two containers are of same size 23 | public string TargetDir { get; set; } 24 | ChangelistRevisions revisions = new ChangelistRevisions(); 25 | public ChangelistRevisions Revisions { get { return revisions; } } 26 | 27 | VersionedAssetList assets = new VersionedAssetList(); 28 | public VersionedAssetList Assets { get { return assets; } } 29 | }; 30 | 31 | class DownloadResponse : BaseResponse 32 | { 33 | 34 | public DownloadResponse(DownloadRequest req) 35 | { 36 | this.request = req; 37 | this.conn = req.Conn; 38 | } 39 | 40 | public override void Write() 41 | { 42 | if (request.Invalid) 43 | return; 44 | 45 | conn.Write(Assets); 46 | conn.EndResponse(); 47 | } 48 | 49 | DownloadRequest request; 50 | Connection conn; 51 | VersionedAssetList assets = new VersionedAssetList(); 52 | public VersionedAssetList Assets { get { return assets; } } 53 | }; 54 | } 55 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin/Common/Commands/Incoming.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace TfsPlugin 4 | { 5 | public class IncomingRequest : BaseRequest 6 | { 7 | 8 | public IncomingRequest(CommandArgs args, Connection conn) 9 | : base(args, conn) 10 | { 11 | } 12 | } 13 | 14 | public class IncomingResponse : BaseResponse 15 | { 16 | 17 | public IncomingResponse(IncomingRequest req) 18 | { 19 | this.request = req; 20 | this.conn = req.Conn; 21 | } 22 | 23 | public override void Write() 24 | { 25 | if (request.Invalid) 26 | return; 27 | 28 | conn.Write(changeSets); 29 | conn.EndResponse(); 30 | } 31 | 32 | IncomingRequest request; 33 | Connection conn; 34 | List changeSets = new List(); 35 | public List ChangeSets { get { return changeSets; } } 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin/Common/Commands/IncomingAssets.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace TfsPlugin 3 | { 4 | class IncomingAssetsRequest : BaseRequest 5 | { 6 | public IncomingAssetsRequest(CommandArgs args, Connection conn) 7 | : base(args, conn) 8 | { 9 | Revision = conn.Read(); 10 | 11 | if (string.IsNullOrEmpty(Revision)) 12 | { 13 | VersionedAssetList assets = new VersionedAssetList(); 14 | conn.Write(assets); 15 | conn.ErrorLine("Cannot get assets for empty revision"); 16 | conn.EndResponse(); 17 | Invalid = true; 18 | } 19 | } 20 | 21 | public ChangelistRevision Revision { get; set; } 22 | }; 23 | 24 | class IncomingAssetsResponse : BaseResponse 25 | { 26 | public IncomingAssetsResponse(IncomingAssetsRequest req) 27 | { 28 | this.request = req; 29 | this.conn = req.Conn; 30 | } 31 | 32 | public override void Write() 33 | { 34 | if (request.Invalid) 35 | return; 36 | 37 | conn.Write(Assets); 38 | conn.EndResponse(); 39 | } 40 | 41 | IncomingAssetsRequest request; 42 | Connection conn; 43 | VersionedAssetList assets = new VersionedAssetList(); 44 | public VersionedAssetList Assets { get { return assets; } } 45 | }; 46 | } 47 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin/Common/Commands/MoveChangelist.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace TfsPlugin 3 | { 4 | public class MoveChangelistRequest : BaseRequest 5 | { 6 | public MoveChangelistRequest(CommandArgs args, Connection conn) 7 | : base(args, conn) 8 | { 9 | 10 | Changelist = conn.Read(); 11 | conn.Read(Assets); 12 | 13 | if (Assets.Count == 0) 14 | { 15 | conn.Write(Assets); 16 | conn.EndResponse(); 17 | Invalid = true; 18 | } 19 | } 20 | 21 | VersionedAssetList assets = new VersionedAssetList(); 22 | public VersionedAssetList Assets { get { return assets; } } 23 | public ChangelistRevision Changelist { get; set; } 24 | }; 25 | 26 | public class MoveChangelistResponse : BaseResponse 27 | { 28 | public MoveChangelistResponse(MoveChangelistRequest req) 29 | { 30 | request = req; 31 | conn = req.Conn; 32 | } 33 | 34 | public override void Write() 35 | { 36 | if (request.Invalid) 37 | return; 38 | 39 | conn.Write(Assets); 40 | conn.EndResponse(); 41 | } 42 | 43 | MoveChangelistRequest request; 44 | Connection conn; 45 | VersionedAssetList assets = new VersionedAssetList(); 46 | public VersionedAssetList Assets { get { return assets; } } 47 | }; 48 | 49 | } 50 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin/Common/Commands/Outgoing.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace TfsPlugin 4 | { 5 | public class OutgoingRequest : BaseRequest 6 | { 7 | 8 | public OutgoingRequest(CommandArgs args, Connection conn) 9 | : base(args, conn) 10 | { 11 | } 12 | }; 13 | 14 | public class OutgoingResponse : BaseResponse 15 | { 16 | 17 | public OutgoingResponse(OutgoingRequest req) 18 | { 19 | this.request = req; 20 | this.conn = req.Conn; 21 | } 22 | 23 | public void AddChangeSet(string name, string revision) 24 | { 25 | Changelist cl = new Changelist(); 26 | cl.SetDescription(name); 27 | cl.SetRevision(revision); 28 | ChangeSets.Add(cl); 29 | } 30 | 31 | public override void Write() 32 | { 33 | if (request.Invalid) 34 | return; 35 | 36 | conn.Write(ChangeSets); 37 | conn.EndResponse(); 38 | } 39 | 40 | OutgoingRequest request; 41 | Connection conn; 42 | List changeSets = new List(); 43 | public List ChangeSets { get { return changeSets; } } 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin/Common/Commands/OutgoingAssets.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace TfsPlugin 3 | { 4 | public class OutgoingAssetsRequest : BaseRequest 5 | { 6 | 7 | public OutgoingAssetsRequest(CommandArgs args, Connection conn) 8 | : base(args, conn) 9 | { 10 | Revision = conn.Read(); 11 | 12 | if (string.IsNullOrEmpty(Revision)) 13 | { 14 | VersionedAssetList assets = new VersionedAssetList(); 15 | conn.Write(assets); 16 | conn.ErrorLine("Cannot get assets for empty revision"); 17 | conn.EndResponse(); 18 | Invalid = true; 19 | } 20 | } 21 | 22 | public ChangelistRevision Revision { get; set; } 23 | } 24 | 25 | public class OutgoingAssetsResponse : BaseResponse 26 | { 27 | 28 | public OutgoingAssetsResponse(OutgoingAssetsRequest req) 29 | { 30 | this.request = req; 31 | this.conn = req.Conn; 32 | } 33 | 34 | public override void Write() 35 | { 36 | if (request.Invalid) 37 | return; 38 | 39 | conn.Write(Assets); 40 | conn.EndResponse(); 41 | } 42 | 43 | OutgoingAssetsRequest request; 44 | Connection conn; 45 | VersionedAssetList assets = new VersionedAssetList(); 46 | public VersionedAssetList Assets { get { return assets; } } 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin/Common/Commands/RevertChanges.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace TfsPlugin 3 | { 4 | public class RevertChangesRequest : BaseRequest 5 | { 6 | public RevertChangesRequest(CommandArgs args, Connection conn) 7 | : base(args, conn) 8 | { 9 | conn.Read(Revisions); 10 | 11 | if (Revisions.Count == 0) 12 | { 13 | conn.WarnLine("Changes to revert is empty", MessageArea.MARemote); 14 | conn.EndResponse(); 15 | Invalid = true; 16 | } 17 | } 18 | 19 | public ChangelistRevisions Revisions = new ChangelistRevisions(); 20 | } 21 | 22 | public class RevertChangesResponse : BaseResponse 23 | { 24 | 25 | public RevertChangesResponse(RevertChangesRequest req) 26 | { 27 | this.request = req; 28 | this.conn = req.Conn; 29 | } 30 | 31 | public override void Write() 32 | { 33 | if (request.Invalid) 34 | return; 35 | 36 | conn.Write(Assets); 37 | conn.EndResponse(); 38 | } 39 | 40 | RevertChangesRequest request; 41 | Connection conn; 42 | VersionedAssetList assets = new VersionedAssetList(); 43 | public VersionedAssetList Assets { get { return assets; } } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin/Common/Commands/Submit.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace TfsPlugin 3 | { 4 | public class SubmitRequest : BaseRequest 5 | { 6 | public SubmitRequest(CommandArgs args, Connection conn) 7 | : base(args, conn) 8 | { 9 | Changelist = conn.Read(); 10 | conn.Read(Assets); 11 | 12 | if (Assets.Count == 0) 13 | { 14 | conn.Write(Assets); 15 | conn.EndResponse(); 16 | Invalid = true; 17 | } 18 | } 19 | 20 | VersionedAssetList assets = new VersionedAssetList(); 21 | public VersionedAssetList Assets { get { return assets; } } 22 | public Changelist Changelist { get; set; } 23 | }; 24 | 25 | 26 | class SubmitResponse : BaseResponse 27 | { 28 | 29 | public SubmitResponse(SubmitRequest req) 30 | { 31 | this.request = req; 32 | this.conn = req.Conn; 33 | } 34 | 35 | public override void Write() 36 | { 37 | if (request.Invalid) 38 | return; 39 | 40 | conn.Write(Assets); 41 | conn.EndResponse(); 42 | } 43 | 44 | SubmitRequest request; 45 | Connection conn; 46 | VersionedAssetList assets = new VersionedAssetList(); 47 | public VersionedAssetList Assets { get { return assets; } } 48 | }; 49 | 50 | 51 | } 52 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin/Plugin/TfsChangeDescriptionCommand.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace TfsPlugin 4 | { 5 | class TfsChangeDescriptionCommand : ICommand 6 | { 7 | public bool Run(TfsTask task, ChangeDescriptionRequest req, ChangeDescriptionResponse resp) 8 | { 9 | List found = null; 10 | 11 | if (req.Revision == ChangelistRevision.kDefaultListRevision || req.Revision == ChangelistRevision.kNewListRevision) 12 | { 13 | resp.Description = string.Empty; 14 | } 15 | else 16 | { 17 | found = task.GetChangesets(new HashSet { req.Revision.ToInt() }); 18 | } 19 | 20 | if (found != null && found.Count != 0) 21 | { 22 | resp.Description = found[0].Comment; 23 | } 24 | 25 | resp.Write(); 26 | return true; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin/Plugin/TfsChangeStatusCommand.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.TeamFoundation.VersionControl.Client; 2 | 3 | namespace TfsPlugin 4 | { 5 | public class TfsChangeStatusCommand : ICommand 6 | { 7 | public bool Run(TfsTask task, OutgoingAssetsRequest req, OutgoingAssetsResponse resp) 8 | { 9 | var pending = task.Workspace.GetPendingChanges(task.ProjectPath, RecursionType.Full); 10 | var pendingChange = task.ToVersionedAssetList(pending, false); 11 | 12 | task.GetStatus(pendingChange, resp.Assets, false, true); 13 | 14 | resp.Write(); 15 | return true; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin/Plugin/TfsDeleteCommand.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.TeamFoundation.VersionControl.Client; 2 | using System; 3 | using System.Linq; 4 | using Request = TfsPlugin.BaseFileSetRequest; 5 | using Response = TfsPlugin.BaseFileSetResponse; 6 | 7 | namespace TfsPlugin 8 | { 9 | 10 | public class TfsDeleteCommand : ICommand 11 | { 12 | public bool Run(TfsTask task, Request req, Response resp) 13 | { 14 | var toDelete = req.Assets.Select(each => each.GetPath()).ToArray(); 15 | 16 | try 17 | { 18 | string[] toLock; 19 | string[] notToLock; 20 | task.SplitByLockPolicy(req.Assets, out toLock, out notToLock); 21 | 22 | var toDeleteWithPendingChanges = task.Workspace.GetPendingChanges(toDelete); 23 | 24 | if (toDeleteWithPendingChanges.Length != 0) 25 | { 26 | task.Workspace.Undo(toDeleteWithPendingChanges); 27 | } 28 | 29 | if (toLock != null && toLock.Length != 0) 30 | { 31 | task.Workspace.PendDelete(toLock, RecursionType.None, task.GetLockLevel()); 32 | } 33 | 34 | if (notToLock != null && notToLock.Length != 0) 35 | { 36 | task.Workspace.PendDelete(notToLock, RecursionType.None, LockLevel.None); 37 | } 38 | 39 | } 40 | catch (Exception e) 41 | { 42 | req.Conn.WarnLine(e.Message); 43 | } 44 | 45 | task.GetStatus(req.Assets, resp.Assets, false, true); 46 | 47 | task.WarnAboutFailureToPendChange(resp.Assets.Where(item => !item.HasState(State.kLocal) && !item.HasState(State.kDeletedLocal))); 48 | task.WarnAboutBinaryFilesCheckedOutByOthers(resp.Assets.Where(item => !(!item.HasState(State.kLocal) && !item.HasState(State.kDeletedLocal)))); 49 | 50 | resp.Write(); 51 | return true; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin/Plugin/TfsFileModeCommand.cs: -------------------------------------------------------------------------------- 1 | using Request = TfsPlugin.BaseFileSetRequest; 2 | using Response = TfsPlugin.BaseFileSetResponse; 3 | 4 | namespace TfsPlugin 5 | { 6 | public class TfsFileModeCommand : ICommand 7 | { 8 | public bool Run(TfsTask task, Request req, Response resp) 9 | { 10 | task.GetStatus(req.Assets, resp.Assets, false, true); 11 | 12 | resp.Write(); 13 | return true; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin/Plugin/TfsGetLatestCommand.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.TeamFoundation.VersionControl.Client; 2 | using System.Linq; 3 | using Request = TfsPlugin.BaseFileSetRequest; 4 | using Response = TfsPlugin.BaseFileSetResponse; 5 | 6 | namespace TfsPlugin 7 | { 8 | 9 | public class TfsGetLatestCommand : ICommand 10 | { 11 | public bool Run(TfsTask task, Request req, Response resp) 12 | { 13 | var requests = req.Assets.Select(each => new GetRequest(new ItemSpec(each.GetPath(), each.IsFolder() ? RecursionType.Full : RecursionType.None), VersionSpec.Latest)).ToArray(); 14 | task.Workspace.Get(requests, GetOptions.None); 15 | 16 | task.GetStatus(req.Assets, resp.Assets, true, true); 17 | 18 | resp.Write(); 19 | return true; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin/Plugin/TfsIncomingAssetsCommand.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace TfsPlugin 3 | { 4 | class TfsIncomingAssetsCommand : ICommand 5 | { 6 | public bool Run(TfsTask task, IncomingAssetsRequest req, IncomingAssetsResponse resp) 7 | { 8 | var changes = task.GetChangesetWithChanges(req.Revision.ToInt()); 9 | 10 | task.GetStatus(changes.Changes, resp.Assets, false, true); 11 | 12 | resp.Assets.RemoveAll(each => each.HasState(State.kSynced)); 13 | 14 | resp.Write(); 15 | return true; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin/Plugin/TfsIncomingCommand.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.TeamFoundation.VersionControl.Client; 2 | using System.Linq; 3 | 4 | namespace TfsPlugin 5 | { 6 | /* 7 | * Returns the Changelists that are on the server but not locally. 8 | * The changelists does not include the assets. To get that use the 9 | * IncomingChangeAssetsCommand. 10 | */ 11 | public class TfsIncomingCommand : ICommand 12 | { 13 | public bool Run(TfsTask task, IncomingRequest req, IncomingResponse resp) 14 | { 15 | var workspaceVersion = task.VersionControlServer.QueryHistory(new QueryHistoryParameters(task.ProjectPath, RecursionType.Full) 16 | { 17 | VersionEnd = new WorkspaceVersionSpec(task.Workspace), 18 | MaxResults = 1 19 | }).Cast().ToArray(); 20 | 21 | if (workspaceVersion.Length != 0) 22 | { 23 | var incomingChanges = task.VersionControlServer.QueryHistory(new QueryHistoryParameters(task.ProjectPath, RecursionType.Full) 24 | { 25 | VersionStart = new ChangesetVersionSpec(workspaceVersion[0].ChangesetId), 26 | VersionEnd = VersionSpec.Latest 27 | }).Cast().ToList(); 28 | 29 | // remove the last change because it will be the workspace version 30 | if (incomingChanges.Count != 0 && incomingChanges[incomingChanges.Count - 1].ChangesetId == workspaceVersion[0].ChangesetId) 31 | { 32 | incomingChanges.RemoveAt(incomingChanges.Count - 1); 33 | } 34 | 35 | if (incomingChanges.Count != 0) 36 | { 37 | resp.ChangeSets.AddRange(incomingChanges.Select(each => TfsTask.ConvertToChangelist(each))); 38 | } 39 | } 40 | 41 | resp.Write(); 42 | return true; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin/Plugin/TfsLockCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using Request = TfsPlugin.BaseFileSetRequest; 4 | using Response = TfsPlugin.BaseFileSetResponse; 5 | 6 | namespace TfsPlugin 7 | { 8 | 9 | class TfsLockCommand : ICommand 10 | { 11 | public bool Run(TfsTask task, Request req, Response resp) 12 | { 13 | var files = req.Assets.Select(each => each.GetPath()).ToArray(); 14 | var filesPass2 = TfsTask.GetFolderContentsWildcardPaths(files).ToArray(); 15 | 16 | try 17 | { 18 | if (files.Length > 0) 19 | { 20 | task.Workspace.SetLock(files, task.GetLockLevel()); 21 | } 22 | if (filesPass2.Length > 0) 23 | { 24 | task.Workspace.SetLock(filesPass2, task.GetLockLevel()); 25 | } 26 | } 27 | catch (Exception e) 28 | { 29 | req.Conn.ErrorLine(e.Message); 30 | } 31 | 32 | if (files.Length > 0) 33 | { 34 | task.GetStatus(files, resp.Assets, false, true); 35 | } 36 | if (filesPass2.Length > 0) 37 | { 38 | task.GetStatus(filesPass2, resp.Assets, false, true); 39 | } 40 | 41 | foreach (var item in resp.Assets) 42 | { 43 | if (!item.HasState(State.kLockedLocal)) 44 | { 45 | req.Conn.ErrorLine("Unable to lock " + item.GetPath()); 46 | } 47 | } 48 | 49 | resp.Write(); 50 | return true; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin/Plugin/TfsMoveChangelistCommand.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace TfsPlugin 3 | { 4 | public class TfsMoveChangelistCommand : ICommand 5 | { 6 | public bool Run(TfsTask task, MoveChangelistRequest req, MoveChangelistResponse resp) 7 | { 8 | task.GetStatus(req.Assets, resp.Assets, false, true); 9 | resp.Write(); 10 | return true; 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin/Plugin/TfsMoveCommand.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.TeamFoundation.VersionControl.Client; 2 | using System; 3 | using Request = TfsPlugin.BaseFileSetRequest; 4 | using Response = TfsPlugin.BaseFileSetResponse; 5 | 6 | namespace TfsPlugin 7 | { 8 | class TfsMoveCommand : ICommand 9 | { 10 | public bool Run(TfsTask task, Request req, Response resp) 11 | { 12 | VersionedAssetList statAssets = new VersionedAssetList(); 13 | 14 | try 15 | { 16 | for (int i = 0; i < req.Assets.Count; i++) 17 | { 18 | var firstAsset = req.Assets[i]; 19 | var srcPath = firstAsset.GetPath(); 20 | 21 | ++i; 22 | if (i >= req.Assets.Count) 23 | { 24 | req.Conn.ErrorLine("No destination path while moving source path " + srcPath); 25 | break; 26 | } 27 | 28 | var dstPath = req.Assets[i].GetPath(); 29 | 30 | task.Workspace.PendRename(srcPath, dstPath, task.ShouldLock(firstAsset) ? task.GetLockLevel() : LockLevel.None, true, true); 31 | 32 | statAssets.Add(req.Assets[i]); 33 | } 34 | } 35 | catch (Exception e) 36 | { 37 | req.Conn.ErrorLine(e.Message); 38 | } 39 | 40 | task.GetStatus(statAssets, resp.Assets, false, true); 41 | 42 | resp.Write(); 43 | return true; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin/Plugin/TfsOutgoingCommand.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace TfsPlugin 3 | { 4 | /* 5 | * Returns the Changelists that are pending to be submitted to the server. 6 | * The assets associated with the changelists are not included. 7 | */ 8 | class TfsOutgoingCommand : ICommand 9 | { 10 | public const string DefaultChangelist = "Pending Changes"; 11 | 12 | public bool Run(TfsTask task, OutgoingRequest req, OutgoingResponse resp) 13 | { 14 | var pending = task.Workspace.GetPendingChanges(); 15 | 16 | if (pending.Length != 0) 17 | { 18 | Changelist cl = new Changelist(); 19 | 20 | cl.Description = DefaultChangelist; 21 | cl.Revision = ChangelistRevision.kDefaultListRevision; 22 | resp.ChangeSets.Add(cl); 23 | } 24 | 25 | resp.Write(); 26 | return true; 27 | } 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin/Plugin/TfsResolveCommand.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.TeamFoundation.VersionControl.Client; 2 | using Request = TfsPlugin.BaseFileSetRequest; 3 | using Response = TfsPlugin.BaseFileSetResponse; 4 | 5 | namespace TfsPlugin 6 | { 7 | public class TfsResolveCommand : ICommand 8 | { 9 | public bool Run(TfsTask task, Request req, Response resp) 10 | { 11 | Resolution resolution = Resolution.AcceptTheirs; 12 | 13 | if (req.Args.Count == 1) 14 | resolution = Resolution.AcceptTheirs; 15 | else if (req.Args[1] == "mine") 16 | resolution = Resolution.AcceptYours; 17 | else if (req.Args[1] == "theirs") 18 | resolution = Resolution.AcceptTheirs; 19 | else if (req.Args[1] == "merged") 20 | resolution = Resolution.AcceptMerge; 21 | 22 | Resolve(task, resolution, req.Assets); 23 | 24 | task.GetStatus(req.Assets, resp.Assets, false, true); 25 | 26 | resp.Write(); 27 | return true; 28 | } 29 | 30 | public static void Resolve(TfsTask task, Resolution resolution, VersionedAssetList assets) 31 | { 32 | Conflict[] conflicts = task.GetConflicts(assets); 33 | 34 | foreach (var item in conflicts) 35 | { 36 | if (resolution == Resolution.AcceptMerge) 37 | { 38 | item.Resolution = Resolution.AcceptYours; 39 | task.Workspace.ResolveConflict(item); 40 | } 41 | else 42 | { 43 | Conflict[] resolved; 44 | item.Resolution = resolution; 45 | 46 | task.Workspace.ResolveConflict(item, out resolved); 47 | 48 | if (resolution == Resolution.AcceptTheirs && resolved.Length == 0) 49 | { 50 | item.Resolution = Resolution.OverwriteLocal; 51 | task.Workspace.ResolveConflict(item, out resolved); 52 | } 53 | } 54 | } 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin/Plugin/TfsRevertChangesCommand.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.TeamFoundation.VersionControl.Client; 2 | using System.Linq; 3 | 4 | namespace TfsPlugin 5 | { 6 | class TfsRevertChangesCommand : ICommand 7 | { 8 | public bool Run(TfsTask task, RevertChangesRequest req, RevertChangesResponse resp) 9 | { 10 | bool unchangedOnly = req.Args.Count > 1 && req.Args[1] == "unchangedOnly"; 11 | 12 | bool keepLocalModifications = req.Args.Count > 1 && req.Args[1] == "keepLocalModifications"; 13 | 14 | foreach (var item in req.Revisions) 15 | { 16 | if (item.Value == ChangelistRevision.kDefaultListRevision) 17 | { 18 | var pending = task.Workspace.GetPendingChanges(new[] { new ItemSpec(task.ProjectPath, RecursionType.Full) }); 19 | 20 | var itemSpecs = pending.Select(each => new ItemSpec(each.LocalItem, RecursionType.None)).ToArray(); 21 | 22 | TfsRevertCommand.RevertCore(task, unchangedOnly, keepLocalModifications, itemSpecs); 23 | 24 | var versionedAssets = new VersionedAssetList(); 25 | versionedAssets.AddRange(pending.Select(each => new VersionedAsset(TfsTask.GetAssetPath(each, task.Workspace, true)))); 26 | 27 | task.GetStatus(versionedAssets, resp.Assets, false, true); 28 | } 29 | } 30 | 31 | resp.Write(); 32 | return true; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin/Plugin/TfsSubmitCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace TfsPlugin 4 | { 5 | class TfsSubmitCommand : ICommand 6 | { 7 | public bool Run(TfsTask task, SubmitRequest req, SubmitResponse resp) 8 | { 9 | bool saveOnly = req.Args.Count > 1 && req.Args[1] == "saveOnly"; 10 | 11 | if (saveOnly) 12 | { 13 | return true; 14 | } 15 | 16 | if (req.Assets.Count == 0) 17 | { 18 | return true; 19 | } 20 | 21 | req.Conn.Progress(-1, 0, "submitting"); 22 | 23 | try 24 | { 25 | task.Workspace.CheckIn(task.GetProjectPendingChanges(req.Assets), req.Changelist.GetDescription()); 26 | } 27 | catch (Exception e) 28 | { 29 | req.Conn.ErrorLine("Unable to Submit " + e.Message); 30 | } 31 | 32 | task.GetStatus(req.Assets, resp.Assets, false, true); 33 | 34 | resp.Write(); 35 | return true; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin/Plugin/TfsUnlockCommand.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.TeamFoundation.VersionControl.Client; 2 | using System; 3 | using System.Linq; 4 | using Request = TfsPlugin.BaseFileSetRequest; 5 | using Response = TfsPlugin.BaseFileSetResponse; 6 | 7 | namespace TfsPlugin 8 | { 9 | 10 | class TfsUnlockCommand : ICommand 11 | { 12 | public bool Run(TfsTask task, Request req, Response resp) 13 | { 14 | var files = req.Assets.Select(each => each.GetPath()).ToArray(); 15 | var filesPass2 = TfsTask.GetFolderContentsWildcardPaths(files).ToArray(); 16 | 17 | try 18 | { 19 | if (files.Length > 0) 20 | { 21 | task.Workspace.SetLock(files, LockLevel.None); 22 | } 23 | if (filesPass2.Length > 0) 24 | { 25 | task.Workspace.SetLock(filesPass2, LockLevel.None); 26 | } 27 | } 28 | catch (Exception e) 29 | { 30 | req.Conn.ErrorLine(e.Message); 31 | } 32 | 33 | if (files.Length > 0) 34 | { 35 | task.GetStatus(files, resp.Assets, false, true); 36 | } 37 | if (filesPass2.Length > 0) 38 | { 39 | task.GetStatus(filesPass2, resp.Assets, false, true); 40 | } 41 | 42 | resp.Write(); 43 | return true; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("TfsPlugin")] 8 | [assembly: AssemblyDescription("Unity TFS version control plugin.")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("Microsoft")] 11 | [assembly: AssemblyProduct("TfsPlugin")] 12 | [assembly: AssemblyCopyright("Copyright © Microsoft Corp. All Rights Reserved")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("9bd784c6-2e24-4152-a6cc-c8ea0e037a2f")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | [assembly: AssemblyVersion("1.0.0.0")] 32 | [assembly: AssemblyFileVersion("1.5.0")] 33 | -------------------------------------------------------------------------------- /TFSPlugin/TfsPlugin/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | .unity|.prefab|.anim|.controller 10 | 11 | 12 | $/:Checkout 13 | 14 | 15 | True 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | $/:false 28 | 29 | 30 | -------------------------------------------------------------------------------- /TODO.txt: -------------------------------------------------------------------------------- 1 | High Priority 2 | ------------- 3 | Add test for move including a folder e.g. 4 | c:move noLocalFileMove 5 | 4 6 | /Users/jake/Workspace/UnityProjects/JakeVCSTest/Assets/1/2/Material2.mat.meta 7 | 0 8 | /Users/jake/Workspace/UnityProjects/JakeVCSTest/Assets/1/3/2/Material2.mat.meta 9 | 0 10 | /Users/jake/Workspace/UnityProjects/JakeVCSTest/Assets/1/2 11 | 0 12 | /Users/jake/Workspace/UnityProjects/JakeVCSTest/Assets/1/3/2 13 | 0 14 | 15 | Medium Priority 16 | --------------- 17 | Check to see if these commands need tests adding (or already included): 18 | UCOM_ChangeDescription, 19 | UCOM_ChangeMove, 20 | UCOM_ChangeStatus, 21 | UCOM_Changes, 22 | UCOM_Checkout, 23 | UCOM_Config, 24 | UCOM_DeleteChanges, 25 | UCOM_Download, 26 | UCOM_GetLatest, 27 | UCOM_IncomingChangeAssets, 28 | UCOM_Incoming, 29 | UCOM_Lock, 30 | UCOM_QueryConfigParameters, 31 | UCOM_Resolve, 32 | UCOM_RevertChanges, 33 | UCOM_Unlock, 34 | UCOM_FileMode, 35 | -------------------------------------------------------------------------------- /Test/Perforce/Add.test: -------------------------------------------------------------------------------- 1 | 2 | c:add 3 | 1 4 | ./Assets/addfile1.txt 5 | 0 6 | -- 7 | v1:fstat -T "movedFile,depotFile,clientFile,action,ourLock,unresolved,headAction,otherOpen,otherLock,headRev,haveRev" "./Assets/addfile1.txt" 8 | v1:login 9 | v1:login 10 | v1:Prompted for password 11 | v1:User vcs_test_user logged in. 12 | v1:client -o "testclient" 13 | 14 | v1:where "./testForProjectRootMapping" 15 | 16 | v1:info 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | ==:v1:Server version: P4D/ 29 | v1:Server license: none 30 | ==:v1:Case Handling: 31 | v1:streams 32 | c32:online 33 | c32:enableCommand add 34 | c32:enableCommand changeDescription 35 | c32:enableCommand changeMove 36 | c32:enableCommand changes 37 | c32:enableCommand changeStatus 38 | c32:enableCommand checkout 39 | c32:enableCommand deleteChanges 40 | c32:enableCommand delete 41 | c32:enableCommand download 42 | c32:enableCommand getLatest 43 | c32:enableCommand incomingChangeAssets 44 | c32:enableCommand incoming 45 | c32:enableCommand lock 46 | c32:enableCommand move 47 | c32:enableCommand resolve 48 | c32:enableCommand revertChanges 49 | c32:enableCommand revert 50 | c32:enableCommand status 51 | c32:enableCommand submit 52 | c32:enableCommand unlock 53 | v1:./Assets/addfile1.txt - no such file(s). 54 | v1:add -f "./Assets/addfile1.txt" 55 | ==:v1:User vcs_test_user ticket expires in 56 | i1://depot/Assets/addfile1.txt#1 - opened for add (level 48) 57 | o1:-1 58 | v1:fstat "./Assets/addfile1.txt" 59 | ==:v1:User vcs_test_user ticket expires in 60 | v1:/Assets/addfile1.txt 61 | o1:/Assets/addfile1.txt 62 | o1:257 63 | d1:end of list 64 | r1:end of response 65 | -- 66 | c:status recurse 67 | 1 68 | ./Assets/addfile1.txt 69 | 0 70 | -- 71 | o1:-1 72 | v1:fstat "./Assets/addfile1.txt" 73 | ==:v1:User vcs_test_user ticket expires in 74 | v1:/Assets/addfile1.txt 75 | o1:/Assets/addfile1.txt 76 | o1:257 77 | d1:end of list 78 | r1:end of response 79 | -- 80 | -------------------------------------------------------------------------------- /Test/Perforce/Add2.test: -------------------------------------------------------------------------------- 1 | 2 | c:add 3 | 1 4 | ./Assets/addfile2.txt 5 | 0 6 | -- 7 | v1:fstat -T "movedFile,depotFile,clientFile,action,ourLock,unresolved,headAction,otherOpen,otherLock,headRev,haveRev" "./Assets/addfile2.txt" 8 | v1:login 9 | v1:login 10 | v1:Prompted for password 11 | v1:User vcs_test_user logged in. 12 | v1:client -o "testclient" 13 | 14 | v1:where "./testForProjectRootMapping" 15 | 16 | v1:info 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | ==:v1:Server version: P4D/ 29 | v1:Server license: none 30 | ==:v1:Case Handling: 31 | v1:streams 32 | c32:online 33 | c32:enableCommand add 34 | c32:enableCommand changeDescription 35 | c32:enableCommand changeMove 36 | c32:enableCommand changes 37 | c32:enableCommand changeStatus 38 | c32:enableCommand checkout 39 | c32:enableCommand deleteChanges 40 | c32:enableCommand delete 41 | c32:enableCommand download 42 | c32:enableCommand getLatest 43 | c32:enableCommand incomingChangeAssets 44 | c32:enableCommand incoming 45 | c32:enableCommand lock 46 | c32:enableCommand move 47 | c32:enableCommand resolve 48 | c32:enableCommand revertChanges 49 | c32:enableCommand revert 50 | c32:enableCommand status 51 | c32:enableCommand submit 52 | c32:enableCommand unlock 53 | v1:./Assets/addfile2.txt - no such file(s). 54 | v1:add -f "./Assets/addfile2.txt" 55 | ==:v1:User vcs_test_user ticket expires in 56 | i1://depot/Assets/addfile2.txt#1 - opened for add (level 48) 57 | o1:-1 58 | v1:fstat "./Assets/addfile2.txt" 59 | ==:v1:User vcs_test_user ticket expires in 60 | v1:/Assets/addfile2.txt 61 | o1:/Assets/addfile2.txt 62 | o1:257 63 | d1:end of list 64 | r1:end of response 65 | -- 66 | c:status recurse 67 | 1 68 | ./Assets/addfile2.txt 69 | 0 70 | -- 71 | o1:-1 72 | v1:fstat "./Assets/addfile2.txt" 73 | ==:v1:User vcs_test_user ticket expires in 74 | v1:/Assets/addfile2.txt 75 | o1:/Assets/addfile2.txt 76 | o1:257 77 | d1:end of list 78 | r1:end of response 79 | -- 80 | -------------------------------------------------------------------------------- /Test/Perforce/BadProjectRoot.test: -------------------------------------------------------------------------------- 1 | c:pluginConfig projectPath _bad 2 | -- 3 | r1:end of response 4 | -- 5 | c:getLatest 6 | 1 7 | ./... 8 | 0 9 | -- 10 | v1:sync "./..." 11 | v1:login 12 | v1:login 13 | v1:Prompted for password 14 | v1:User vcs_test_user logged in. 15 | v1:client -o "testclient" 16 | 17 | v1:where "./testForProjectRootMapping" 18 | e32:Path '_bad/testForProjectRootMapping' is not under client's root ''.\n 19 | c32:disableCommand add 20 | c32:disableCommand changeDescription 21 | c32:disableCommand changeMove 22 | c32:disableCommand changes 23 | c32:disableCommand changeStatus 24 | c32:disableCommand checkout 25 | c32:disableCommand deleteChanges 26 | c32:disableCommand delete 27 | c32:disableCommand download 28 | c32:disableCommand getLatest 29 | c32:disableCommand incomingChangeAssets 30 | c32:disableCommand incoming 31 | c32:disableCommand lock 32 | c32:disableCommand move 33 | c32:disableCommand resolve 34 | c32:disableCommand revertChanges 35 | c32:disableCommand revert 36 | c32:disableCommand status 37 | c32:disableCommand submit 38 | c32:disableCommand unlock 39 | c32:offline Couldn't fstat the project root directory. Please ensure that the selected workspace maps the project directory. 40 | o1:-1 41 | d1:end of list 42 | r1:end of response 43 | -- 44 | c:pluginConfig projectPath 45 | -- 46 | r1:end of response 47 | -- -------------------------------------------------------------------------------- /Test/Perforce/BaseIPv4/02_Configure.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Test/Perforce/BaseIPv4/03_GetLatest.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Test/Perforce/BaseIPv4/04_Add.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Test/Perforce/BaseIPv4/05_RevertAdd.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Test/Perforce/BaseIPv4/06_Add2.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Test/Perforce/BaseIPv4/07_Submit.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Test/Perforce/BaseIPv4/08_Delete.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Test/Perforce/BaseIPv4/09_Submit2.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Test/Perforce/BaseIPv4/10_Move.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/BaseIPv4/11_MoveNoLocal.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/BaseIPv4/12_BadConnectionParams.txt: -------------------------------------------------------------------------------- 1 | c:pluginConfig vcSharedLogLevel verbose 2 | -- 3 | r1:end of response 4 | -- 5 | c:pluginConfig projectPath 6 | -- 7 | r1:end of response 8 | -- 9 | c:pluginConfig vcPerforceUsername vcs_test_user 10 | -- 11 | r1:end of response 12 | -- 13 | c:pluginConfig vcPerforcePassword 14 | -- 15 | r1:end of response 16 | -- 17 | c:pluginConfig vcPerforceWorkspace testclient 18 | -- 19 | r1:end of response 20 | -- 21 | c:pluginConfig vcPerforceServer bad_perforce_server 22 | -- 23 | r1:end of response 24 | -- 25 | c:getLatest 26 | 1 27 | ./... 28 | 0 29 | -- 30 | v1:sync "./..." 31 | c32:disableCommand add 32 | c32:disableCommand changeDescription 33 | c32:disableCommand changeMove 34 | c32:disableCommand changes 35 | c32:disableCommand changeStatus 36 | c32:disableCommand checkout 37 | c32:disableCommand deleteChanges 38 | c32:disableCommand delete 39 | c32:disableCommand download 40 | c32:disableCommand getLatest 41 | c32:disableCommand incomingChangeAssets 42 | c32:disableCommand incoming 43 | c32:disableCommand lock 44 | c32:disableCommand move 45 | c32:disableCommand resolve 46 | c32:disableCommand revertChanges 47 | c32:disableCommand revert 48 | c32:disableCommand status 49 | c32:disableCommand submit 50 | c32:disableCommand unlock 51 | c32:offline Could not connect to the perforce server. Please check your Server setting in the Editor Settings. 52 | o1:-1 53 | d1:end of list 54 | r1:end of response 55 | -- 56 | 57 | -------------------------------------------------------------------------------- /Test/Perforce/BaseIPv4/13_BadProjectRoot.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Test/Perforce/BaseIPv4/14_Status.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Test/Perforce/BaseIPv6/02_Configure.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Test/Perforce/BaseIPv6/03_GetLatest.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/BaseIPv6/04_Add.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/BaseIPv6/05_RevertAdd.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/BaseIPv6/06_Add2.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/BaseIPv6/07_Submit.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/BaseIPv6/08_Delete.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/BaseIPv6/09_Submit2.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/BaseIPv6/10_Move.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/BaseIPv6/11_MoveNoLocal.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/BaseIPv6/12_BadConnectionParams.txt: -------------------------------------------------------------------------------- 1 | c:pluginConfig vcSharedLogLevel verbose 2 | -- 3 | r1:end of response 4 | -- 5 | c:pluginConfig projectPath 6 | -- 7 | r1:end of response 8 | -- 9 | c:pluginConfig vcPerforceUsername vcs_test_user 10 | -- 11 | r1:end of response 12 | -- 13 | c:pluginConfig vcPerforcePassword 14 | -- 15 | r1:end of response 16 | -- 17 | c:pluginConfig vcPerforceWorkspace testclient 18 | -- 19 | r1:end of response 20 | -- 21 | c:pluginConfig vcPerforceServer bad_perforce_server 22 | -- 23 | r1:end of response 24 | -- 25 | c:getLatest 26 | 1 27 | ./... 28 | 0 29 | -- 30 | v1:sync "./..." 31 | c32:disableCommand add 32 | c32:disableCommand changeDescription 33 | c32:disableCommand changeMove 34 | c32:disableCommand changes 35 | c32:disableCommand changeStatus 36 | c32:disableCommand checkout 37 | c32:disableCommand deleteChanges 38 | c32:disableCommand delete 39 | c32:disableCommand download 40 | c32:disableCommand getLatest 41 | c32:disableCommand incomingChangeAssets 42 | c32:disableCommand incoming 43 | c32:disableCommand lock 44 | c32:disableCommand move 45 | c32:disableCommand resolve 46 | c32:disableCommand revertChanges 47 | c32:disableCommand revert 48 | c32:disableCommand status 49 | c32:disableCommand submit 50 | c32:disableCommand unlock 51 | c32:offline Could not connect to the perforce server. Please check your Server setting in the Editor Settings. 52 | o1:-1 53 | d1:end of list 54 | r1:end of response 55 | -- 56 | 57 | -------------------------------------------------------------------------------- /Test/Perforce/BaseIPv6/13_BadProjectRoot.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Test/Perforce/BaseIPv6/14_Status.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Test/Perforce/Common/01_Traits.txt: -------------------------------------------------------------------------------- 1 | c:pluginConfig pluginTraits 2 | -- 3 | o1:6 4 | o8:requiresNetwork 5 | o8:enablesCheckout 6 | o8:enablesLocking 7 | o8:enablesRevertUnchanged 8 | o8:enablesChangelists 9 | o8:enablesGetLatestOnChangeSetSubset 10 | o1:4 11 | o1:vcPerforceUsername 12 | o8:Username 13 | o8:The perforce user name 14 | o1: 15 | o1:0 16 | o1:vcPerforcePassword 17 | o8:Password 18 | o8:The perforce password 19 | o1: 20 | o1:2 21 | o1:vcPerforceWorkspace 22 | o8:Workspace 23 | o8:The perforce workspace/client 24 | o1: 25 | o1:0 26 | o1:vcPerforceServer 27 | o8:Server 28 | o8:The perforce server using format: hostname:port. Port hostname defaults to 'perforce' and port defaults to 1666 29 | o1:perforce 30 | o1:0 31 | o1:overlays 32 | o1:12 33 | o1:1 34 | o1:default 35 | o1:4 36 | o1:default 37 | o1:16 38 | o1:default 39 | o1:32 40 | o1:default 41 | o1:64 42 | o1:default 43 | o1:128 44 | o1:default 45 | o1:256 46 | o1:default 47 | o1:512 48 | o1:default 49 | o1:1024 50 | o1:default 51 | o1:2048 52 | o1:default 53 | o1:4096 54 | o1:default 55 | o1:8192 56 | o1:default 57 | r1:end of response 58 | -- 59 | -------------------------------------------------------------------------------- /Test/Perforce/ConfigureBaseIPv4.test: -------------------------------------------------------------------------------- 1 | c:pluginConfig vcSharedLogLevel verbose 2 | -- 3 | r1:end of response 4 | -- 5 | c:pluginConfig projectPath 6 | -- 7 | r1:end of response 8 | -- 9 | c:pluginConfig vcPerforceUsername vcs_test_user 10 | -- 11 | r1:end of response 12 | -- 13 | c:pluginConfig vcPerforcePassword Secret 14 | -- 15 | r1:end of response 16 | -- 17 | c:pluginConfig vcPerforceWorkspace testclient 18 | -- 19 | r1:end of response 20 | -- 21 | c:pluginConfig vcPerforceServer localhost:1667 22 | -- 23 | r1:end of response 24 | -- 25 | -------------------------------------------------------------------------------- /Test/Perforce/ConfigureBaseIPv6.test: -------------------------------------------------------------------------------- 1 | c:pluginConfig vcSharedLogLevel debug 2 | -- 3 | r1:end of response 4 | -- 5 | c:pluginConfig projectPath 6 | -- 7 | r1:end of response 8 | -- 9 | c:pluginConfig vcPerforceUsername vcs_test_user 10 | -- 11 | r1:end of response 12 | -- 13 | c:pluginConfig vcPerforcePassword Secret 14 | -- 15 | r1:end of response 16 | -- 17 | c:pluginConfig vcPerforceWorkspace testclient 18 | -- 19 | r1:end of response 20 | -- 21 | c:pluginConfig vcPerforceServer localhost:1667 22 | -- 23 | r1:end of response 24 | -- 25 | -------------------------------------------------------------------------------- /Test/Perforce/ConfigureSecureBaseIPv4.test: -------------------------------------------------------------------------------- 1 | c:pluginConfig vcSharedLogLevel verbose 2 | -- 3 | r1:end of response 4 | -- 5 | c:pluginConfig projectPath 6 | -- 7 | r1:end of response 8 | -- 9 | c:pluginConfig vcPerforceUsername vcs_test_user 10 | -- 11 | r1:end of response 12 | -- 13 | c:pluginConfig vcPerforcePassword Secret 14 | -- 15 | r1:end of response 16 | -- 17 | c:pluginConfig vcPerforceWorkspace testclient 18 | -- 19 | r1:end of response 20 | -- 21 | c:pluginConfig vcPerforceServer ssl:localhost:1667 22 | -- 23 | r1:end of response 24 | -- 25 | -------------------------------------------------------------------------------- /Test/Perforce/ConfigureSecureSquareBracketIPv6.test: -------------------------------------------------------------------------------- 1 | c:pluginConfig vcSharedLogLevel verbose 2 | -- 3 | r1:end of response 4 | -- 5 | c:pluginConfig projectPath 6 | -- 7 | r1:end of response 8 | -- 9 | c:pluginConfig vcPerforceUsername vcs_test_user 10 | -- 11 | r1:end of response 12 | -- 13 | c:pluginConfig vcPerforcePassword Secret 14 | -- 15 | r1:end of response 16 | -- 17 | c:pluginConfig vcPerforceWorkspace testclient 18 | -- 19 | r1:end of response 20 | -- 21 | c:pluginConfig vcPerforceServer ssl6:[::1]:1667 22 | -- 23 | r1:end of response 24 | -- 25 | -------------------------------------------------------------------------------- /Test/Perforce/ConfigureSquareBracketIPv4.test: -------------------------------------------------------------------------------- 1 | c:pluginConfig vcSharedLogLevel verbose 2 | -- 3 | r1:end of response 4 | -- 5 | c:pluginConfig projectPath 6 | -- 7 | r1:end of response 8 | -- 9 | c:pluginConfig vcPerforceUsername vcs_test_user 10 | -- 11 | r1:end of response 12 | -- 13 | c:pluginConfig vcPerforcePassword Secret 14 | -- 15 | r1:end of response 16 | -- 17 | c:pluginConfig vcPerforceWorkspace testclient 18 | -- 19 | r1:end of response 20 | -- 21 | c:pluginConfig vcPerforceServer [localhost]:1667 22 | -- 23 | r1:end of response 24 | -- 25 | -------------------------------------------------------------------------------- /Test/Perforce/ConfigureSquareBracketIPv6.test: -------------------------------------------------------------------------------- 1 | c:pluginConfig vcSharedLogLevel verbose 2 | -- 3 | r1:end of response 4 | -- 5 | c:pluginConfig projectPath 6 | -- 7 | r1:end of response 8 | -- 9 | c:pluginConfig vcPerforceUsername vcs_test_user 10 | -- 11 | r1:end of response 12 | -- 13 | c:pluginConfig vcPerforcePassword Secret 14 | -- 15 | r1:end of response 16 | -- 17 | c:pluginConfig vcPerforceWorkspace testclient 18 | -- 19 | r1:end of response 20 | -- 21 | c:pluginConfig vcPerforceServer [::1]:1667 22 | -- 23 | r1:end of response 24 | -- 25 | -------------------------------------------------------------------------------- /Test/Perforce/GetLatest.test: -------------------------------------------------------------------------------- 1 | c:getLatest 2 | 1 3 | ./... 4 | 0 5 | -- 6 | v1:sync "./..." 7 | v1:login 8 | v1:login 9 | v1:Prompted for password 10 | v1:User vcs_test_user logged in. 11 | v1:client -o "testclient" 12 | 13 | v1:where "./testForProjectRootMapping" 14 | 15 | v1:info 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | ==:v1:Server version: P4D/ 28 | v1:Server license: none 29 | ==:v1:Case Handling: 30 | v1:streams 31 | c32:online 32 | c32:enableCommand add 33 | c32:enableCommand changeDescription 34 | c32:enableCommand changeMove 35 | c32:enableCommand changes 36 | c32:enableCommand changeStatus 37 | c32:enableCommand checkout 38 | c32:enableCommand deleteChanges 39 | c32:enableCommand delete 40 | c32:enableCommand download 41 | c32:enableCommand getLatest 42 | c32:enableCommand incomingChangeAssets 43 | c32:enableCommand incoming 44 | c32:enableCommand lock 45 | c32:enableCommand move 46 | c32:enableCommand resolve 47 | c32:enableCommand revertChanges 48 | c32:enableCommand revert 49 | c32:enableCommand status 50 | c32:enableCommand submit 51 | c32:enableCommand unlock 52 | o1:-1 53 | d1:end of list 54 | r1:end of response 55 | -- 56 | c:status recurse 57 | 1 58 | ./Assets/getlatestfile1.txt 59 | 0 60 | -- 61 | o1:-1 62 | v1:fstat "./Assets/getlatestfile1.txt" 63 | ==:v1:User vcs_test_user ticket expires in 64 | o1:./Assets/getlatestfile1.txt 65 | o1:262144 66 | v1:./Assets/getlatestfile1.txt - no such file(s). 67 | d1:end of list 68 | r1:end of response 69 | -- 70 | 71 | -------------------------------------------------------------------------------- /Test/Perforce/Login2.test: -------------------------------------------------------------------------------- 1 | c:getLatest 2 | 1 3 | ./... 4 | 0 5 | -- 6 | v1:sync "./..." 7 | v1:login 8 | v1:login 9 | v1:Prompted for password 10 | v1:User mfa_test_user logged in. 11 | v1:client -o "testclient" 12 | v1:Error: Multi factor authentication required! Run 'p4 login2'.\n 13 | v1:login2 14 | ==:v1:Available multi factor authentication methods: 15 | v1:1: A One-Time-Password generated by a user device 16 | v1:2: type something in response to a challenge 17 | v1:Please enter your response 18 | v1:Multi factor authentication approved. 19 | v1:client -o "testclient" 20 | 21 | v1:where "./testForProjectRootMapping" 22 | 23 | v1:info 24 | v1:User name: mfa_test_user 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | ==:v1:Server version: P4D/ 36 | v1:Server license: none 37 | ==:v1:Case Handling: 38 | v1:streams 39 | c32:online 40 | c32:enableCommand add 41 | c32:enableCommand changeDescription 42 | c32:enableCommand changeMove 43 | c32:enableCommand changes 44 | c32:enableCommand changeStatus 45 | c32:enableCommand checkout 46 | c32:enableCommand deleteChanges 47 | c32:enableCommand delete 48 | c32:enableCommand download 49 | c32:enableCommand getLatest 50 | c32:enableCommand incomingChangeAssets 51 | c32:enableCommand incoming 52 | c32:enableCommand lock 53 | c32:enableCommand move 54 | c32:enableCommand resolve 55 | c32:enableCommand revertChanges 56 | c32:enableCommand revert 57 | c32:enableCommand status 58 | c32:enableCommand submit 59 | c32:enableCommand unlock 60 | o1:-1 61 | d1:end of list 62 | r1:end of response 63 | -- -------------------------------------------------------------------------------- /Test/Perforce/MultiFactorAuthentication/01_Login2.txt: -------------------------------------------------------------------------------- 1 | c:pluginConfig vcSharedLogLevel verbose 2 | -- 3 | r1:end of response 4 | -- 5 | c:pluginConfig projectPath 6 | -- 7 | r1:end of response 8 | -- 9 | c:pluginConfig vcPerforceUsername mfa_test_user 10 | -- 11 | r1:end of response 12 | -- 13 | c:pluginConfig vcPerforcePassword aaaa1111 14 | -- 15 | r1:end of response 16 | -- 17 | c:pluginConfig vcPerforceWorkspace testclient 18 | -- 19 | r1:end of response 20 | -- 21 | c:pluginConfig vcPerforceServer localhost:1667 22 | -- 23 | r1:end of response 24 | -- 25 | -------------------------------------------------------------------------------- /Test/Perforce/SecureAdd.test: -------------------------------------------------------------------------------- 1 | 2 | c:add 3 | 1 4 | ./Assets/secureaddfile1.txt 5 | 0 6 | -- 7 | v1:fstat -T "movedFile,depotFile,clientFile,action,ourLock,unresolved,headAction,otherOpen,otherLock,headRev,haveRev" "./Assets/secureaddfile1.txt" 8 | v1:login 9 | v1:login 10 | v1:Prompted for password 11 | v1:User vcs_test_user logged in. 12 | v1:client -o "testclient" 13 | 14 | v1:where "./testForProjectRootMapping" 15 | 16 | v1:info 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | ==:v1:Server version: P4D/ 29 | v1:Server encryption: encrypted 30 | ==:v1:Server cert expires: 31 | v1:Server license: none 32 | ==:v1:Case Handling: 33 | v1:streams 34 | c32:online 35 | c32:enableCommand add 36 | c32:enableCommand changeDescription 37 | c32:enableCommand changeMove 38 | c32:enableCommand changes 39 | c32:enableCommand changeStatus 40 | c32:enableCommand checkout 41 | c32:enableCommand deleteChanges 42 | c32:enableCommand delete 43 | c32:enableCommand download 44 | c32:enableCommand getLatest 45 | c32:enableCommand incomingChangeAssets 46 | c32:enableCommand incoming 47 | c32:enableCommand lock 48 | c32:enableCommand move 49 | c32:enableCommand resolve 50 | c32:enableCommand revertChanges 51 | c32:enableCommand revert 52 | c32:enableCommand status 53 | c32:enableCommand submit 54 | c32:enableCommand unlock 55 | v1:./Assets/secureaddfile1.txt - no such file(s). 56 | v1:add -f "./Assets/secureaddfile1.txt" 57 | ==:v1:User vcs_test_user ticket expires in 58 | i1://depot/Assets/secureaddfile1.txt#1 - opened for add (level 48) 59 | o1:-1 60 | v1:fstat "./Assets/secureaddfile1.txt" 61 | ==:v1:User vcs_test_user ticket expires in 62 | v1:/Assets/secureaddfile1.txt 63 | o1:/Assets/secureaddfile1.txt 64 | o1:257 65 | d1:end of list 66 | r1:end of response 67 | -- 68 | c:status recurse 69 | 1 70 | ./Assets/secureaddfile1.txt 71 | 0 72 | -- 73 | o1:-1 74 | v1:fstat "./Assets/secureaddfile1.txt" 75 | ==:v1:User vcs_test_user ticket expires in 76 | v1:/Assets/secureaddfile1.txt 77 | o1:/Assets/secureaddfile1.txt 78 | o1:257 79 | d1:end of list 80 | r1:end of response 81 | -- 82 | -------------------------------------------------------------------------------- /Test/Perforce/SecureBaseIPv4/02_Configure.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Test/Perforce/SecureBaseIPv4/03_GetLatest.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/SecureBaseIPv4/04_Add.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/SecureBaseIPv4/05_RevertAdd.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/SecureBaseIPv4/06_Add2.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/SecureBaseIPv4/07_Submit.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/SecureBaseIPv4/08_Delete.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/SecureBaseIPv4/09_Submit2.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/SecureBaseIPv4/10_Move.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/SecureBaseIPv4/11_MoveNoLocal.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/SecureBaseIPv4/12_BadConnectionParams.txt: -------------------------------------------------------------------------------- 1 | c:pluginConfig vcSharedLogLevel verbose 2 | -- 3 | r1:end of response 4 | -- 5 | c:pluginConfig projectPath 6 | -- 7 | r1:end of response 8 | -- 9 | c:pluginConfig vcPerforceUsername vcs_test_user 10 | -- 11 | r1:end of response 12 | -- 13 | c:pluginConfig vcPerforcePassword 14 | -- 15 | r1:end of response 16 | -- 17 | c:pluginConfig vcPerforceWorkspace testclient 18 | -- 19 | r1:end of response 20 | -- 21 | c:pluginConfig vcPerforceServer bad_perforce_server 22 | -- 23 | r1:end of response 24 | -- 25 | c:getLatest 26 | 1 27 | ./... 28 | 0 29 | -- 30 | v1:sync "./..." 31 | c32:disableCommand add 32 | c32:disableCommand changeDescription 33 | c32:disableCommand changeMove 34 | c32:disableCommand changes 35 | c32:disableCommand changeStatus 36 | c32:disableCommand checkout 37 | c32:disableCommand deleteChanges 38 | c32:disableCommand delete 39 | c32:disableCommand download 40 | c32:disableCommand getLatest 41 | c32:disableCommand incomingChangeAssets 42 | c32:disableCommand incoming 43 | c32:disableCommand lock 44 | c32:disableCommand move 45 | c32:disableCommand resolve 46 | c32:disableCommand revertChanges 47 | c32:disableCommand revert 48 | c32:disableCommand status 49 | c32:disableCommand submit 50 | c32:disableCommand unlock 51 | c32:offline Could not connect to the perforce server. Please check your Server setting in the Editor Settings. 52 | o1:-1 53 | d1:end of list 54 | r1:end of response 55 | -- 56 | 57 | -------------------------------------------------------------------------------- /Test/Perforce/SecureBaseIPv4/13_BadProjectRoot.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Test/Perforce/SecureBaseIPv4/14_Status.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Test/Perforce/SecureGetLatest.test: -------------------------------------------------------------------------------- 1 | c:getLatest 2 | 1 3 | ./... 4 | 0 5 | -- 6 | v1:sync "./..." 7 | v1:login 8 | v1:login 9 | v1:Prompted for password 10 | v1:User vcs_test_user logged in. 11 | v1:client -o "testclient" 12 | 13 | v1:where "./testForProjectRootMapping" 14 | 15 | v1:info 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | ==:v1:Server version: P4D/ 28 | v1:Server encryption: encrypted 29 | ==:v1:Server cert expires: 30 | v1:Server license: none 31 | ==:v1:Case Handling: 32 | v1:streams 33 | c32:online 34 | c32:enableCommand add 35 | c32:enableCommand changeDescription 36 | c32:enableCommand changeMove 37 | c32:enableCommand changes 38 | c32:enableCommand changeStatus 39 | c32:enableCommand checkout 40 | c32:enableCommand deleteChanges 41 | c32:enableCommand delete 42 | c32:enableCommand download 43 | c32:enableCommand getLatest 44 | c32:enableCommand incomingChangeAssets 45 | c32:enableCommand incoming 46 | c32:enableCommand lock 47 | c32:enableCommand move 48 | c32:enableCommand resolve 49 | c32:enableCommand revertChanges 50 | c32:enableCommand revert 51 | c32:enableCommand status 52 | c32:enableCommand submit 53 | c32:enableCommand unlock 54 | o1:-1 55 | d1:end of list 56 | r1:end of response 57 | -- 58 | c:status recurse 59 | 1 60 | ./Assets/securegetlatestfile1.txt 61 | 0 62 | -- 63 | o1:-1 64 | v1:fstat "./Assets/securegetlatestfile1.txt" 65 | ==:v1:User vcs_test_user ticket expires in 66 | o1:./Assets/securegetlatestfile1.txt 67 | o1:262144 68 | v1:./Assets/securegetlatestfile1.txt - no such file(s). 69 | d1:end of list 70 | r1:end of response 71 | -- 72 | 73 | -------------------------------------------------------------------------------- /Test/Perforce/SecureSquareBracketIPv6/02_Configure.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Test/Perforce/SecureSquareBracketIPv6/03_GetLatest.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/SecureSquareBracketIPv6/04_Add.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/SecureSquareBracketIPv6/05_RevertAdd.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/SecureSquareBracketIPv6/06_Add2.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/SecureSquareBracketIPv6/07_Submit.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/SecureSquareBracketIPv6/08_Delete.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/SecureSquareBracketIPv6/09_Submit2.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/SecureSquareBracketIPv6/10_Move.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/SecureSquareBracketIPv6/11_MoveNoLocal.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/SecureSquareBracketIPv6/12_BadConnectionParams.txt: -------------------------------------------------------------------------------- 1 | c:pluginConfig vcSharedLogLevel verbose 2 | -- 3 | r1:end of response 4 | -- 5 | c:pluginConfig projectPath 6 | -- 7 | r1:end of response 8 | -- 9 | c:pluginConfig vcPerforceUsername vcs_test_user 10 | -- 11 | r1:end of response 12 | -- 13 | c:pluginConfig vcPerforcePassword 14 | -- 15 | r1:end of response 16 | -- 17 | c:pluginConfig vcPerforceWorkspace testclient 18 | -- 19 | r1:end of response 20 | -- 21 | c:pluginConfig vcPerforceServer bad_perforce_server 22 | -- 23 | r1:end of response 24 | -- 25 | c:getLatest 26 | 1 27 | ./... 28 | 0 29 | -- 30 | v1:sync "./..." 31 | c32:disableCommand add 32 | c32:disableCommand changeDescription 33 | c32:disableCommand changeMove 34 | c32:disableCommand changes 35 | c32:disableCommand changeStatus 36 | c32:disableCommand checkout 37 | c32:disableCommand deleteChanges 38 | c32:disableCommand delete 39 | c32:disableCommand download 40 | c32:disableCommand getLatest 41 | c32:disableCommand incomingChangeAssets 42 | c32:disableCommand incoming 43 | c32:disableCommand lock 44 | c32:disableCommand move 45 | c32:disableCommand resolve 46 | c32:disableCommand revertChanges 47 | c32:disableCommand revert 48 | c32:disableCommand status 49 | c32:disableCommand submit 50 | c32:disableCommand unlock 51 | c32:offline Could not connect to the perforce server. Please check your Server setting in the Editor Settings. 52 | o1:-1 53 | d1:end of list 54 | r1:end of response 55 | -- 56 | 57 | -------------------------------------------------------------------------------- /Test/Perforce/SecureSquareBracketIPv6/13_BadProjectRoot.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Test/Perforce/SecureSquareBracketIPv6/14_Status.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Test/Perforce/SquareBracketIPv4/02_Configure.txt: -------------------------------------------------------------------------------- 1 | 2 | c:pluginConfig vcPerforceServer [localhost]:1667 3 | -- 4 | r1:end of response 5 | -- 6 | c:info 7 | -- 8 | -------------------------------------------------------------------------------- /Test/Perforce/SquareBracketIPv4/03_GetLatest.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Test/Perforce/SquareBracketIPv4/04_Add.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Test/Perforce/SquareBracketIPv4/05_RevertAdd.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Test/Perforce/SquareBracketIPv4/06_Add2.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Test/Perforce/SquareBracketIPv4/07_Submit.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Test/Perforce/SquareBracketIPv4/08_Delete.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Test/Perforce/SquareBracketIPv4/09_Submit2.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Test/Perforce/SquareBracketIPv4/10_Move.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/SquareBracketIPv4/11_MoveNoLocal.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/SquareBracketIPv4/12_BadConnectionParams.txt: -------------------------------------------------------------------------------- 1 | c:pluginConfig vcSharedLogLevel verbose 2 | -- 3 | r1:end of response 4 | -- 5 | c:pluginConfig projectPath 6 | -- 7 | r1:end of response 8 | -- 9 | c:pluginConfig vcPerforceUsername vcs_test_user 10 | -- 11 | r1:end of response 12 | -- 13 | c:pluginConfig vcPerforcePassword 14 | -- 15 | r1:end of response 16 | -- 17 | c:pluginConfig vcPerforceWorkspace testclient 18 | -- 19 | r1:end of response 20 | -- 21 | c:pluginConfig vcPerforceServer bad_perforce_server 22 | -- 23 | r1:end of response 24 | -- 25 | c:getLatest 26 | 1 27 | ./... 28 | 0 29 | -- 30 | v1:sync "./..." 31 | c32:disableCommand add 32 | c32:disableCommand changeDescription 33 | c32:disableCommand changeMove 34 | c32:disableCommand changes 35 | c32:disableCommand changeStatus 36 | c32:disableCommand checkout 37 | c32:disableCommand deleteChanges 38 | c32:disableCommand delete 39 | c32:disableCommand download 40 | c32:disableCommand getLatest 41 | c32:disableCommand incomingChangeAssets 42 | c32:disableCommand incoming 43 | c32:disableCommand lock 44 | c32:disableCommand move 45 | c32:disableCommand resolve 46 | c32:disableCommand revertChanges 47 | c32:disableCommand revert 48 | c32:disableCommand status 49 | c32:disableCommand submit 50 | c32:disableCommand unlock 51 | c32:offline Could not connect to the perforce server. Please check your Server setting in the Editor Settings. 52 | o1:-1 53 | d1:end of list 54 | r1:end of response 55 | -- 56 | 57 | -------------------------------------------------------------------------------- /Test/Perforce/SquareBracketIPv4/13_BadProjectRoot.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Test/Perforce/SquareBracketIPv4/14_Status.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Test/Perforce/SquareBracketIPv6/02_Configure.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Test/Perforce/SquareBracketIPv6/03_GetLatest.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/SquareBracketIPv6/04_Add.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/SquareBracketIPv6/05_RevertAdd.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/SquareBracketIPv6/06_Add2.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/SquareBracketIPv6/07_Submit.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/SquareBracketIPv6/08_Delete.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/SquareBracketIPv6/09_Submit2.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/SquareBracketIPv6/10_Move.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/SquareBracketIPv6/11_MoveNoLocal.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Test/Perforce/SquareBracketIPv6/12_BadConnectionParams.txt: -------------------------------------------------------------------------------- 1 | c:pluginConfig vcSharedLogLevel verbose 2 | -- 3 | r1:end of response 4 | -- 5 | c:pluginConfig projectPath 6 | -- 7 | r1:end of response 8 | -- 9 | c:pluginConfig vcPerforceUsername vcs_test_user 10 | -- 11 | r1:end of response 12 | -- 13 | c:pluginConfig vcPerforcePassword 14 | -- 15 | r1:end of response 16 | -- 17 | c:pluginConfig vcPerforceWorkspace testclient 18 | -- 19 | r1:end of response 20 | -- 21 | c:pluginConfig vcPerforceServer bad_perforce_server 22 | -- 23 | r1:end of response 24 | -- 25 | c:getLatest 26 | 1 27 | ./... 28 | 0 29 | -- 30 | v1:sync "./..." 31 | c32:disableCommand add 32 | c32:disableCommand changeDescription 33 | c32:disableCommand changeMove 34 | c32:disableCommand changes 35 | c32:disableCommand changeStatus 36 | c32:disableCommand checkout 37 | c32:disableCommand deleteChanges 38 | c32:disableCommand delete 39 | c32:disableCommand download 40 | c32:disableCommand getLatest 41 | c32:disableCommand incomingChangeAssets 42 | c32:disableCommand incoming 43 | c32:disableCommand lock 44 | c32:disableCommand move 45 | c32:disableCommand resolve 46 | c32:disableCommand revertChanges 47 | c32:disableCommand revert 48 | c32:disableCommand status 49 | c32:disableCommand submit 50 | c32:disableCommand unlock 51 | c32:offline Could not connect to the perforce server. Please check your Server setting in the Editor Settings. 52 | o1:-1 53 | d1:end of list 54 | r1:end of response 55 | -- 56 | 57 | -------------------------------------------------------------------------------- /Test/Perforce/SquareBracketIPv6/13_BadProjectRoot.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Test/Perforce/SquareBracketIPv6/14_Status.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Test/Plugin/ProtocolNegotiation.txt: -------------------------------------------------------------------------------- 1 | c:pluginConfig pluginVersions 2 2 | -- 3 | o8:2 4 | r1:end of response 5 | -- 6 | -------------------------------------------------------------------------------- /Test/Readme: -------------------------------------------------------------------------------- 1 | Integration Tests 2 | ----------------- 3 | 4 | This will start a version control server, checkout a working copy and exercise the 5 | plugins using command files (e.g. Test/Perforce/04_Status.txt) 6 | 7 | A command file consists of a request section followed by a response section delimited by "--". 8 | Possibly followed by more request/response sections: 9 | 10 | As an example for getting the status of a file: 11 | 12 | c:status 13 | 1 14 | ./testfile.txt 15 | 0 16 | -- 17 | o1:-1 18 | o1:./testfile.txt 19 | o1:42 20 | d1:end of list 21 | r1:end of response 22 | -- 23 | 24 | 25 | 26 | Some macros are supported that can be put in the command files: 27 | 28 | The absolute path to the workspace e.g. /Users/foobar/VersionControlPlugins/Test/tmp/testclient 29 | Placed at the start of a line to ignore it when matching responses 30 | 31 | Include another command file at this point. e.g. 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /Test/TestServer/TestServer.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | 32 | 33 | Header Files 34 | 35 | 36 | Header Files 37 | 38 | 39 | Header Files 40 | 41 | 42 | -------------------------------------------------------------------------------- /Test/VCSTest.pm: -------------------------------------------------------------------------------- 1 | use lib 'Test/Perforce'; 2 | use PerforceTest; 3 | 4 | sub IntegrationTest 5 | { 6 | $exitCode = PerforceIntegrationTests(@_); 7 | if ($exitCode != 0) 8 | { 9 | exit $exitCode; 10 | } 11 | } 12 | 13 | 1; 14 | -------------------------------------------------------------------------------- /Test/run_tests.bat: -------------------------------------------------------------------------------- 1 | TODO: Make bat file 2 | -------------------------------------------------------------------------------- /Test/run_tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SERVEREXEC=$1 4 | PLUGINEXEC=$2 5 | VERBOSE=$3 6 | TESTS=${*:4} 7 | PLUGINNAME=`basename $PLUGINEXEC` 8 | BASELINEDIR=Test/NewBaseline/$PLUGINNAME 9 | 10 | # Create the dir where log files are stored 11 | mkdir Library 2>/dev/null 12 | rm -rf $BASELINEDIR 2>&1 > /dev/null 13 | mkdir -p $BASELINEDIR 14 | 15 | run_tests() 16 | { 17 | COUNT=0 18 | SUCCESS=0 19 | 20 | for i in $TESTS ; do 21 | COUNT=$((COUNT+1)) 22 | NAME=`basename $i` ; 23 | NEWBASELINE=$BASELINEDIR/$NAME ; 24 | if [ "$VERBOSE" == "newbaseline" ] ; then 25 | $SERVEREXEC $PLUGINEXEC "$i" $VERBOSE > "$NEWBASELINE" ; 26 | echo "diff -Naur $i $NEWBASELINE" ; 27 | diff -Naur "$i" "$NEWBASELINE" ; 28 | else 29 | $SERVEREXEC $PLUGINEXEC "$i" $VERBOSE; 30 | fi 31 | 32 | if [ "$?" == "0" ] ; then 33 | SUCCESS=$((SUCCESS+1)) 34 | fi 35 | done 36 | 37 | echo "Done: $SUCCESS of $COUNT tests passed." 38 | } 39 | 40 | run_tests; 41 | -------------------------------------------------------------------------------- /msbuilder.cmd: -------------------------------------------------------------------------------- 1 | if exist "%PROGRAMFILES%\Microsoft Visual Studio 10.0\Common7\Tools\vsvars32.bat" call "%PROGRAMFILES%\Microsoft Visual Studio 10.0\Common7\Tools\vsvars32.bat" 2 | if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 10.0\Common7\Tools\vsvars32.bat" call "%ProgramFiles(x86)%\Microsoft Visual Studio 10.0\Common7\Tools\vsvars32.bat" 3 | if exist "%REALVSPATH%\Common7\Tools\vsvars32.bat" call "%REALVSPATH%\Common7\Tools\vsvars32.bat" 4 | call msbuild %1 /t:Clean;%2 /p:Configuration=Release;Platform=%3 5 | --------------------------------------------------------------------------------