Jump to content


Need to "Get latest Revision" through C#


  • Please log in to reply
4 replies to this topic

#1 ghost654

ghost654

    Member

  • Members
  • PipPip
  • 12 posts

Posted 09 November 2018 - 10:10 PM

I have a tool in C# and i need to be able to feed it a directory lets just say "//test_depot/test/..." and have it download the latest from the Depot to the client folder.  How would i go about doing that?

#2 p4bill

p4bill

    Advanced Member

  • Members
  • PipPipPip
  • 160 posts

Posted 09 November 2018 - 10:35 PM

Are you using Helix Core API for .NET?
https://www.perforce...ix-core-api-net

If yes, after establishing a connection:

string depotPath = "//test_depot/test/...";
FileSpec dirToSync = new FileSpec(new DepotPath(depotPath), null);
IList<FileSpec> syncedFiles =connection.Client.SyncFiles(null, dirToSync );

the null in the SyncFiles command is in place of any sync options you may want to use.

#3 ghost654

ghost654

    Member

  • Members
  • PipPip
  • 12 posts

Posted 12 November 2018 - 05:04 PM

awesome that was very helpful, i was able to make it get the latest, thanks!

#4 ghost654

ghost654

    Member

  • Members
  • PipPip
  • 12 posts

Posted 12 November 2018 - 08:04 PM

one more question, is there a command that can check if the given depot path actually exists on the depot?  So I can check before getting latest?

#5 p4bill

p4bill

    Advanced Member

  • Members
  • PipPipPip
  • 160 posts

Posted 12 November 2018 - 08:43 PM

Repository.GetDepotDirs
should do what you want.

There are 2 overloads. You can see some examples if you expand them in the online help:

https://www.perforce...etDepotDirs.htm




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users