Perforce 트리에서 추적되지 않은 파일을 찾는 방법은 무엇입니까? (svn 상태의 아날로그)
Perforce 트리에서 추적되지 않은 (정말 : 추가되지 않은) 파일을 찾을 수있는 스크립트 또는 별칭이있는 사람이 있습니까?
편집 : 2009 년 1 월 릴리스에서 P4V가 이에 대한 지원을 추가 한 것처럼 보이기 때문에 이에 대한 수락 된 답변을 업데이트했습니다.
편집 :p4 status
지금 사용하십시오 . 더 이상 농구를 뛰어 넘을 필요가 없습니다. @ColonelPanic의 답변을 참조하십시오 .
2009 년 1 월 버전의 P4V에서는 작업 공간 트리의 폴더를 마우스 오른쪽 버튼으로 클릭하고 "오프라인 작업 조정 ..."을 클릭 할 수 있습니다.
이렇게하면 약간의 처리가 수행 된 다음 체크 아웃되지 않았지만 저장소 버전과 차이가 있거나 전혀 체크인되지 않은 파일의 분할 트리보기가 표시됩니다. 몇 가지 다른 범주가 나타날 수도 있습니다.
이보기에서 파일을 마우스 오른쪽 버튼으로 클릭하고 체크 아웃하거나 추가하거나 되돌릴 수도 있습니다.
내 엉덩이를 몇 번 구해준 매우 편리한 도구입니다.
편집 : 아 질문이 스크립트에 대해 구체적으로 물었지만 경우에 대비 하여이 답변을 여기에 남겨 두겠습니다.
Linux에서 또는 Windows에 gnu-tools가 설치된 경우 :
find . -type f -print0 | xargs -0 p4 fstat >/dev/null
계정이없는 모든 파일에 대해 오류 메시지가 표시됩니다. 해당 출력을 캡처하려면 다음을 수행하십시오.
find . -type f -print0 | xargs -0 p4 fstat >/dev/null 2>mylogfile
Unix에서 :
find -type f ! -name '*~' -print0| xargs -0 p4 fstat 2>&1|awk '/no such file/{print $1}'
클라이언트 또는 Perforce 저장소에 추가되지 않은 파일 목록이 인쇄됩니다. ! -name '*~'
~로 끝나는 파일을 제외 하는 데 사용 했습니다.
Ahh, Perforce 고전 중 하나 :) 예, 기본 명령에 내장 된 쉬운 방법이 아직 없다는 것은 정말 짜증납니다.
가장 쉬운 방법은 명령을 실행하여 클라이언트 루트 아래에있는 모든 파일을 찾은 다음 해당 파일을 저장소에 추가하는 것입니다. 모든 새 파일의 변경 목록이 표시되고 기존 파일은 무시됩니다.
예 : dir / s / b / AD | p4 -x-추가
(nix 명령 줄에서 'find. -type f -print'사용).
물리적 목록 (콘솔 또는 파일)을 원하면 diff의 결과를 파이프 (또는 변경 목록에서도 원하는 경우 추가) 할 수 있습니다.
P4Win에서 이것을 실행하는 경우 $ r을 사용하여 현재 작업 공간의 클라이언트 루트를 대체 할 수 있습니다.
svn status
또는 의 아날로그가git status
있습니까?
예,하지만 .
Perforce 버전 2012.1 p4 status
부터는 P4V '오프라인 작업 조정' 명령이 있습니다. 그러나 둘 다 매우 느립니다. 관련없는 파일을 제외하려면 https://stackoverflow.com/a/13126496/284795에 따라 p4ignore.txt
파일 을 작성해야합니다.
받아 들여진 대답과 다른 일부는 내가 생각하는 중요한 문제가 있기 때문에 대답을 추가해야한다는 충동을 느낍니다. 그들은 읽기 전용 쿼리 명령과 변경하는 명령의 차이점을 이해하지 못합니다.
나는이 답변에 대해 어떤 신용도 기대하지 않지만 다른 사람들이 허용되었지만 IMHO 오답을 따라 시간 낭비와 실수를 피하는 데 도움이되기를 바랍니다.
--- + 간략한
perforce 작업 공간에서 추적되지 않은 모든 파일을 찾는 가장 편리한 방법은 p4 reconcile -na
.
-a
"저장소에없는 파일, 즉 추가해야하는 파일을주세요"라고 말합니다.
-n
"변경하지 마십시오"라고 표시됩니다. 즉, 드라 이런입니다. (메시지는 "추가를 위해 열림"이라고 말할 수 있지만 정신적으로는 "-n이 아니면 추가를 위해 열릴 것"으로 해석해야합니다.)
추가해야 할 파일뿐만 아니라 삭제해야하거나를 통해 편집하기 위해 열지 않고 변경된 파일 등 오프라인 상태에서 이루어진 모든 로컬 변경 사항을 찾는 가장 편리한 방법 p4 edit
은 p4 reconcile -n
.
몇 가지 답변은 종종 p4 fstat
. 이러한 스크립트를 모두 확인하지는 않았지만 종종 유사한 스크립트를 사용하여 다음과 같은 perforce 명령의 결함을 보완합니다. 예를 p4 reconcile -n
들어 Perforce 저장소 경로 나 작업 공간 경로가 아닌 로컬 경로를 원하는 경우가 종종 있습니다.
--- + 경고
p4 status
다른 버전 제어 시스템의 상태 명령에 대응하지 않습니다.
p4 status
읽기 전용 쿼리가 아닙니다. p4 status
실제로 동일한 종류의 변경 사항을 찾아서 p4 reconcile
저장소에 추가합니다. 같은 건식 실행 옵션 p4 status
이없는 것 같습니다 .-n
p4 reconcile
그렇다면 p4 status
파일을보고 "Oh, I do n't need p4 revert
them "라고 생각 하면 같은 작업 공간에서 계속 편집하려면 파일을 사용해야합니다. 그렇지 않으면 변경 세트에 p4 status
추가 된 변경 사항이 다음에 확인됩니다.
로컬 작업 공간 대 저장소 경로 이름의 일부 세부 사항을 제외하고는 p4 status
대신 사용할 이유가 거의 또는 전혀없는 것 같습니다 p4 reconcile -n
.
읽기 전용이 아닌 명령으로 '상태'를 선택한 사람은 영어 및 기타 버전 제어 도구에 대한 명령이 제한적이었습니다.
--- + P4V
GUI
GUI p4v
에서 reconcile 명령은 편집을 위해 추가, 삭제 또는 열어야하는 로컬 변경 사항을 찾습니다. 다행히 기본적으로 변경 목록에 추가하지 않습니다. 그러나 변경 사항을 커밋하지 않으려면 검사 후 조정 창을 닫는 데주의해야 할 수도 있습니다.
저장소 (Windows 용)와 다른 작업 공간의 모든 파일을 백업하는 도구에서 다음을 사용합니다. 포함 된 공백, 별표, 백분율 및 해시 표시와 같이 Perforce가별로 좋아하지 않는 몇 가지 이상한 경우를 처리합니다.
dir /S /B /A-D | sed -e "s/%/%25/g" -e "s/@/%40/g" -e "s/#/%23/g" -e "s/\*/%2A/g" | p4 -x- have 1>NUL:
"dir /S /B /A-D" lists all files at or below this folder (/S) in "bare" format (/B) excluding directories (/A-D). The "sed" changes dangerous characters to their "%xx" form (a la HTML), and the "p4 have" command checks this list ("-x-") against the server discarding anything about files it actually locates in the repository ("1>NUL:"). The result is a bunch of lines like:
Z:\No_Backup\Workspaces\full\depot\Projects\Archerfish\Portal\Main\admin\html\images\nav\navxx_background.gif - file(s) not on client.
Et voilà!
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:
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.
The following commands produce status-like output, but none is quite equivalent to svn status
or git status
, providing a one-line summary of the status of each file:
p4 status
p4 opened
p4 diff -ds
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
Fast method, but little orthodox. If the codebase doesn't add new files / change view too often, you could create a local 'git' repository out of your checkout. From a clean perforce sync, git init, add and commit all files locally. Git status is fast and will show files not previously committed.
The p4 fstat
command lets you test if a file exists in the workspace, combine with find
to locate files to check as in the following Perl example:
// throw the output of p4 fstat to a 'output file'
// find:
// -type f :- only look at files,
// -print0 :- terminate strings with \0s to support filenames with spaces
// xargs:
// Groups its input into command lines,
// -0 :- read input strings terminated with \0s
// p4:
// fstat :- fetch workspace stat on files
my $status=system "(find . -type f -print0 | xargs -0 p4 fstat > /dev/null) >& $outputFile";
// read output file
open F1, $outputFile or die "$!\n";
// iterate over all the lines in F1
while (<F1>) {
// remove trailing whitespace
chomp $_;
// grep lines which has 'no such file' or 'not in client'
if($_ =~ m/no such file/ || $_ =~ m/not in client/){
// Remove the content after '-'
$_=~ s/-\s.*//g;
// below line is optional. Check ur output file for more clarity.
$_=~ s/^.\///g;
print "$_\n";
}
}
close F1;
Or you can use p4 reconcile -n -m ...
If it is 'opened for delete' then it has been removed from the workspace. Note that the above command is running in preview mode (-n
).
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
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).
'Programing' 카테고리의 다른 글
Web API를 사용하여 파일을 반환하는 방법은 무엇입니까? (0) | 2020.09.16 |
---|---|
MongoDB에서 중복 레코드 찾기 (0) | 2020.09.16 |
RESOURCE_LOCAL 또는 JTA와 같은 지속성 단위? (0) | 2020.09.16 |
C #에서 문자열을 정수로 변환하는 방법 (0) | 2020.09.16 |
안드로이드는 페인트에 맞춤 글꼴을 설정 (0) | 2020.09.16 |