4968: How to find 'movedFile' for Perforce shelved changes


This is just an FYI communication to share knowledge. I noticed in RBTools source the following comment:

    # XXX: fstat *ought* to work, but Perforce doesn't supply the movedFile
    # field in fstat (or apparently anywhere else) when a change is
    # shelved. For now, _diff_pending will avoid calling this method at all
    # for shelved changes, and instead treat them as deletes and adds.

This is possible, though, if you use the Perforce client name associated with the shelved change. For example, here's a shelved change that contains a moved file and is associated with client "masseyk_priv":

$ p4 changes -umasseyk -sshelved -m1
Change 2464690 on 2022/04/19 by masseyk@masseyk_priv pending 'Test Testing Done: Bug Number:'

If I run fstat within another client, I don't get movedFile:

$ p4 client -o | grep '^Client:'
Client: masseyk_build-vmshared
$ p4 fstat -T depotFile,movedFile //depot/Priv/masseyk/manifest-test4/text-2-move@=2464690
... depotFile //depot/Priv/masseyk/manifest-test4/text-2-move

But if I specify client "massey_priv" in this command, I do:

$ p4 -c masseyk_priv fstat -T depotFile,movedFile //depot/Priv/masseyk/manifest-test4/text-2-move@=2464690
... depotFile //depot/Priv/masseyk/manifest-test4/text-2-move
... movedFile //depot/Priv/masseyk/manifest-test4/text-2

(I don't know why Perforce works this way.)

For the record, here's my Perforce info:

$ p4 info
User name: masseyk
Client name: masseyk_build-vmshared
Client host: ubuntu
Client root: /s/vmshared/clients/build
Current directory: /s/vmshared/clients/build/apps/lib/build/rbutils
Peer address:
Client address:
Server address: perforce-releng.eng.vmware.com:1850
Server root: /p4d/perforce-releng_1850
Server date: 2022/04/21 06:28:15 -0700 PDT
Server uptime: 4323:04:10
Server version: P4D/LINUX26X86_64/2020.2/2179691 (2021/09/02)
ServerID: perforce-releng_1850
Server services: standard
Proxy address: bos2-prd-rdev-p4p001a.eng.vmware.com:1850
Proxy version: P4P/LINUX26X86_64/2020.2/2112800 (2021/04/08)
Server license: Vmware, Inc. 4823 users (support ends 2022/05/19) (expires 2022/05/19)
Server license-ip:
Case Handling: sensitive