How to find untracked files in a Perforce tree? (analogue of svn status)

前端 未结 16 2064
独厮守ぢ
独厮守ぢ 2020-12-02 06:44

Anybody have a script or alias to find untracked (really: unadded) files in a Perforce tree?

EDIT: I updated the accepted answer on this one since it looks like P4V

相关标签:
16条回答
  • 2020-12-02 07:27

    I needed something that would work in either Linux, Mac or Windows. So I wrote a Python script for it. The basic idea is to iterate through files and execute p4 fstat on each. (of course ignoring dependencies and tmp folders)

    You can find it here: https://gist.github.com/givanse/8c69f55f8243733702cf7bcb0e9290a9

    0 讨论(0)
  • 2020-12-02 07:29

    This command can give you a list of files that needs to be added, edited or removed:
    p4 status -aed ...
    you can use them separately too
    p4 status -a ...
    p4 status -e ...
    p4 status -d ...

    0 讨论(0)
  • 2020-12-02 07:30

    Under Unix:

    find -type f ! -name '*~' -print0| xargs -0 p4 fstat 2>&1|awk '/no such file/{print $1}'
    

    This will print out a list of files that are not added in your client or the Perforce depot. I've used ! -name '*~' to exclude files ending with ~.

    0 讨论(0)
  • 2020-12-02 07:30

    I don't have enough reputation points to comment, but Ross' solution also lists files that are open for add. You probably do not want to use his answer to clean your workspace.

    The following uses p4 fstat (thanks Mark Harrison) instead of p4 have, and lists the files that aren't in the depot and aren't open for add.

    dir /S /B /A-D | sed -e "s/%/%25/g" -e "s/@/%40/g" -e "s/#/%23/g" -e "s/\*/%2A/g" | p4 -x- fstat 2>&1 | sed -n -e "s/ - no such file[(]s[)]\.$//gp"
    

    ===Jac

    0 讨论(0)
  • 2020-12-02 07:30

    In P4V, under the "View" menu item choose "Files in Folder" which brings up a new tab in the right pane. To the far right of the tabs there is a little icon that brings up a window called "Files in Folder" with 2 icons. Select the left icon that looks like a funnel and you will see several options. Choose "Show items not in Depot" and all the files in the folder will show up. Then just right-click on the file you want to add and choose "Mark for Add...". You can verify it is there in the "Pending" tab. Just submit as normal (Ctrl+S).

    0 讨论(0)
  • 2020-12-02 07:34

    Quick 'n Dirty: In p4v right-click on the folder in question and add all files underneath it to a new changelist. The changelist will now contain all files which are not currently part of the depot.

    0 讨论(0)
提交回复
热议问题