Jump to content


fstat -Oa attributes on newly added files don't show up running from a change-content trigger, even with @=[changelistnum]


  • Please log in to reply
3 replies to this topic

#1 rphm

rphm

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 26 August 2020 - 08:25 PM

I have a change-content trigger that runs a script which checks an attribute "sourceFile" to try and enforce submission of the other file when the given file is submitted or edited, but using P4API.NET, I notice that fstat/GetFileMetaData doesn't actually show the attributes on newly added files even with the @=[changelist] revision specifier. This isn't a problem when the file has already been submitted before and is being edited, in which case the attributes show up normally from fstat/GetFileMetaData. Is there any way to get it to show attributes in this case? The -Ro flag also doesn't seem to work because the file isn't considered 'open' on the server at change-content trigger time.

#2 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 1192 posts

Posted 01 September 2020 - 03:07 PM

Does your script run within the context of the submitting client (i.e. by setting P4CLIENT and P4HOST appropriately to have it spoof the submitting client)?  I don't think fstat shows you pending attributes for other clients, but it should show them for the current client.

C:\Perforce\test\main>p4 fstat -Oa attrib
... depotFile //depot/main/attrib
... clientFile c:\Perforce\test\main\attrib
... isMapped
... action add
... change default
... type text
... actionOwner Samwise
... workRev 1
... openattr-new like this


#3 rphm

rphm

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 04 September 2020 - 04:52 PM

I basically had to spoof the client as you mentioned by running fstat -Oa via process execute and passing the global options for client/host etc (and thus also had to pass the password, which is a bit bad) rather than going through P4API.NET. Is there a way to set P4CLIENT and P4HOST so that the server sees it for use with P4API.NET that I'm not aware of? It seemed to me based on the code that those get set on the Client object.

#4 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 1192 posts

Posted 05 September 2020 - 06:03 PM

Yup, you'd set it on the Client(?) object before initializing the connection.  (I haven't used the .NET API, but in the C++ API it's the ClientApi object, in the Python API it's the P4 object, etc.)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users