Documentation

Support

Unity Version Control

Pipe commands

Use the pipe command in the Unity Version Control CLI for advanced scripting.
Read time 1 minuteLast updated 2 months ago

The UVCS command line can read arguments from standard input (stdin) one by one if you use the
-
option.
For example, you can add three files at the same time:
>cm add -a.txtb.txtc.txtThe selected items are about to be added. Please wait ...Item c:\Users\pablo\wkspaces\mcga\a.txt was correctly addedItem c:\Users\pablo\wkspaces\mcga\b.txt was correctly addedItem c:\Users\pablo\wkspaces\mcga\c.txt was correctly added
This allows you to pipe output from other commands into
cm
. For example, you can combine commands to create automations such as to add all files under a specific directory tree:
find /path/to/dir | cm add -

Commands that accept piped paths

The following commands accept piped paths:
  • add
  • applylocalchanges
  • checkin
  • checkout
  • getstatus
  • partialcheckin
  • remove
  • shelveset create
  • undocheckout
  • undochange
  • uncounchanged
  • Wktreenodestatus

Pipe examples

Pipe from the Windows
dir
command

The following example pipes from the Windows
dir
command to remove files that match a specific pattern from a workspace:
>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 files recursively into piped directory arguments

Directory of c:/mcga/pipe11/05/2020 19:48 <DIR> .11/05/2020 19:48 <DIR> ..11/05/2020 17:57 <DIR> dir11/05/2020 19:46 <DIR> dir211/05/2020 19:47 12 dirlist1 File(s) 12 bytes4 Dir(s) 23,714,631,680 bytes freec:/mcga/pipe>type dirlistdirdir2c:/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 outItem c:/mcga/pipe/dir/file was correctly checked outItem c:/mcga/pipe/dir2 was correctly checked outItem c:/mcga/pipe/dir2/file2 was correctly checked out