Jump to content


laurent_tr

Member Since 10 Jun 2019
Offline Last Active Aug 19 2019 01:47 PM
-----

Posts I've Made

In Topic: P4API.NET DepotType enum does not have an entry for Graph depot

13 August 2019 - 09:28 AM

Hello @p4bill,

I have downloaded the .NET dll version 2019.2 just now.
I have noticed that in this version there is P4Server.SetProtocol() where we can change the connection protocol of P4Bridge.
I assume that this corresponds to the code snippet pointed out by @sambwise
pConnection->SetProtocol("enableStreams", "");
pConnection->SetProtocol("enableGraph", "");

However when I try to play with this method, it does not change the result of GetDepots().
For example, I put "false" to "enableStreams" but I still receive Streams depots in the result of GetDepots().

Here is the snippet of code the manage my Perforce connection
public bool Connect()
{
	// define the server, repository and connection
	_server = new Server(new ServerAddress(_serverUri));
	_repository = new Repository(_server);
	_connection = _repository.Connection;
	// use the connection variables for this connection
	_connection.UserName = _user;
	_connection.Client = new Client();
	var options = new Options();
	options["ProgramName"] = ApplicationName;
	options["ProgramVersion"] = ApiVersion;
	// connect to the server
	try
	{
		if (!_connection.Connect(options))
		{
			Sys.LogError($"{nameof(PerforceClient)}.Connect could not connect to Perforce server at {_serverUri}, with the user {_user}.");
			return false;
		}
		// TODO: Uncomment this line to enable Graph depot discovery
		_connection.getP4Server().SetProtocol("enableGraph", "");
		_connection.getP4Server().SetProtocol("enableStreams", "false");
		if (_passwordAuthentication)
		{
			var credential = _connection.Login(_pwd.Password);
			// Save the ticket expiration time, remove 5 min to be more proactive on the expiration time
			_ticketExpirationTime = Dat.MinSub(credential.Expires, 5);
			PerforceHelixConnector.LogProgress($"{nameof(PerforceClient)}.Connect obtains new validation ticket, valid until {Dat.ToStrSystem(_ticketExpirationTime)}.");
		}
		return true;
	}
	catch (Exception e)
	{
		HandleException($"{nameof(PerforceClient)}.Connect could not connect to Perforce server at {_serverUri}, with the user {_user}.", e , out _);
		return false;
	}
}

In Topic: P4API.NET connects to Perforce server via rsh protocol

26 June 2019 - 09:15 AM

Hello,

Thank you for your reply, @p4bill and @Sambwise.

The reference link is here: https://www.perforce...new/tsld020.htm
It does not work because the link has included the "." character at the end of the sentence.

@p4bill, would it be ok if I ask you to file a doc ticket to update the reference of p4port to have example of "rsh:" protocol, especially, it differs from other protocols in the way that it can execute a bash command.

Thanks.

In Topic: P4API.NET DepotType enum does not have an entry for Graph depot

25 June 2019 - 02:10 PM

Hello @p4bill, @sambwise,

Thank you very much for your response.
I will wait for the next release of P4API.NET then.
Besides I did not manage to find the source distribution of P4API.NET, I imagine that it is not some kind of public repository, isn't it?
Is there a way to know when a new version P4API.NET will be released ?

Also what are the options to be activated in P4Admin and P4V so that I can view a Graph repo ?

Thanks

In Topic: P4API.NET DepotType enum does not have an entry for Graph depot

21 June 2019 - 12:55 PM

Hello,

Thank you for the update.

By chance, could you please verify that GetDepots() also returns Graph depots?
I have created via the command line p4 a Graph depot, which is visible via "p4 depots" with user having read permission on this depot.
However using GetDepots() with the same user never shows me the depot.

I have also tried to create my own method that sends "p4 depots -t graph":
public IList<Depot> GetDepots()
{
  var options = new Options();
  options["-t"] = "graph";
  P4CommandResult p4CommandResult = new P4Command(this, "depots", true, new string[0]).Run((StringList) options);
  if (p4CommandResult.Success)
  {
	if (p4CommandResult.TaggedOutput == null || p4CommandResult.TaggedOutput.Count <= 0)
	  return (IList<Depot>) null;
	bool dst_mismatch = false;
	string offset = string.Empty;
	if (this.Server != null && this.Server.Metadata != null)
	{
	  offset = this.Server.Metadata.DateTimeOffset;
	  dst_mismatch = FormBase.DSTMismatch(this.Server.Metadata);
	}
	List<Depot> depotList = new List<Depot>();
	foreach (TaggedObject objectInfo in (List<TaggedObject>) p4CommandResult.TaggedOutput)
	{
	  Depot depot = new Depot();
	  depot.FromDepotsCmdTaggedOutput(objectInfo, offset, dst_mismatch);
	  depotList.Add(depot);
	}
	return (IList<Depot>) depotList;
  }
  P4Exception.Throw(p4CommandResult.ErrorList);
  return (IList<Depot>) null;
}

But the result is empty.

Thanks

In Topic: P4API.NET How to check if a user/group can access a file on a given host.

11 June 2019 - 09:51 AM

Hello p4bill,

I have had a second look at the command p4 protects -a.
The Perforce API does return the exclusion rules however the method GetProtectionEntries() in .NET does not interpret it correctly as an exclusion.

In my test case, I have this kind of protection table

I have copied the GetProtectionEntries() method to be able to debug it.
When I debug it with a file in "//test/root/not_accessible_by_group2/", I receive an entry related to the rule number 11. (cf debug.PNG)

However, this entry is interpreted as an inclusion rule by the .NET library, due to the fact that the "unmap" property is not read.
I think we need a bug report for this one too.

Regards,