Programming

Perforce에서 파일을 "무시"할 수 있습니까?

procodes 2020. 8. 20. 20:23
반응형

Perforce에서 파일을 "무시"할 수 있습니까?


가끔 Perforce의 P4V IDE에있는 '오프라인 작업 조정 ...'기능을 사용하여 P4 저장소에서 연결이 끊어진 동안 작업 한 모든 파일을 동기화합니다. '폴더 차이'를 수행하는 다른 창을 시작합니다.

소스 제어에 체크인하고 싶지 않은 파일 (예 : DLL, 코드 생성 출력 등의 bin 폴더에있는 파일)이 있습니다. 이러한 파일 / 폴더를 "새"로 표시하지 않도록 필터링하는 방법이 있습니까? 추가되었습니다. 실제로 관심이있는 파일 목록을 복잡하게 만드는 경향이 있습니다. P4에는 Subversion의 '파일 무시'기능과 동일한 기능이 있습니까?


2012.1 버전부터 Perforce는 P4IGNORE환경 변수를 지원합니다 . 나는 그것이 어떻게 작동하는지에 대한 설명과 함께 디렉토리 무시에 관한이 질문에 대한 나의 대답을 업데이트 했습니다. 그런 다음 나는이 대답을 발견했습니다. 이제는 불필요한 것 같습니다.


"CLIENT"라는 클라이언트, "foo"라는 디렉토리 (프로젝트 루트에 있음)가 있고 해당 디렉토리 트리의 모든 .dll 파일을 무시하려는 경우 작업 영역보기에 다음 행을 추가하여 수행 할 수 있습니다. 이:

-// depot / foo / *. dll //CLIENT/foo/*.dll
-// depot / foo /.../*. dll //CLIENT/foo/.../*.dll

첫 번째 줄은 "foo"디렉터리에서 제거하고 두 번째 줄에서는 모든 하위 디렉터리에서 제거합니다. 이제 '오프라인 작업 조정 ...'을 선택하면 모든 .dll 파일이 폴더 diff 표시 하단에있는 "제외 된 파일"폴더로 이동됩니다. 그들은 당신의 방해가 될 것이지만 당신이 정말로 필요하다면 여전히 그들을보고 조작 할 수 있습니다.

다른 방법으로도 할 수 있습니다. "제외 된 파일"폴더를 단 하나로 줄일 수 있지만 경로가 손상 될 수 있기 때문에 포함 된 파일을 조작 할 수 없습니다 (하지만 원하는 경우에는 당신의 방식대로, 그것은 중요하지 않습니다).

-// depot / foo ... / *. dll //CLIENT/foo.../*.dll

네,하지만.

Perforce 버전 2012.1에는 Git에서 영감을 얻은 p4ignore 라는 기능이 추가되었습니다 . 그러나 Perforce 개발자는 정당한 이유없이 동작을 변경하여 기능을 훨씬 덜 유용하게 만듭니다.

Git은 모든 .gitignore파일 에서 규칙을 가져 오지만 Perforce는 환경 변수에 파일 이름을 지정할 때까지 어디를 찾아야하는지 알지 못합니다 P4IGNORE. 이 자유는 저주입니다. 무시 파일에 다른 이름을 사용하는 두 개의 저장소를 해킹 할 수 없습니다.

또한 Perforce의 무시 기능은 상자에서 작동하지 않습니다. 쉽게 설정할 수 있지만 명시 적으로 선택하지 않는 한 다른 사용자는 혜택을 볼 수 없습니다. 기여자가 실수로 원하지 않는 파일 (예 : bin빌드 스크립트로 만든 폴더)을 커밋 할 수 있습니다 .

Git의 무시 기능은 상자에서 작동하기 때문에 훌륭합니다. 는 IF .gitignore파일 (저장소에 추가되어 모두가이 작업을 수행 ), 그들은 모두를 위해 상자를 해결할 수 있습니다. 아무도 실수로 개인 키를 게시하지 않습니다.

재미있게도 Perforce 문서 는 '.p4ignore'를 무시 규칙의 예로 보여줍니다. 규칙이 유용하면 저장소의 일부로 공유해야합니다.


Perforce는 여전히 기능을 향상시킬 수 있습니다. 파일 이름에 대한 규칙 (예 :)을 선택 p4ignore.txt하면 기능이 즉시 작동합니다. P4IGNORE환경 변수를 삭제하면 비생산적입니다. 문서를 편집하여 개발자가 유용한 규칙을 공유하도록 장려하십시오. Git처럼 사용자가 홈 폴더의 파일에 개인 규칙을 작성할 있습니다.

