Plastic SCM: show the current changeset abstract (without files) on the commandline
Posted by jpluimers on 2021/04/14
I could not find a syntax for “current changeset”, but since cm log
accepts the output of cm status
as changeset identifier:
for /F "tokens=*" %l in ('call cm status --nochanges') do (call cm log %l --itemformat )
Or in batch file form:
for /F "tokens=*" %%l in ('call cm status --nochanges') do (call cm log %%l --itemformat )
Two important parts of the trick that ensure each command only outputs what is needed:
- The empty
--itemformat
specification forcm log
indicates that no details about files should be logged.Without it,cm log
will list both the changeset information and information about each item in the changeset. - The other trick is
--nochanges
forcm status
: it only shows the status line, and no other changes.Without it,cm status
will emit one line per changed file.
–jeroen
cm log --help
Get info of revs in changesets. Usage: cm log [csetspec | repspec] [--from=csetspec_from] [--allbranches] [--ancestors] [--csformat=str_format] [--itemformat=str_format] [--xml[=output_file]] [--encoding=name] [--repositorypaths | --fullpaths] Options: csetspec The command will return every change made in the changeset which specification is provided. Changeset specification: check 'cm help objectspec'. repspec The command will list all changes made in the specified repository. Repository specification: check 'cm help objectspec'. --from Lists all the changes made in every changeset from the changeset specification [csetspec_from] to the changeset specification [csetspec]. The [csetspec_from] changeset is not included in the output. Ignored when a repository spec is provided. --allbranches Shows information about the changesets created in a specified interval, for all the branches where those changesets were created. --ancestors Shows information about the reachable changesets by following the parent and merge links for the given changeset ([csetspec]). If the from changeset ([csetspec_from]) is provided too, it will be used as lower limit for all the paths. Remarks: The changeset changes will not be shown when this option is used. --csformat Retrieves the changeset info in a specific format. See remarks for more info. --itemformat Retrieves the item info in a specific format. See remarks for more info. --xml Prints the output in XML format to the standard output. It is possible to specify an output file. --fullpaths, --fp Force printing full workspace paths for files and directories when possible. --repositorypaths Prints repository paths (server paths) instead of workspace paths. (This option overrides "--fullpaths" option). --encoding Used with the --xml option, specifies the encoding to use in the XML output, i.e.: utf-8. See the MSDN documentation at http://msdn.microsoft.com/en-us/library/system.text.encoding.aspx to get the table of supported encodings and its format, (at the end of the page, in the "Name" column). Remarks: - If neither [csetspec] nor option is specified, the command will show information about every changeset created within the last month in every branch. - If only the option --from is included, the command will show the information about every changeset from that specified changeset to the last changeset, in the branch where the changeset was created. - If the option --allbranches appears without an interval, the command will retrieve the same information as it would do if only [csetspec] was specified. - If the --from is used, the output will contain information from the [csetspec_from]+1 on. - The repository used to show the changeset information is the one loaded in the path where the command is executed. This command accepts a format string for the items (--itemformat) and a format string for the changesets (--csformat). The output parameters of --csformat are the following: {tab} Inserts a tab space. {newline} Inserts a new line. {changesetid} Changeset number. {branch} Branch where the changeset was created. {date} Date of the changeset. {owner} Owner of the changeset. {comment} Comment of the changeset. {items} Items involved in the changeset. {repository} Repository where the changeset exists. {repserver} Server name. The output parameters of --itemformat are the following: {tab} Inserts a tab space. {newline} Inserts a new line. {path} Item path. {branch} Branch where the changeset was created. {date} Date of the changeset. {owner} Owner of the changeset. {shortstatus} Prints the short format. See below. {fullstatus} Prints the long format. See below. Short format and its corresponding long format: A Added D Deleted M Moved C Changed These are valid output strings: --csFormat="{newline}Changeset {changesetid} created on {date};{tab} changed items: {items}." --itemFormat="{newline}The item {path} was changed in the branch {branch}." Examples: cm log (Shows information about every changeset created in the last month in every branch.) cm log cs:16 (Shows information about the changes done in the changeset 16 in the branch where the changeset was created.) cm log cs:16 --csFormat="{newline}Changeset {changesetid} created on {date};{tab} changed items: {items}." (Shows the information in the specified format.) cm log --from=cs:20 cs:50 (Shows the information about every revision contained in every changeset from the changeset 21 to the changeset 50 in br:/main.) cm log --from=cs:20 cs:50 --allbranches (Shows the information about every revision contained in every changeset from the changeset 21 to the changeset 50 in every branch of the repository.) cm log rep:myrep@localhost:8084 (Shows information about the changes done in the specified repository. No workspace is required to run the command.) cm log --from=cs:20@rep:mainRep@localhost:8084 (Shows the information about every revision contained in every changeset from the changeset 21. No workspace is required to run the command, because the full changeset spec was specified.)
cm status --help
Show changes in the workspace. Usage: cm status [wk_path] [--changelist=name | --changelists] [--cutignored] [--nochanges] [--noheaders] [--nomergesinfo] [--nostatus] [--selector] [--short] [--symlink] [--wkconfig] [--dirwithchanges] [--xml[=output_file]] [--encoding=name] [--wrp] [--fullpaths | --fp] [search_types] Options: wk_path Path of the workspace where the search will be performed. --changelist Shows changes in the selected changelist. --changelists Shows changes grouped in client changelists. --cutignored Skips the contents of ignored directories. Requires the --ignored search type. --nochanges Only prints the loaded changeset. --noheaders The changes group information will not be printed. --nomergesinfo The merge info for changes is not printed. --nostatus Only prints the modified item search result. --selector Prints the changeset on the repository that should be loaded. The modified item search will be omitted. --short Lists only paths that contains changes. --symlink Applies the operation to the symlink and not to the target. --wkconfig Prints the workspace configuration (current branch, label or changeset where the workspace points to). --dirwithchanges Shows directories that contain changes inside them (added, moved, removed items inside). --xml Prints the output in XML format to the standard output. It is possible to specify an output file. --encoding Used with the --xml option, specifies the encoding to use in the XML output, i.e.: utf-8. See the MSDN documentation at http://msdn.microsoft.com/en-us/library/system.text.encoding.aspx to get the table of supported encodings and its format, (at the end of the page, in the "Name" column). --wrp Print workspace root relative paths instead of current directory relative paths.("--wkrootrelativepaths" flag does the same). --fullpaths, --fp Force printing absolute paths, overriding any other path printing setting. Search types: --added Prints added items. --checkout Prints checkedout items. --changed Prints changed items. --copied Prints copied items. --replaced Prints replaced items. --deleted Prints deleted items. --localdeleted Prints locally deleted items. --moved Prints moved items. --localmoved Prints locally moved items. --percentofsimilarity=value Percent of similarity between two files in order to consider them the same item. Used in the locally moved search. Its default value is 20%. --txtsameext Only those text files that have the same extension will be taken into account by the similarity content matching process during the moved items search. By default any text file will be processed. --binanyext Any binary file will be taken into account by the similarity content matching process during the moved items search. By default only those binary files that have the same extension will be processed. --private Prints non controlled items. --ignored Prints ignored items. --hiddenchanged Prints hidden changed items. (Includes '--changed') --controlledchanged This modifier substitutes the following options: '--added' '--checkout' '--copied' '--replaced' '--deleted' '--moved'. --all This modifier substitutes the following parameters: '--controlledchanged' '--changed' '--localdeleted' '--localmoved' '--private'. Remarks: The status command prints the loaded changeset on a workspace and gets the changed elements inside the workspace. This command can be used to show the pending changes in a workspace; the type of changes that can be searched can be modified by using the command parameters. The default option is '--controlledchanged'; this option will print controlled items that are changed. The percent of similarity parameter '--percentofsimilarity' (-p) is used by the locally moved search to decide if two elements are the same item. The default value is 20% but it can be adjusted. It is possible to show workspace changes grouped by client changelists. The 'default' changelist includes the changes that are not included in other changelists. That being said, the changes the default changelist will show depends on the search types flags specified. Showing changes grouped by changelists requires showing controlled changes too (items with status = 'added', 'checkout', 'copied', 'replaced', 'deleted' or 'moved'). So, the '--controlledchanged' option will be automatically enabled when changelists are shown. The default encoding for XML output is utf-8. By default, this command will print current directory relative paths, unless the '--machinereadable' or '--short' flags are specified. If any of them are specified, the command will print absolute paths. If '--xml' flag is specified, workspace root relative paths will be printed (unless the '--fp' flag is also specified, printing absolute paths instead). Examples: cm status (The command will print the working changeset and also the items that are checkedout, added, copied, replaced, deleted and moved.) cm status --all (The command will print all item types changed in the workspace but not the ignored ones.) cm status --added (The command will only print the working changeset and the added items inside the workspace.) cm status c:\workspaceLocation\code\client --added (The command will only print the working changeset and the added items under the path specified recursively.) cm status --changelists --all cm status --changelist --all (The command will show all the workspace changes grouped by client changelists.) cm status --changelist=pending_to_review (The command will show the changes on the changelist named 'pending_to_review'.) cm status --changelist=default --private (The command will show the changes in the 'default' changelist, showing private items, along with items with controlled changes, if any.) cm status --short --changelist=pending_to_review | cm checkin - (The command will check-in the changes in the changelist 'pending_to_review'.) cm status C:\workspaceLocation --xml=output.xml (Gets the status information in XML format and using utf-8 in the file output.xml.) cm status --ignored (This command will show all ignored items) Output: IG src IG src/version.c IG out/app.exe cm status --ignored --cutignored (This command will show ignored files whose parent directory is not ignored and ignored directories -but not their contents) Output: IG src IG out/app.exe
Leave a Reply