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

前端 未结 16 2065
独厮守ぢ
独厮守ぢ 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:44

    Alternatively from P4Win, use the ""Local Files not in Depot" option on the left hand view panel.

    I don't use P4V much, but I think the equivalent is to select "Hide Local Workspace Files" in the filter dropdown of the Workspace view tab.p4 help fstat

    In P4V 2015.1 you'll find these options under the filter button like this:

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

    Ahh, one of the Perforce classics :) Yes, it really sucks that there is STILL no easy way for this built into the default commands.

    The easiest way is to run a command to find all files under your clients root, and then attempt to add them to the depot. You'll end up with a changelist of all new files and existing files are ignored.

    E.g dir /s /b /A-D | p4 -x - add

    (use 'find . -type f -print' from a nix command line).

    If you want a physical list (in the console or file) then you can pipe on the results of a diff (or add if you also want them in a changelist).

    If you're running this within P4Win you can use $r to substitute the client root of the current workspace.

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

    Is there an analogue of svn status or git status?

    Yes, BUT.

    As of Perforce version 2012.1, there's the command p4 status and in P4V 'reconcile offline work'. However, they're both very slow. To exclude irrelevant files you'll need to write a p4ignore.txt file per https://stackoverflow.com/a/13126496/284795

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

    On linux, or if you have gnu-tools installed on windows:

    find . -type f -print0 | xargs -0 p4 fstat >/dev/null
    

    This will show an error message for every unaccounted file. If you want to capture that output:

    find . -type f -print0 | xargs -0 p4 fstat >/dev/null 2>mylogfile
    
    0 讨论(0)
提交回复
热议问题