Perforce에 아는 사람이 있으면이 게시물을 이메일로 보내주십시오.


이것은 Perforce 2013.1에서 작동하며, 새로운 P4IGNORE 메커니즘은 다음 Perforce 블로그에 설명 된 2012.1 릴리스에서 처음 추가되었습니다.

https://www.perforce.com/blog/new-20121-p4ignore

현재 설명 된대로 "P4IGNORE"환경 변수를 무시할 파일 목록이 포함 된 파일 이름으로 설정합니다.

그래서 당신은 그것을 확인하여 당신이 그것을 어떻게 좋아하는지 확인할 수 있습니다.


복사 할 필요없이 모든 작업 공간에 적용 할 솔루션을 원한다면 p4 보호 테이블에서 아래와 같은 행을 사용하여 해당 파일 유형의 제출을 ​​거부 할 수 있습니다 (또는 시스템 관리자).

write user * * -//.../*.suo
write user * * -//.../*.obj
write user * * -//.../*.ccscc

이전에이 작업을 수행 한 것을 기억하지만 여기서 테스트하는 데 필요한 권한이 없습니다. 확인 퍼포의 시스템 관리자로부터 안내를 하고 그것을 밖으로 시도


Perforce Streams를 사용하면 2011.1 버전부터 파일을 훨씬 쉽게 무시할 수 있습니다. 문서 에 따르면 디렉토리의 특정 확장자 또는 특정 경로를 무시할 수 있습니다.

에서 p4 help stream

Ignored: Optional; a list of file or directory names to be ignored in
                 client views. For example:

                     /tmp      # ignores files named 'tmp'
                     /tmp/...  # ignores dirs named 'tmp'
                     .tmp      # ignores file names ending in '.tmp'

                 Lines in the Ignored field may appear in any order.  Ignored
                 names are inherited by child stream client views.

이것은 본질적으로 @raven의 대답이 지정한 것을 수행하지만 해당 스트림을 사용하여 모든 작업 공간으로 자동으로 전파되기 때문에 스트림으로 더 쉽게 수행됩니다. 무시 유형을 지정한 스트림에서 상속 된 모든 스트림에도 적용됩니다.

p4 stream //stream_depot/stream_namep4v의 스트림보기에서 스트림을 통해 또는 마우스 오른쪽 버튼으로 스트림을 편집 할 수 있습니다 .

@svec가 언급했듯이 작업 공간 당 파일 무시를 지정하는 기능이 곧 제공 될 예정이며 실제로 P4 2012.1 베타 버전입니다.


Will's suggestion of using .p4ignore only seems to work with the WebSphere Studio (P4WSAD) plugin. I just tried it on my local windows box and any files and directories that I listed were not ignored.

Raven's suggestion of modifying your client spec is the correct way under Perforce. Proper organization of your code/data/executables and generated output files will make the process of excluding files from being checked in much easier.

As a more draconian approach, you can always write a submit trigger which will reject submission of change-lists if they contain a certain file or files with a certain extension, etc.


HISTORICAL ANSWER - no longer correct. At the time this was written originally it was true;

You can not write and check in a file that the server will use to make ignore rules; general glob or regexp file pattern ignore in perforce.

Other answers have global server configurations that are global (and not per folder). The other answers show things that might work for you, if you want one line in your view per folder times number of extensions you want to ignore in that single folder, or that provide this capability in WebSphere Studio plugins only, or provide capability for server administrators, but not available to users.

In short, I find Perforce really weak in this area. While I appreciate that those who use the Eclipse Plugin can use .p4ignore, and I think that's great, it leaves those of us that don't, out in the dark.

UPDATE: See accepted answer for new P4IGNORE capability added mid-2012.


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.


I'm looking for a .p4ignore like solution as well (and not one tied to a particular IDE). Thus far, the closest thing I've found is p4delta. It sounds like it will do exactly what the original poster was asking, albeit through another layer of indirection.

http://p4delta.sourceforge.net

Unfortunately, while this does seem to produce the proper list of files, I can't get "p4delta --execute" to work ("Can't modify a frozen string") and the project has not been updated in year. Perhaps others will have better luck.


If you are using the Eclipse Perforce plugin, then the plugin documentation lists several ways to ignore files.

참고URL : https://stackoverflow.com/questions/55449/can-you-ignore-a-file-in-perforce

반응형