Can you “ignore” a file in Perforce?

后端 未结 10 499
被撕碎了的回忆
被撕碎了的回忆 2020-11-29 19:35

I sometimes use the feature \'Reconcile Offline Work...\' found in Perforce\'s P4V IDE to sync up any files that I have been working on while disconnected from the P4 depot.

10条回答
  •  醉梦人生
    2020-11-29 20:00

    I have found it easiest to reconcile offline work using a BASH script like this one:

    #!/bin/bash
    # reconcile P4 offline work, assuming P4CLIENT is set
    if [ -z "$P4CLIENT" ] ; then echo "P4CLIENT is not set"; exit 1; fi
    unset PWD # confuses P4 on Windows/CYGWIN
    
    # delete filew that are no longer present
    p4 diff -sd ... | p4 -x - delete
    
    # checkout files that have been changed.  
    # I don't run this step.  Instead I just checkout everything, 
    # then revert unchanged files before committing.
    p4 diff -se ... | pr -x - edit
    
    # Add new files, ignoring subversion info, EMACS backups, log files
    # Filter output to see only added files and real errors
    find . -type f \
     | grep -v -E '(\.svn)|(/build.*/)|(/\.settings)|~|#|(\.log)' \
     | p4 -x - add \
     | grep -v -E '(currently opened for add)|(existing file)|(already opened for edit)'
    

    I adapted this from this Perforce Knowledge Base article.

提交回复
热议问题