Plastic SCM - CLI 가이드
소개
Plastic SCM은 시각적 버전 관리 시스템입니다. 그러나 명령줄에서도 사용이 가능합니다.
이 가이드는 사용자가 Plastic에 익숙해질 수 있도록 일반적인 명령줄 인터페이스(CLI) 시나리오를 단계별로 안내합니다.
cm help command_name 명령을 사용하면 언제든지 모든 명령에 대한 자세한 정보를 확인할 수 있습니다.
cm help objectspec 명령을 실행하여 Plastic에서 지원하는 여러 객체 사양의 정의에 대해 알아볼 수 있습니다.
새 워크스페이스 생성
새 워크스페이스를 생성하려면 cm workspace create 명령만 실행하면 됩니다.
>cm workspace create quakewk quake_path --repository=quake@localhost:6060
Workspace quakewk has been correctly created
그런 다음 새로 생성된 디렉토리로 이동합니다.
>cd quake_path
>cm status
/main@quake@localhost:6060 (cs:0 - head)
업데이트를 실행하지 않았기 때문에 체인지 세트는 아직 0입니다. 기본적으로 워크스페이스는 주 브랜치를 사용하도록 구성되어 있습니다.
cm status --head를 실행하여 브랜치의 최신 체인지 세트를 확인할 수 있습니다.
>cm status --head
cs:573@quake@localhost:6060
다음을 입력하여 최신으로 업데이트할 수 있습니다.
>cm update
그러면 이 명령은 최신 상태가 될 때까지 복제 중인 파일에 대한 모든 정보를 덤프합니다.
>cm status
/main@quake@localhost:6060 (cs:573 - head)
이제 최신 체인지 세트가 573이 되었습니다.
새 브랜치 생성 및 전환
새 브랜치를 생성하려면 간단히 cm branch(또는 cm branch create) 명령을 실행하면 됩니다.
> cm branch main/fix-1342
cm status에서 확인할 수 있듯이, 새 브랜치를 생성했지만 아직 새 브랜치로 전환하지는 않은 상태입니다.
>cm status
/main@quake@localhost:6060 (cs:573 - head)
시작점을 지정하지 않았으므로 새 브랜치는 부모 브랜치의 최근 체인지 세트에서 시작하며, 이 경우 주의 체인지 세트 573입니다. --changeset 및 --label 조정값을 사용하여 주어진 체인지 세트 또는 레이블을 지정하고, 해당 위치에서 브랜치를 시작할 수 있습니다.
이제 switch 명령을 사용하여 워크스페이스를 브랜치로 전환합니다.
> cm switch main/fix-1342
Performing switch operation...
Searching for changed items in the workspace...
Setting the new selector...
Plastic is updating your workspace. Wait a moment, please...
The workspace c:\Users\pablo\wkspaces\quake_path is up-to-date (cset:573@quake@localhost:6060)
새 브랜치는 아직 비어 있으므로 Plastic은 사실 전환을 수행하기 위해 워크스페이스에서 아무것도 업데이트하지 않았습니다. fix-1342 지점이 동일한 체인지 세트 573을 가리키기 때문입니다.
변경 - 편집 - 체크인 워크플로 수행
워크스페이스에서 파일을 편집한 후 변경사항을 검색하여 이 파일을 찾습니다.
>vim code\FileSystem-renamed.cs
>cm status
/main/fix-1342@quake@localhost:8084 (cs:573 - head)
Changed
Status Size Last Modified Path
Changed 80 bytes 6 seconds ago code\FileSystem-renamed.cs
status는 앞서 확인한 wk 구성뿐만 아니라 변경, 체크아웃, 이동, 삭제 등이 이루어진 파일도 보여 줍니다.
이제 FileSystem-renamed.cs
를 새 위치로 이동합니다.
>move code\FileSystem-renamed.cs code\lib\FileSystem.cs
1 file(s) moved.
그리고 status를 실행하여 이동된 파일을 찾습니다.
>cm status
/main/fix-1342@quake@localhost:8084 (cs:573 - head)
Moved
Status Size Similarity Path
Moved locally 86 bytes 99% code\FileSystem-renamed.cs -> code\lib\FileSystem.cs
로컬에서 이동됨은 Plastic의 관리 범위를 벗어난 위치로 파일이 이동했다는 의미입니다만, 이동된 파일은 이전 버전과 99% 유사하므로 찾을 수 있습니다.
그리고 쉽게 변경사항을 체크인할 수 있습니다.
>cm ci --all
The selected items are about to be checked in. Please wait ...
Assembling checkin data
Validating checkin data
Uploading file data
Uploaded 0 bytes of 2.77 KB (0%)
Confirming checkin operation
Modified c:\Users\pablo\wkspaces\quake_path\code
Modified c:\Users\pablo\wkspaces\quake_path\code\lib
Modified and moved from c:\Users\pablo\wkspaces\quake_path\code\FileSystem-renamed.cs to c:\Users\pablo\wkspaces\quake_path\code\lib\FileSystem.cs
Created changeset cs:575@br:/main/fix-1342@quake@localhost:6060 (mount:'/')
기본 ci 명령은 추가된 모든 파일을 체크인합니다. 기본적으로 ci --all 명령을 사용하면 변경된 모든 사항을 감지하고 체크인을 수행하라고 Plastic에 전달합니다. 또한 all은 변경, 삭제 또는 이동이 이루어진 파일을 의미합니다. ci --all --private을 사용하여 비공개 파일을 포함할 수도 있습니다.
참고: 파일을 편집한 후 체크인을 수행하는 아주 간단한 워크플로를 따랐습니다. 이는 SVN 및 Git과 같은 버전 관리 툴에서 널리 사용되는 일반적인
편집-체크인 워크플로입니다.
Plastic SCM은 체크아웃-편집-체크인 워크플로도 지원합니다.
로그 및 비교 내역 확인
cm log 명령을 실행하면 지정된 체인지 세트 또는 특정 체인지 세트 범위에 적용된 변경사항이 표시됩니다.
>cm log cs:575
Changeset number: 575
Branch: /main/fix-1342
Owner: pablo
Date: 7/18/2015 19:41:29
Comment:
Changes:
C code\lib\FileSystem.cs
M code\lib\FileSystem.cs
FileSystem.cs
파일을 체크인, 수정 및 이동한 마지막 체인지 세트에서 해당 내용이 어떻게 보이는지 알 수 있습니다.
cm diff 명령은 비슷하지만 항상 지정된 체인지 세트로 제한됩니다.
>cm diff cs:575
C "code\lib\FileSystem.cs"
M "code\FileSystem-renamed.cs" "code\lib\FileSystem.cs"
워크스페이스의 모든 변경사항 정리
실험적으로 몇 가지 변경을 시도해 본 후, 대기 중인 모든 변경사항을 제거하고 없애고 다시 처음부터 시작하고 싶습니다. 이런 방식으로 작업할 경우
먼저 현재 상태를 확인합니다.
>cm status
/main/fix-1342@quake@localhost:8084 (cs:575 - head)
Changed
Status Size Last Modified Path
Changed 49.23 KB 2 hours ago code\bsp-renamed.c
Changed 23.42 KB 2 hours ago code\cgame\cg_drawtools.c
Changed 61.23 KB 8 minutes ago libs\cmdlib.h
Changed 398 bytes 7 minutes ago libs\str.h
모든 변경사항을 취소하려 합니다. undo 명령을 반복하여 이 작업을 처리합니다.
>cm undo -r
c:\Users\pablo\wkspaces\quake_path\libs\str.h unchecked out correctly
c:\Users\pablo\wkspaces\quake_path\libs\cmdlib.h unchecked out correctly
c:\Users\pablo\wkspaces\quake_path\code\cgame\cg_drawtools.c unchecked out correctly
c:\Users\pablo\wkspaces\quake_path\code\bsp-renamed.c unchecked out correctly
이제 상태는 다음과 같습니다.
>cm status
/main/fix-1342@quake@localhost:8084 (cs:575 - head)
모두 정리되었습니다.
참고:
기본적으로 undo 명령은 실제 "체크아웃"인지 단지 변경된 파일인지와 관계없이 모든 변경사항에 적용되지만 undo를 특정 변경 유형으로 제한할 수 있습니다. Plastic에서 "변경된 파일"과 "체크아웃된 파일"은 약간 다르며 일부 명령은 이를 반영하여 실행됩니다.
설명한 대로 undo 명령을 특정 변경 유형으로 제한하여 실행할 수 있습니다. 이렇게 처리하려면 필터 옵션을 사용합니다.
위와 변경사항이 동일하지만, 이번에는 여러 파일을 추가 및 삭제했다고 가정해 보겠습니다.
>cm status
/main/fix-1342@quake@localhost:8084 (cs:575 - head)
Changed
Status Size Last Modified Path
Changed 49.23 KB 2 hours ago code\bsp-renamed.c
Changed 23.42 KB 2 hours ago code\cgame\cg_drawtools.c
Changed 61.23 KB 9 minutes ago libs\cmdlib.h
Changed 398 bytes 8 minutes ago libs\str.h
Deleted
Status Size Path
Removed 12.41 KB code\bsp-temp.c
Added
Status Size Last Modified Path
Added 4.42 KB 17 seconds ago code\bsp-experimental.c
이번에는 추가 및 제거의 실행은 취소하되, 변경사항은 유지하려 합니다. 필터를 사용하여 이 작업을 처리합니다.
>cm undo --added --deleted -r
c:\Users\pablo\wkspaces\quake_path\code\bsp-experimental.c unchecked out correctly
c:\Users\pablo\wkspaces\quake_path\code\bsp-temp.c unchecked out correctly
이제 상태는 다음과 같습니다.
>cm status
/main/fix-1342@quake@localhost:8084 (cs:575 - head)
Changed
Status Size Last Modified Path
Changed 49.23 KB 2 hours ago code\bsp-renamed.c
Changed 23.42 KB 2 hours ago code\cgame\cg_drawtools.c
Changed 61.23 KB 10 minutes ago libs\cmdlib.h
Changed 398 bytes 9 minutes ago libs\str.h
원하던 결과가 나왔습니다.
단일 변경사항 적용 취소
변경된 파일 하나만 되돌리려면 어떻게 해야 할까요?
다음과 같이 여러 파일을 수정했습니다.
>cm status
/main/fix-1342@quake@localhost:8084 (cs:575 - head)
Changed
Status Size Last Modified Path
Changed 15.83 KB 50 seconds ago code\cgame\cg_ents.c
Changed 35.27 KB 30 seconds ago code\cgame\cg_main.c
하지만 cg_main.c
파일에 대한 변경사항만 되돌리고자 합니다. 이때 다음 명령을 실행하면 됩니다.
>cm undo code\cgame\cg_main.c
c:\Users\pablo\wkspaces\quake_path\code\cgame\cg_main.c unchecked out correctly
>cm status
/main/fix-1342@quake@localhost:8084 (cs:575 - head)
Changed
Status Size Last Modified Path
Changed 15.83 KB 50 seconds ago code\cgame\cg_ents.c
경로별 필터링을 통한 변경사항 적용 취소
이번에는 특정 경로에서 몇 가지 변경사항을 되돌려야 한다고 가정해 보겠습니다.
>cm status
/main/fix-1342@quake@localhost:8084 (cs:575 - head)
Changed
Status Size Last Modified Path
Changed 15.83 KB 50 seconds ago code\lib\be_aas_cluster.c
Changed 35.27 KB 5 minutes ago code\cgame\cg_ents.c
Changed 73.15 KB 5 minutes ago code\cgame\cg_localents.c
Changed 62.62 KB 5 minutes ago code\renderer\tr_cmds.c
Changed 12.26 KB 5 minutes ago merge\Socket.cs
code
아래의 변경사항만 되돌리고 merge
아래의 변경사항은 그대로 두고자 합니다.
>cm unco code -r
c:\Users\pablo\wkspaces\quake_path\code\renderer\tr_cmds.c unchecked out correctly
c:\Users\pablo\wkspaces\quake_path\code\cgame\cg_localents.c unchecked out correctly
c:\Users\pablo\wkspaces\quake_path\code\cgame\cg_ents.c unchecked out correctly
c:\Users\pablo\wkspaces\quake_path\code\lib\be_aas_cluster.c unchecked out correctly
이제 예상대로 상태는 다음과 같습니다.
>cm status
/main/fix-1342@quake@localhost:8084 (cs:575 - head)
Changed
Status Size Last Modified Path
Changed 12.26 KB 5 minutes ago merge\Socket.cs
와일드카드를 사용하여 대상을 더 정확하게 좁힐 수 있습니다.
>cm status
/main/fix-1342@quake@localhost:8084 (cs:575 - head)
Changed
Status Size Last Modified Path
Changed 15.83 KB 4 minutes ago code\lib\be_aas_cluster.c
Changed 3.14 KB 4 minutes ago code\lib\be_aas_cluster.h
Changed 35.27 KB 8 minutes ago code\cgame\cg_ents.c
Changed 3.24 KB 2 minutes ago code\cgame\cg_ents.h
Changed 73.15 KB 8 minutes ago code\cgame\cg_localents.c
Changed 6.14 KB 2 minutes ago code\cgame\cg_localents.h
Changed 62.62 KB 8 minutes ago code\renderer\tr_cmds.c
Changed 1.98 KB 2 minutes ago code\renderer\tr_cmds.h
Changed 12.26 KB 8 minutes ago merge\Socket.cs
이번에는 code
아래의 헤더 파일을 되돌리고 소스 파일은 그대로 두고자 합니다.
>cm unco code\*.h -r
c:\Users\pablo\wkspaces\quake_path\code\renderer\tr_cmds.h unchecked out correctly
c:\Users\pablo\wkspaces\quake_path\code\cgame\cg_localents.h unchecked out correctly
c:\Users\pablo\wkspaces\quake_path\code\cgame\cg_ents.h unchecked out correctly
c:\Users\pablo\wkspaces\quake_path\code\lib\be_aas_cluster.h unchecked out correctly
이제 예상대로 상태는 다음과 같습니다.
>cm status
/main/fix-1342@quake@localhost:8084 (cs:575 - head)
Changed
Status Size Last Modified Path
Changed 15.83 KB 5 minutes ago code\lib\be_aas_cluster.c
Changed 35.27 KB 9 minutes ago code\cgame\cg_ents.c
Changed 73.15 KB 9 minutes ago code\cgame\cg_localents.c
Changed 62.62 KB 9 minutes ago code\renderer\tr_cmds.c
Changed 12.26 KB 9 minutes ago merge\Socket.cs
지정된 경로 내의 변경사항 체크인
주어진 경로의 특정 파일만 체크인한다고 가정해 보겠습니다. 다음과 같이 수정된 파일이 여러 개 있습니다.
>cm status
/main/fix-1342@quake@localhost:8084 (cs:575 - head)
Changed
Status Size Last Modified Path
Changed 12.26 KB 5 minutes ago merge\Socket.cs
Changed 42.26 KB 5 minutes ago q3radiant\alpha\osf\tst\sort.sbk
Changed 86.27 KB 5 minutes ago q3radiant\alpha\osf\tst\spill.2bk
Changed 85.27 KB 5 minutes ago q3radiant\alpha\osf\tst\spill.sbk
Changed 34.26 KB 5 minutes ago q3radiant\alpha\osf\tst\stdarg.1bk
Changed 34.26 KB 5 minutes ago q3radiant\alpha\osf\tst\stdarg.2bk
Changed 34.26 KB 5 minutes ago q3radiant\alpha\osf\tst\stdarg.sbk
하지만 q3radiant\alpha
내부에 있는 파일만 체크인하려 하므로 다음과 같이 checkin을 실행합니다.
>cm ci q3radiant\alpha\* -c "osf files checked in" --all
The selected items are about to be checked in. Please wait ...
Assembling checkin data
Validating checkin data
Uploading file data
Uploaded 0 bytes of 14.53 KB (0%)
Uploaded 0 bytes of 14.53 KB (0%)
Uploaded 0 bytes of 14.53 KB (0%)
Uploaded 0 bytes of 14.53 KB (0%)
Uploaded 0 bytes of 14.53 KB (0%)
Uploaded 0 bytes of 14.53 KB (0%)
Confirming checkin operation
Modified c:\Users\pablo\wkspaces\quake_path\q3radiant\alpha\osf\tst\sort.sbk
Modified c:\Users\pablo\wkspaces\quake_path\q3radiant\alpha\osf\tst\spill.2bk
Modified c:\Users\pablo\wkspaces\quake_path\q3radiant\alpha\osf\tst\spill.sbk
Modified c:\Users\pablo\wkspaces\quake_path\q3radiant\alpha\osf\tst\stdarg.1bk
Modified c:\Users\pablo\wkspaces\quake_path\q3radiant\alpha\osf\tst\stdarg.2bk
Modified c:\Users\pablo\wkspaces\quake_path\q3radiant\alpha\osf\tst\stdarg.sbk
Created changeset cs:576@br:/main/fix-1342@quake@localhost:6060 (mount:'/')
변경과 체크아웃의 차이
Plastic SCM에서 파일은 변경되거나 체크아웃될 수 있습니다. 따라서 편집-체크인 또는 체크아웃-편집-체크인이라는 두 가지 워크플로를 따를 수 있습니다.
파일을 체크아웃한다는 것은 Plastic에 "파일을 수정하겠다"고 알려 Plastic이 내부적으로 파일을 체크아웃된 파일 목록에 추가하게 됨을 의미합니다.
체크아웃을 주로 사용하는 3가지 이유는 다음과 같습니다.
-
Perforce(p4 편집) 또는 ClearCase(체크아웃) 방식을 사용해 보았으므로 이러한 방식으로 작업하는 데 익숙합니다. 이렇게 작업하는 사용자는 워크스페이스의 모든 파일을 읽기 전용으로 설정해 일종의 보호 상태로 만들고, 체크아웃하지 않은 파일을 수정할 경우 파일 시스템에서 경고를 표시하게 하는 방식을 선호한다고 볼 수 있습니다.
- 배타적 체크아웃(잠금)을 사용해야 하는 경우 파일을 편집하기 전에 체크아웃해야 합니다. 여기에서 잠금에 대해 읽어보십시오.
- 큰 규모의 코드베이스(파일 50만 개 초과)로 작업하는 경우 모든 작업의 속도를 높이기 위해 체크아웃을 사용하는 것이 좋을 수 있습니다. cm status 명령을 통해 워크스페이스에서 변경사항을 찾습니다. 체크아웃을 사용하는 경우 status 명령은 체크아웃 목록에 있는 파일만 나열하므로 디스크 액세스는 필요하지 않습니다.
체크아웃-편집-체크인 워크플로
체크아웃-편집-체크인 방식의 작업은 매우 간단합니다. 파일을 편집하기 전에 cm co 명령을 실행하기만 하면 됩니다.
>cm co q3radiant\Bmp.cpp
The selected items are about to be checked out. Please wait ...
Item q3radiant\Bmp.cpp was correctly checked out
>cm status
/main/fix-1342@quake@localhost:8084 (cs:576 - head)
Changed
Status Size Last Modified Path
Changed 12.26 KB 5 minutes ago merge\Socket.cs
Checked-out 12.21 KB 65 minutes ago q3radiant\Bmp.cpp
이제 Bmp.cpp
가 변경됨이 아닌 체크아웃됨으로 표시된 것을 확인할 수 있습니다.
다음 예에서 볼 수 있듯이 cm mv 명령을 실행하여 이동한 파일은 다른 형태로 체크아웃된 것으로 간주됩니다.
>cm mv common\aselib.c q3asm
common\aselib.c has been moved to q3asm
>cm status
/main/fix-1342@quake@localhost:8084 (cs:576 - head)
Changed
Status Size Last Modified Path
Changed 12.26 KB 5 minutes ago merge\Socket.cs
Checked-out 12.21 KB 65 minutes ago q3radiant\Bmp.cpp
Moved
Status Size Similarity Path
Moved 88 bytes common\aselib.c -> q3asm\aselib.c
aselib.c
가 "로컬에서 이동된" 것이 아니라 그냥 이동된 것임을 알 수 있습니다.
다음과 같이 두 개의 체크아웃된 파일을 체크인할 수 있습니다.
>cm ci -c "changed bmp and moved aselib"
The selected items are about to be checked in. Please wait ...
Assembling checkin data
Validating checkin data
Uploading file data
Uploaded 0 bytes of 9.26 KB (0%)
Confirming checkin operation
Modified c:\Users\pablo\wkspaces\quake_path\q3radiant\Bmp.cpp
Modified c:\Users\pablo\wkspaces\quake_path\common
Modified c:\Users\pablo\wkspaces\quake_path\q3asm
Move from c:\Users\pablo\wkspaces\quake_path\common\aselib.c to c:\Users\pablo\wkspaces\quake_path\q3asm\aselib.c
Created changeset cs:577@br:/main/fix-1342@quake@localhost:6060 (mount:'/')
checkin에 --all 조정값을 지정하지 않았으므로 체크아웃된 파일만 체크인되었으며 Socket.cs
파일은 여전히 변경 대기 상태입니다.
>cm status
/main/fix-1342@quake@localhost:8084 (cs:577 - head)
Changed
Status Size Last Modified Path
Changed 12.26 KB 5 minutes ago merge\Socket.cs
병합
CLI에서 병합하는 것은 매우 쉽습니다. cm merge 명령만 실행하면 됩니다.
지금까지는 main/fix-1342 브랜치에서 모든 것을 변경했습니다. 이제 주 브랜치로 전환하여 변경사항을 병합합니다. 이 시점의 상황은 다음과 같습니다.
주 브랜치로 전환합니다.
>cm switch main
Performing switch operation...
Searching for changed items in the workspace...
Cannot perform the switch to branch/label/changeset since there are pending changes. Please review the pending changes and retry the operation again.
Socket.cs
를 누락했기 때문에 아직 전환할 수 없습니다. 먼저 변경사항을 취소한 뒤 다시 전환을 시도합니다.
>cm undo merge\Socket.cs
c:\Users\pablo\wkspaces\quake_path\merge\Socket.cs unchecked out correctly
>cm switch main
Performing switch operation...
Searching for changed items in the workspace...
Setting the new selector...
Plastic is updating your workspace. Wait a moment, please...
Downloading block of 8 files (26.57 KB)
Copied c:\Users\pablo\wkspaces\quake_path\q3radiant\Bmp.cpp
Copied c:\Users\pablo\wkspaces\quake_path\code\FileSystem-renamed.cs
Copied c:\Users\pablo\wkspaces\quake_path\q3radiant\alpha\osf\tst\sort.sbk
Copied c:\Users\pablo\wkspaces\quake_path\q3radiant\alpha\osf\tst\spill.2bk
Copied c:\Users\pablo\wkspaces\quake_path\q3radiant\alpha\osf\tst\spill.sbk
Copied c:\Users\pablo\wkspaces\quake_path\q3radiant\alpha\osf\tst\stdarg.1bk
Copied c:\Users\pablo\wkspaces\quake_path\q3radiant\alpha\osf\tst\stdarg.2bk
Copied c:\Users\pablo\wkspaces\quake_path\q3radiant\alpha\osf\tst\stdarg.sbk
switch명령은 워크스페이스를 업데이트하여 브랜치에서 변경한 모든 파일을 주 브랜치의 버전으로 교체합니다.
이제 상태는 다음과 같습니다.
>cm status
/main@quake@localhost:6060 (cs:573 - head)
상태는 브랜치 탐색기에도 반영됩니다.
이제 merge 명령을 실행합니다.
>cm merge main/fix-1342
The file /q3radiant/Bmp.cpp#cs:577 was modified on source and will replace the destination version
The file /q3radiant/alpha/osf/tst/sort.sbk#cs:576 was modified on source and will replace the destination version
The file /q3radiant/alpha/osf/tst/spill.2bk#cs:576 was modified on source and will replace the destination version
The file /q3radiant/alpha/osf/tst/spill.sbk#cs:576 was modified on source and will replace the destination version
The file /q3radiant/alpha/osf/tst/stdarg.1bk#cs:576 was modified on source and will replace the destination version
The file /q3radiant/alpha/osf/tst/stdarg.2bk#cs:576 was modified on source and will replace the destination version
The file /q3radiant/alpha/osf/tst/stdarg.sbk#cs:576 was modified on source and will replace the destination version
The file /code/lib/FileSystem.cs#cs:575 was modified on source and will replace the destination version
The item /common/aselib.c has been moved to /q3asm/aselib.c on source and will be moved as result of the merge
The item /code/FileSystem-renamed.cs has been moved to /code/lib/FileSystem.cs on source and will be moved as result of the merge
조정값 없이 병합하면 병합 대상의 프리뷰만 출력되므로 앞으로의 전개 상황을 이해하는 데 매우 유용합니다.
병합을 더 흥미로운 방향으로 진행하기 위해 FileSystem-renamed.cs
(이동 후 브랜치에서 이름 변경됨)를 수정하려 합니다.
>cm co code\FileSystem-renamed.cs
The selected items are about to be checked out. Please wait ...
Item code\FileSystem-renamed.cs was correctly checked out
>vim code\FileSystem-renamed.cs
>cm ci code\FileSystem-renamed.cs
The selected items are about to be checked in. Please wait ...
Assembling checkin data
Validating checkin data
Uploading file data
Uploaded 0 bytes of 2.82 KB (0%)
Confirming checkin operation
Modified c:\Users\pablo\wkspaces\quake_path\code\FileSystem-renamed.cs
Created changeset cs:578@br:/main@quake@localhost:6060 (mount:'/')
이제 병합을 다시 실행하고 코멘트를 추가합니다.
>cm merge main/fix-1342 -c="Added changes and fixes to the interface"
The file /q3radiant/Bmp.cpp#cs:577 was modified on source and will replace the destination version
The file /q3radiant/alpha/osf/tst/sort.sbk#cs:576 was modified on source and will replace the destination version
The file /q3radiant/alpha/osf/tst/spill.2bk#cs:576 was modified on source and will replace the destination version
The file /q3radiant/alpha/osf/tst/spill.sbk#cs:576 was modified on source and will replace the destination version
The file /q3radiant/alpha/osf/tst/stdarg.1bk#cs:576 was modified on source and will replace the destination version
The file /q3radiant/alpha/osf/tst/stdarg.2bk#cs:576 was modified on source and will replace the destination version
The file /q3radiant/alpha/osf/tst/stdarg.sbk#cs:576 was modified on source and will replace the destination version
The item /common/aselib.c has been moved to /q3asm/aselib.c on source and will be moved as result of the merge
The item /code/FileSystem-renamed.cs has been moved to /code/lib/FileSystem.cs on source and will be moved as result of the merge
The file /code/FileSystem-renamed.cs needs to be merged from cs:575 to cs:578 base cs:573. Changed by both contributors.
FileSystem-renamed.cs
는 두 명의 기여자가 수정했으므로, 마지막 줄에서 볼 수 있듯이 이제 3단계 병합이 필요합니다.
이제, 실제 병합을 수행하기 위한 --merge 조정값과 파일 콘텐츠에서 새 체인지 세트의 코멘트를 설정하기 위한 --commentsfile 조정값을 merge 명령에 추가하여 병합을 실행합니다.
>cm merge main/fix-1342 --merge --commentsfile=comment-merge-fix-1342.txt
The file /q3radiant/Bmp.cpp#cs:577 was modified on source and will replace the destination version
The file /q3radiant/alpha/osf/tst/sort.sbk#cs:576 was modified on source and will replace the destination version
The file /q3radiant/alpha/osf/tst/spill.2bk#cs:576 was modified on source and will replace the destination version
The file /q3radiant/alpha/osf/tst/spill.sbk#cs:576 was modified on source and will replace the destination version
The file /q3radiant/alpha/osf/tst/stdarg.1bk#cs:576 was modified on source and will replace the destination version
The file /q3radiant/alpha/osf/tst/stdarg.2bk#cs:576 was modified on source and will replace the destination version
The file /q3radiant/alpha/osf/tst/stdarg.sbk#cs:576 was modified on source and will replace the destination version
The item /common/aselib.c has been moved to /q3asm/aselib.c on source and will be moved as result of the merge
The item /code/FileSystem-renamed.cs has been moved to /code/lib/FileSystem.cs on source and will be moved as result of the merge
The file /code/FileSystem-renamed.cs needs to be merged from cs:575 to cs:578 base cs:573. Changed by both contributors.
Merging c:\Users\pablo\wkspaces\quake_path\q3asm\aselib.c
c:\Users\pablo\wkspaces\quake_path\common\aselib.c has been moved to c:\Users\pablo\wkspaces\quake_path\q3asm\aselib.c
Merging c:\Users\pablo\wkspaces\quake_path\code\lib\FileSystem.cs
c:\Users\pablo\wkspaces\quake_path\code\FileSystem-renamed.cs has been moved to c:\Users\pablo\wkspaces\quake_path\code\lib\FileSystem.cs
Merging c:\Users\pablo\wkspaces\quake_path\q3radiant\Bmp.cpp
The revision c:\Users\pablo\wkspaces\quake_path\q3radiant\Bmp.cpp@cs:577 has been loaded
Merging c:\Users\pablo\wkspaces\quake_path\q3radiant\alpha\osf\tst\sort.sbk
The revision c:\Users\pablo\wkspaces\quake_path\q3radiant\alpha\osf\tst\sort.sbk@cs:576 has been loaded
Merging c:\Users\pablo\wkspaces\quake_path\q3radiant\alpha\osf\tst\spill.2bk
The revision c:\Users\pablo\wkspaces\quake_path\q3radiant\alpha\osf\tst\spill.2bk@cs:576 has been loaded
Merging c:\Users\pablo\wkspaces\quake_path\q3radiant\alpha\osf\tst\spill.sbk
The revision c:\Users\pablo\wkspaces\quake_path\q3radiant\alpha\osf\tst\spill.sbk@cs:576 has been loaded
Merging c:\Users\pablo\wkspaces\quake_path\q3radiant\alpha\osf\tst\stdarg.1bk
The revision c:\Users\pablo\wkspaces\quake_path\q3radiant\alpha\osf\tst\stdarg.1bk@cs:576 has been loaded
Merging c:\Users\pablo\wkspaces\quake_path\q3radiant\alpha\osf\tst\stdarg.2bk
The revision c:\Users\pablo\wkspaces\quake_path\q3radiant\alpha\osf\tst\stdarg.2bk@cs:576 has been loaded
Merging c:\Users\pablo\wkspaces\quake_path\q3radiant\alpha\osf\tst\stdarg.sbk
The revision c:\Users\pablo\wkspaces\quake_path\q3radiant\alpha\osf\tst\stdarg.sbk@cs:576 has been loaded
Merging c:\Users\pablo\wkspaces\quake_path\code\lib\FileSystem.cs
Merge done
모든 병합이 워크스페이스에 적용되고 FileSystem.cs
에서의 충돌을 해결하기 위해 구성했던 3단계 병합 툴(기본적으로 Plastic의 Xmerge)이 실행됩니다. FileSystem.cs
가 어떻게 올바르게 이동하여 이름이 변경되었고 파일 콘텐츠가 올바르게 병합되었는지 확인하십시오.
이제, status 명령을 실행하면 병합된 모든 파일이 체크아웃됨 상태가 됩니다.
>cm status
/main@quake@localhost:6060 (cs:578 - head)
Pending merge links
Merge from cs:577 at /main/fix-1432@test@localhost:8084
Changed
Status Size Last Modified Path
Checked-out (Merge from 577) 41.32 KB 6 hours ago code\lib\FileSystem.cs
Replaced (Merge from 577) 42.26 KB 6 hours ago q3radiant\alpha\osf\tst\sort.sbk
Replaced (Merge from 577) 86.27 KB 6 hours ago q3radiant\alpha\osf\tst\spill.2bk
Replaced (Merge from 577) 85.27 KB 6 hours ago q3radiant\alpha\osf\tst\spill.sbk
Replaced (Merge from 577) 34.26 KB 6 hours ago q3radiant\alpha\osf\tst\stdarg.1bk
Replaced (Merge from 577) 34.26 KB 6 hours ago q3radiant\alpha\osf\tst\stdarg.2bk
Replaced (Merge from 577) 34.26 KB 6 hours ago q3radiant\alpha\osf\tst\stdarg.sbk
Replaced (Merge from 577) 12.21 KB 6 hours ago q3radiant\Bmp.cpp
Moved
Status Size Similarity Path
Moved 14.41 KB code\FileSystem-renamed.cs -> code\lib\FileSystem.cs
Moved 88 bytes common\aselib.c -> q3asm\aselib.c
현재 사용 중인 새로운 상태가 교체됨이라는 것을 볼 수 있습니다. 따라서, 효율성을 위해 버전 관리에서 파일을 복사하지 않고 브랜치에 있는 원래 위치의 포인터가 저장된 다음, FileSystem.cs
파일은 병합이 완료됐기 때문에 실제 체크아웃됨으로 표시됩니다.
이 시점에서 브랜치 탐색기는 다음과 같이 표시됩니다.
파선은 병합이 여전히 진행 중이고 체크인되지 않았다는 것을 의미합니다.
이제 cm ci 명령을 사용하여 간단하게 체크인할 수 있습니다.
>cm ci -m "merged from fix-1342"
The selected items are about to be checked in. Please wait ...
Assembling checkin data
Validating checkin data
Uploading file data
Uploaded 0 bytes of 2.80 KB (0%)
Confirming checkin operation
Modified c:\Users\pablo\wkspaces\quake_path\common
Modified c:\Users\pablo\wkspaces\quake_path\q3asm
Move from c:\Users\pablo\wkspaces\quake_path\common\aselib.c to c:\Users\pablo\wkspaces\quake_path\q3asm\aselib.c
Modified c:\Users\pablo\wkspaces\quake_path\code
Modified c:\Users\pablo\wkspaces\quake_path\code\lib
Modified and moved from c:\Users\pablo\wkspaces\quake_path\code\FileSystem-renamed.cs to c:\Users\pablo\wkspaces\quake_path\code\lib\FileSystem.cs
Modified c:\Users\pablo\wkspaces\quake_path\q3radiant
Replaced c:\Users\pablo\wkspaces\quake_path\q3radiant\Bmp.cpp
Replaced c:\Users\pablo\wkspaces\quake_path\q3radiant\alpha\osf\tst\sort.sbk
Replaced c:\Users\pablo\wkspaces\quake_path\q3radiant\alpha\osf\tst\spill.2bk
Replaced c:\Users\pablo\wkspaces\quake_path\q3radiant\alpha\osf\tst\spill.sbk
Replaced c:\Users\pablo\wkspaces\quake_path\q3radiant\alpha\osf\tst\stdarg.1bk
Replaced c:\Users\pablo\wkspaces\quake_path\q3radiant\alpha\osf\tst\stdarg.2bk
Replaced c:\Users\pablo\wkspaces\quake_path\q3radiant\alpha\osf\tst\stdarg.sbk
Created changeset cs:579@br:/main@quake@localhost:6060 (mount:'/')
레이블 적용
새롭게 병합된 코드에 레이블을 지정하려면 다음과 같이 cm label만 실행하면 됩니다.
>cm label BL612 cs:579
브랜치 탐색기가 이제 다음과 같이 표시됩니다.
사용 가능한 리포지토리 나열
repository [list] 명령을 사용하면 주어진 서버의 리포지토리를 쉽게 나열할 수 있습니다.
>cm repository
codice@localhost:6060
pnunit@localhost:6060
nervathirdparty@localhost:6060
quake@localhost:6060
기본적으로 repository는 구성 마법사에서 구성하고 client.conf
에 기록되어 있는 서버인 기본 서버의 리포지토리를 보여 줍니다.
> type client.conf
<ClientConfigData>
<Language>en</Language>
<WorkspaceServer>localhost:6060</WorkspaceServer>
<WorkingMode>UPWorkingMode</WorkingMode>
<SecurityConfig>pablo:dM629yb8hWO6qD+8jAqaag==</SecurityConfig>
<CurrentWorkspace>c:\Users\pablo\wkspaces\four</CurrentWorkspace>
<MergeTools>
<MergeToolData>
<FileExtensions>.cs</FileExtensions>
<Tools>
...
repository list 명령은 다른 유형의 서버도 입력할 수 있어 서버와 관련된 연결 문제를 진단하는 데에도 매우 유용하며, 그 방법은 다음과 같습니다.
>cm repository list tube:dianaserver@codice.es --format=TABLE
4 codice tube:dianaserver@codice.es
4_1 codice/unitymerge tube:dianaserver@codice.es
5 pnunit tube:dianaserver@codice.es
6 nervathirdparty tube:dianaserver@codice.es
6_1 nervathirdparty/yamldotnet tube:dianaserver@codice.es
6_2 nervathirdparty/yamldotnet_buildutils tube:dianaserver@codice.es
35 licensetools tube:dianaserver@codice.es
55 plasticscm.com tube:dianaserver@codice.es
64 indexertest tube:dianaserver@codice.es
1741 tts tube:dianaserver@codice.es
사용 가능한 워크스페이스 나열
Plastic SCM은 사용자의 기기에 저장되어 있는 워크스테이션의 목록을 보관합니다. 단 이는 최소한의 정보가 알려진 경우에 한하며, 사용자가 워크스페이스를 복사했으나 Plastic에는 알려지지 않은 경우에는 이 목록에 포함되지 않을 수 있습니다.
>cm workspace list
codebase@MODOK c:\Users\pablo\wkspaces\four
doc@MODOK c:\Users\pablo\wkspaces\doc
mkt@MODOK c:\Users\pablo\wkspaces\marketing
quakecode@MODOK c:\Users\pablo\wkspaces\testwkspaces\quakewk
codicediana@MODOK c:\Users\pablo\wkspaces\codicediana
도움말 보기
이 가이드에서는 CLI로 처리할 수 있는 모든 종류의 작업을 설명합니다. 사용 가능한 다른 명령을 찾으려면 cm showcommands를 실행하면 됩니다.
또한 모든 명령에서 cm <command> --usage 명령을 사용해 옵션에 대한 빌트인 기술 자료를 확인할 수 있고, cm <command> --help 명령을 사용하면 예제가 포함된 포괄적인 도움말을 확인할 수 있습니다.
CLI가 예상대로 동작하지 않는 경우 Plastic 지원 팀에 연락해야 할 수 있습니다. 문제 진단에 도움이 될 수 있도록, 다음과 같이 cm support 명령을 사용하여 유용한 진단 정보가 담긴 zip 파일을 생성하고 전송할 수 있습니다.
>cm support bundle c:\supportbundle.zip
Creating a new support bundle...
Adding clientinfo.txt...
Adding clientprocessinfo.txt...
Adding client.conf...
Adding filetypes.conf...
Adding guiclient.conf...
Adding mergetool.conf...
Adding plastic.uisettings.conf...
Adding plasticgui.conf...
Adding syncviews.conf...
Adding logs\plastic.debug.log.txt...
Adding logs\plastic.relevant.log.txt...
Support bundle created at c:\supportbundle.zip
CommandResult 0
로컬 변경사항
한 스크립트를 실행하여 로컬 이동 및 삭제를 비롯해 소스 파일의 내용을 다수 변경했습니다. status는 다음과 같이 표시됩니다.
>cm status
/main@quake@localhost:6060 (cs:578 - head)
Deleted
Status Size Path
Removed locally 34.26 KB q3radiant\alpha\osf\tst\stdarg.sbk
Moved
Status Size Similarity Path
Moved locally 88 bytes 100% q3asm\aselib.c -> q3asm\aselib_fixed.c
파일이 이동되거나 삭제되었는데 이러한 변경사항을 소스 제어로 가져올 방법이 있을까요? 문제 없습니다. 다음과 같이 move 또는 remove 명령을 실행해 관리되는 변경사항을 만들면 됩니다.
>cm remove q3radiant\alpha\osf\tst\stdarg.sbk
Item q3radiant\alpha\osf\tst\stdarg.sbk has been removed.
>cm move q3asm\aselib.c -> q3asm\aselib_fixed.c
q3asm\aselib.c has been moved to q3asm\aselib_fixed.c
>cm status
/main@quake@localhost:6060 (cs:578 - head)
Deleted
Status Size Path
Removed 34.26 KB q3radiant\alpha\osf\tst\stdarg.sbk
Moved
Status Size Similarity Path
Moved 88 bytes q3asm\aselib.c -> q3asm\aselib_fixed.c
변경사항 임시 저장
몇 가지 실험적인 코드 변경 작업을 진행하고 있으며, 변경사항을 소스 제어에 저장하고 동료와 공유하고 싶지만 그냥 시도 중인 아이디어일 뿐이므로 브랜치에는 체크인하지 않으려 합니다.
이러한 상황에서는 shelveset 명령을 사용하여 사실상 어떤 브랜치와도 연결되지 않은 체인지 세트를 커밋합니다.
>cm shelveset src\experimental_changes
Uploading file data
Confirming checkin operation
Modified src\experimental_changes
Created shelve sh:25@myrepo@localhost:8080 (mount:'/')
리포지토리에 로컬 변경사항을 임시 저장했습니다. 이 브랜치를 다른 워크스페이스로 전환하고 평소와 같이 계속 작업합니다. 나중에 이렇게 실험적으로 작업 중이던 변경사항으로 되돌리고 싶을 수 있습니다. 변경사항을 되돌리려면 apply 하위 명령을 사용하여 워크스페이스에 임시 저장 세트를 적용하면 됩니다.
>cm shelveset apply sh:25
The item /newtonraphson.cs#sh:25 has been added on source and will be added as result of the merge
Merging \src\experimental_changes\newtonraphson.cs
The revision \src\experimental_changes\newtonraphson.cs@sh:25 has been loaded
파이프 사용
Plastic CLI에서 자주 간과되곤 하는 기능 중 하나로, - 옵션을 다음과 같이 사용하면 표준 입력에서 인수를 하나씩 읽을 수 있습니다.
>cm add -
a.txt
b.txt
c.txt
The selected items are about to be added. Please wait ...
Item c:\Users\pablo\wkspaces\mcga\a.txt was correctly added
Item c:\Users\pablo\wkspaces\mcga\b.txt was correctly added
Item c:\Users\pablo\wkspaces\mcga\c.txt was correctly added
>cm ci -
a.txt
b.txt
c.txt
The selected items are about to be checked in. Please wait ...
\ Checkin finished 12 bytes/12 bytes [##################################] 100 %
Modified c:\mcga
Added c:\Users\pablo\wkspaces\mcga\a.txt
Added c:\Users\pablo\wkspaces\mcga\b.txt
Added c:\Users\pablo\wkspaces\mcga\c.txt
Created changeset cs:22@br:/main@test@localhost:8084 (mount:'/')
>cm rm -
a.txt
Item a.txt has been removed.
b.txt
Item b.txt has been removed.
c.txt
Item c.txt has been removed.
이 기능이 유용한 이유는 다른 명령의 출력을 cm으로 파이핑할 수 있기 때문입니다.
다음 명령은 파이핑된 경로를 허용합니다.
- add
- applylocalchanges
- checkin
- checkout
- getstatus
- partialcheckin
- remove
- shelveset create
- undocheckout
- undochange
- uncounchanged
- wktreenodestatus
예를 살펴보겠습니다.
-
Windows dir 명령을 사용하여 워크스페이스에서 패턴과 일치하는 모든 파일을 쉽게 제거할 수 있습니다.
>dir /S /B *.txt | cm rm -
Item c:\Users\pablo\wkspaces\mcga\a.txt has been removed.
Item c:\Users\pablo\wkspaces\mcga\b.txt has been removed.
Item c:\Users\pablo\wkspaces\mcga\c.txt has been removed.
Item c:\Users\pablo\wkspaces\mcga\z.txt has been removed.
Item c:\Users\pablo\wkspaces\mcga\lockwkB\file.txt has been removed.
Item c:\Users\pablo\wkspaces\mcga\src_dir\dest_dir\a.txt has been removed.
Item c:\Users\pablo\wkspaces\mcga\src_dir\dest_dir\b.txt has been removed.
Item c:\Users\pablo\wkspaces\mcga\src_dir\dest_dir\c.txt has been removed.
-
checkout 명령을 사용해 파이핑된 디렉터리 인수를 재귀적으로 사용할 수 있습니다.
Directory of c:/mcga/pipe
11/05/2020 19:48 <DIR> .
11/05/2020 19:48 <DIR> ..
11/05/2020 17:57 <DIR> dir
11/05/2020 19:46 <DIR> dir2
11/05/2020 19:47 12 dirlist
1 File(s) 12 bytes
4 Dir(s) 23,714,631,680 bytes free
c:/mcga/pipe>type dirlist
dir
dir2
c:/mcga/pipe>type dirlist | cm partial co -r -
The selected items are about to be checked out. Please wait ...
Item c:/mcga/pipe/dir was correctly checked out
Item c:/mcga/pipe/dir/file was correctly checked out
Item c:/mcga/pipe/dir2 was correctly checked out
Item c:/mcga/pipe/dir2/file2 was correctly checked out
이제 파이프와 cm을 함께 사용하여 뛰어난 스크립트를 작성할 수 있습니다.
최근 업데이트
2020년 6월 10일
이제 파이프 사용 장에 checkout 명령을 사용하여 파이핑된 디렉터리 인수를 재귀적으로 사용할 수 있는 방법에 대한 예시가 추가되었습니다.
2020년 6월 8일
출력에 헤드 체인지 세트가 기본으로 포함되므로 cm status의 예시를 편집했습니다.
2020년 1월 21일
이제 경로를 지정하지 않고 현재 워크스페이스 전체를 업데이트할 수 있습니다.
2019년 5월 16일
Plastic CLI로 파이프 사용하기에 대한 섹션을 추가했습니다.
2019년 3월 26일
새 cm undo 명령을 사용하기 위해 변경사항을 취소하는 방법의 예시를 업데이트했습니다.
2019년 5월 14일
cm mkwk와 같이 사용되지 않는 워크스페이스 관리 명령에 대한 레퍼런스를 새로운 레퍼런스로 교체했습니다.
2019년 3월 22일
cm lrep 명령처럼 사용되지 않는 리포지토리 관리 명령에 대한 레퍼런스를 새로운 레퍼런스로 교체했습니다.
사용되지 않는 cm mkbr 명령을 cm branch 명령으로 교체하기 위해 새 브랜치 생성 및 전환 장을 편집했습니다.
2019년 3월 21일
cm shelveset 명령을 사용하여 변경사항 임시 저장하기에 대한 섹션을 업데이트했습니다.
2019년 3월 13일
CLI에서 새 레이블 관련 명령을 사용하여 cm mklabel에 대한 참조를 cm label 인라인으로 변경했습니다.
2019년 2월 8일
새로운 출력 형식과 변경된 옵션을 반영하기 위해 가이드 전체에 걸쳐 cm status의 출력을 업데이트했습니다.
cm status --head를 사용하여 헤드 체인지 세트를 확인하는 방법을 소개하기 위해 새 워크스페이스 생성 장을 편집했습니다.
cm support를 사용하여 진단 정보를 생성하는 방법을 소개하기 위해 도움말 보기 장을 새로 추가했습니다.
cm mv 및 cm rm을 사용하여 로컬 변경사항을 소스 제어로 가져오는 방법을 소개하기 위해 로컬 변경사항 장을 새로 추가했습니다.
가독성 향상을 위해 예시에서 몇 가지 경로를 단축했습니다.
2018년 9월 4일
병합 작업 중 코멘트(-c 및 --commentsfile 조정값)를 포함하는 방법을 소개하기 위해 병합 장을 편집했습니다.
2018년 2월 26일
cm help objectspec 명령을 실행하여 Plastic에서 지원하는 여러 객체 사양의 정의에 대해 알아볼 수 있습니다.
2015년 8월 24일
cm log 및 cm diff의 예시가 업데이트됐습니다. 이제 해당 명령은 전체 워크스페이스 경로 대신 워크스페이스 루트 상대 경로를 기본값으로 출력합니다.
lrep 및 lwk 명령의 형식 문자열을 개선했습니다.