The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,100 other followers

PlasticSCM console

Posted by jpluimers on 2019/08/09

The cm.exe by default is not on the path, even though it is a useful tool.

Some links on it:

Slow

One drawback: the cm.exe is slow in startup, likely because it is a .NET executable needing quite a few assemblies to load:

"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.1 Tools\CorFlags.exe" "C:\Program Files\PlasticSCM5\client\cm.exe"
Microsoft (R) .NET Framework CorFlags Conversion Tool. Version 4.7.2558.0
Copyright (c) Microsoft Corporation. All rights reserved.

Version : v4.0.30319
CLR Header: 2.5
PE : PE32
CorFlags : 0x1
ILONLY : 1
32BITREQ : 0
32BITPREF : 0
Signed : 0

Finding stuff

I get a feeling that there is quite a bit of cm functionality either undocumented, or hardly documented.

For instance, copying a title from the PlasticSCM GUI does not mean it will work as a cm command.

Despite the documentation indicating

When you run queries using comparison operators (>, <, >=, <=) from the command line, remember that the shell considers these operators as IO redirections, so you will need to enclose the queries with quotation marks:
cm find "branches where owner='pablo' and changesets >= '2013/03/01'"

you have to be really careful where to put the starting double quote: it has to be after the find command:

  1. Example 1
    • Title
      User query: find changeset where branch='/main/test/My Branch Name' on repository 'Projects@ssl://plastic.example.org:8088' (22 Items - 0 selected)
    • Failure
      "C:\Program Files\PlasticSCM5\client\cm.exe" "find changeset where branch='/main/test/My Branch Name' on repository 'Projects@ssl://plastic.example.org:8088'"
      Command 'find changeset where branch='/main/test/My Branch Name' on repository 'Projects@ssl://plastic.example.org:8088'' not found. Type cm showcommands to get a command list.
    • Success
      "C:\Program Files\PlasticSCM5\client\cm.exe" find "changeset where branch='/main/test/My Branch Name' on repository 'Projects@ssl://plastic.example.org:8088'"
  2. Example 2
    • Title
      Changesets /main/test/My Branch Name@Projects@ssl://plastic.example.org:8088 (4 Items - 1 selected)
    • Failure
      "C:\Program Files\PlasticSCM5\client\cm.exe" find "Changesets /main/test/My Branch Name@Projects@ssl://plastic.example.org:8088"
      Error: unexpected char: '@'
    • Success
      "C:\Program Files\PlasticSCM5\client\cm.exe" find "Changesets where branch='/main/test/My Branch Name' on repository 'Projects@ssl://plastic.example.org:8088'"

This means that changeset can be Changesets: it is case insensitive and has multiple aliases. It looks similar to commands I used in my days of using Rational ClearCase – Wikipedia

I need to find out how to translate a non-query title into a query one. That will make it a lot easier to go from PlasticSCM GUI to the cm.

No XML documentation

The cm find command has a cool parameter --xml, which dumps the output in an XML tree.

My original goal was to see if I could turn the XML into something like Markdown or RST, using an XSLT transform like these:

For those transforms, you have to know how the input XML is structured. However, this information is undocumented.

When asked, PlasticSCM indicated there is no XSD for it claiming it was “super simple export to XML”:

[WayBack] Plastic SCM on Twitter: “No XSD, I’m afraid. Just super simple export to XML.… “

https://twitter.com/plasticscm/status/1039842761304940544

I hoped the elements were just uppercase versions of the output below, but they are not. Bummer.

–jeroen

Available objects and attributes:
ATTRIBUTE
Comment
Date
GUID
ID
Owner
SrcObj
Type
Value
ATTRIBUTETYPE
Comment
Date
GUID
ID
Name
Owner
ReplLogId
ReplSrcDate
ReplSrcId
ReplSrcRepository
ReplSrcServer
Source
Value
BRANCH
Attribute
AttrValue
Changesets
Comment
Date
GUID
ID
Item
Name
Owner
Parent
ReplLogId
ReplSrcDate
ReplSrcId
ReplSrcRepository
ReplSrcServer
CHANGESET
Attribute
AttrValue
Branch
ChangesetId
Comment
Date
GUID
ID
OnlyWithRevisions
Owner
Parent
ReplLogId
ReplSrcDate
ReplSrcId
ReplSrcRepository
ReplSrcServer
ReturnParent
LINK
Comment
Date
DstObj
GUID
ID
Owner
SrcObj
Type
LINKTYPE
Comment
Date
Destination
GUID
ID
Name
Owner
Source
MARKER
Attribute
AttrValue
Branch
Branchid
Changeset
Comment
Date
GUID
ID
Name
Owner
ReplLogId
ReplSrcDate
ReplSrcId
ReplSrcRepository
ReplSrcServer
MERGE
Date
DstBranch
DstChangeset
GUID
ID
Owner
SrcBranch
SrcChangeset
Type
MOVED
Comment
Date
DstBranch
DstChangeset
DstDirRev
Item
ItemId
Owner
SrcBranch
SrcChangeset
SrcDirRev
REMOVED
Branch
Changeset
Comment
Date
DirRev
Item
ItemId
Owner
REPLICATIONLOG
Branch
Date
ID
Owner
Package
RepositoryName
Server
REPLICATIONSOURCE
ID
RepositoryName
Server
REVIEW
Assignee
Comment
Date
GUID
Id
Owner
Status
Target
TargetId
TargetType
Title
REVIEWCOMMENT
Comment
Date
GUID
Id
Location
Owner
Review
ReviewId
RevisionId
REVISION
Archived
Attribute
AttrValue
Branch
Changeset
Comment
Date
GUID
ID
Item
ItemId
Owner
Parent
ReplLogId
ReplSrcDate
ReplSrcId
ReplSrcRepository
ReplSrcServer
ReturnParent
Shelve
Size
Type
WorkspaceCheckoutId
SECUREDPATH
Date
ID
Owner
Path
Tag
SHELVE
Attribute
AttrValue
Comment
Date
GUID
ID
Owner
Parent
ReplLogId
ReplSrcDate
ReplSrcId
ReplSrcRepository
ReplSrcServer
ShelveId
USER
Active
Code
Group
Name

:: since there is no XSD as per https://twitter.com/jpluimers/status/1039836990668197888
:: try to dump the manual way so we get a feel for the data that is part of our PlasticSCM repositories
if "%1"=="" goto :list
call cm find %1 –xml > %1.xml
goto :eof
:list
call %0 ATTRIBUTE
call %0 ATTRIBUTETYPE
call %0 BRANCH
call %0 CHANGESET
call %0 LINK
call %0 LINKTYPE
call %0 MARKER
call %0 MERGE
call %0 MOVED
call %0 REMOVED
call %0 REPLICATIONLOG
call %0 REPLICATIONSOURCE
call %0 REVIEW
call %0 REVIEWCOMMENT
call %0 REVISION
call %0 SECUREDPATH
call %0 SHELVE
call %0 USER

view raw
dump cm find xml.bat
hosted with ❤ by GitHub

One problem is that batch file does not return results when there are none available in a repository.

Another problem is that the XML elements do not map from the above list; for instance

  • ATTRIBUTETYPE results in an element ATTRIBUTEENTITY
  • MOVED results in an element MOVEREALIZATION
  • REMOVED results in an element REMOVEDREALIZATION

This means the PlasticSCM code base is not consistent in their POCO and mappings.

One route to get the POCO and mapping could be the https://reflector.net, but that is time consuming.

view raw
dump-results.md
hosted with ❤ by GitHub

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

 
%d bloggers like this: