开发者

Perforce: Difference between "Action" and "HeadAction" in fstat?

I am currently working on a feature that allows a user to determine which files in a folder are out-of-sync.

My code currently seems to work well, basically what I did开发者_JAVA百科 was :

  • Fstat on a folder
  • Iterate through the results and flag the records that fulfill both these conditions :
    • Revision != Head Revision
    • HeadAction == Edit

With that said, am I correct in using HeadAction instead of Action in my conditions ? What is the difference between both ?

According to Perforce:

  • HeadAction : Action taken at head revision, if in depot.
  • Action: Open action, if opened in your workspace.

For some reason, I don't really find these descriptions helpful.

Could someone rephrase these..?

Thanks


'headAction' is the action at the head revision in the depot - meaning it's the action of the latest revision that has been submitted to the depot. Typically this is 'add' for newly added (and submitted) files, 'edit' for files that have been edited and submitted, or 'delete' when the file has been deleted at head (and again submitted). There are other options here (like 'branch', 'integrate', etc).

'action' is what you are currently doing to the file. If you open a file for 'edit', the action will be 'edit'. Likewise if you open a file for 'delete', the action will be 'delete'. If you submit your change, then the action will become the headAction.

Here is a small example. I created a new file and submitted it. There was 1 revision in the depot. It's head action is 'add'. Then I edited the file. You can see the fstat output:

d:\projects\tools\test>p4 fstat new_file.txt
... depotFile //tools/test/new_file.txt
... clientFile d:\projects\tools\test\new_file.txt
... isMapped
... headAction add
... headType text
... headTime 1285014691
... headRev 1
... headChange 759253
... headModTime 1285014680
... haveRev 1

d:\projects\tools\test>p4 edit new_file.txt
//tools/test/new_file.txt#1 - opened for edit

d:\projects\tools\test>p4 fstat new_file.txt
... depotFile //tools/test/new_file.txt
... clientFile d:\projects\tools\test\new_file.txt
... isMapped
... headAction add
... headType text
... headTime 1285014691
... headRev 1
... headChange 759253
... headModTime 1285014680
... haveRev 1
... action edit
... change default
... type text
... actionOwner fred.flintstone

If you are trying to tell if a folder is out of sync, then it really seems that you need to only look at 'haveRev' vs 'headRev'. If headRev is > haveRev, you are out of date. If you care about whether the file is deleted at head, then perhaps looking at headAction might be useful. I guess I don't have enough information on your problem to know.

Anyway, HTH.


I'm not sure on your exact needs, but if you do

p4 sync -n <folder_name>/...

this will output files that need to be synced.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