Plastic SCM 是一个可视化的版本控制系统。但是,也可以从命令行使用它。
本指南将逐步引导您了解常见的命令行界面 (CLI) 场景,以帮助您熟悉 Plastic。
请记住,您始终可以使用 cm help command_name 获取有关所有命令的更多信息。
运行 cm help objectspec 命令可了解 Plastic 支持的不同对象规格的定义。
Plastic SCM 是一个可视化的版本控制系统。但是,也可以从命令行使用它。
本指南将逐步引导您了解常见的命令行界面 (CLI) 场景,以帮助您熟悉 Plastic。
请记住,您始终可以使用 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 上,因为我还没有运行更新。默认情况下,工作区配置为使用 main 分支。
我可以通过运行 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)由于我没有指定起点,因此新分支直接从父分支上的最新变更集开始,在我的示例中是 main 分支的变更集 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.csstatus 不仅显示工作区配置(如我之前所示),还显示已更改、已签出、已移动、已删除的文件等。
现在我要将 FileSystem-renamed.cs
移动到一个新位置:
然后,我运行 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 来包含私有文件。
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) 限制到特定的更改类型。我通过筛选条件选项来做到这一点:
假设我有一些与上面相同的更改,但这次我添加和删除了几个文件:
>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 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 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 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 命令:
在 Plastic SCM 中,可以简单地更改文件,也可以签出文件。因此,您可以遵循两个工作流程:编辑-签入或签出-编辑-签入。
签出某个文件相当于告诉 Plastic“嘿,我要修改文件了”,所以 Plastic 就会将文件添加到一个内部签出文件列表中。
使用签出操作通常有 3 个主要原因:
“签出-编辑-签入”工作流程非常简单:只需在编辑任何文件之前运行 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
不是“locally moved”而只是“moved”。
我可以按如下方式签入两个已签出的文件:
>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
文件仍然是待定更改:
从 CLI 进行合并非常容易,只需运行 cm merge 命令即可。
到目前为止,我都是在 main/fix-1342 分支中进行的所有更改,现在我将切换到 main 以合并我的更改。此时我的情况如下:
我将切换到 main:
>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
...我会先撤销更改,然后再尝试切换:
switch 命令会更新我的工作区,将我在分支上更改的所有文件替换为 main 中的版本。
现在我的状态如下:
>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 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
现在需要三向合并,因为该文件已被两个参与者修改。
现在我将运行合并,将 --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
可以看到,这会将所有合并应用到工作区,并启动您配置的三向合并工具(默认情况下是 Plastic 的 Xmerge)来解决 FileSystem.cs
中的冲突。请注意 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
:
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.esPlastic 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 的行为可能不符合您的预期,因此您会希望与我们出色的支持团队联系。为了帮助支持团队诊断您的问题,您可以向他们发送一个包含有用诊断信息的 zip 文件,为此,您可以使用 cm support 命令生成该文件,如下所示。
>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 loadedPlastic CLI 经常被忽视的一个功能是它可以使用 - 选项从 stdin 逐个读取参数,如下所示:
>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 中。
以下命令接受带管道的路径:
让我们来看一些示例!
现在您可以顺利使用管道和 cm 来构建很酷的脚本!