Search code examples
perforceperforce-integrate

Will the Perforce command "p4 copy" keep revision info?


dear all, I am using the Perforce Windows x64 GUI 2014.1888424. Per my test, the answer is NO. It will use the assigned revision number. I found the "integrate" and "branch" commands also don't keep the revision info. Are these commands designed to behavior like this? PS: I know that rename/move will keep the revision info. Would you please give me any hint? Thank you very much!


Solution

  • You didn't describe precisely what test you did, so I'm speculating slightly, but: the Perforce integrate, copy, and merge commands do preserve the overall revision history of the file.

    However, many of the commands which display file history do not display the full history by default; you have to specify additional commands to instruct the server to output the history across integrations.

    For example, compare the output of

    p4 filelog -i
    

    versus

    p4 filelog
    

    or

    p4 changes -i
    

    versus

    p4 changes
    

    for your experiments.

    The -i flag tells the server that you want to see the history of the file from prior to the integration or copy from its previous location. Here's how it's described in 'p4 help filelog':

        The -i flag includes inherited file history. If a file was created by
        branching (using 'p4 integrate'), filelog lists the revisions of the
        file's ancestors up to the branch points that led to the specified
        revision.  File history inherited by renaming (using 'p4 move') is
        always displayed regardless of whether -i is specified.
    

    Note that, as you've observed, renaming is indeed handled differently than integ/copy/merge.

    As for myself, when I am studying the history of a file, I tend to nearly always use the P4V tool and its supremely powerful Revision Graph and Time Lapse View tools. These tools know how to navigate all sorts of complex integration history, and make studying the history of a file much easier.