Jump to content

Use of wildcards with cm find command


deanaug

Recommended Posts

Is it possible to use wildcards for the conditions specified in a cm find command?

For example, given the following set of defined labels

CSC1_0.0.1

CSC1_0.0.2

CSC1_0.0.3

CSC2_0.0.1

CSC2_0.0.2

I'd like to query just for the labels that start with CSC1 (first 3 labels above). I thought (hoped) the following command would work:

cm find label where name='CSC1*'

But this gives me a Query error: unexpected token: ["",<1>,line=1,col=17] from the CLI and empty results from the GUI.

Thanks!!

Link to comment
Share on other sites

Works great Pablo, thank you for your help as usual!! =d>

Looks like the % wildcard character works for either single or multiple character matches.

Using the example you gave me, cm find label where name like 'CSC1%, correctly produced:

CSC1_0.0.1

CSC1_0.0.2

CSC1_0.0.3

(all matches starting with CSC1 and multiple trailing characters)

I also tried something a little different, cm find label where name like 'CSC%0.0.2', which correctly produced:

CSC1_0.0.2

CSC2_0.0.2

(matches now on single character after CSC portion)

I couldn't find any info in the online 3.0 docs for this. Section 6.5.3 Advanced Reporting with Queries in the user manual has some SCM-level query examples using cm find, but none showed use of wildcard-type queries.

(Side note: same types of queries work in the GUI as well, just omit the initial cm part of the command)

Thanks again!!!

Link to comment
Share on other sites

Hi deanaug,

Thanks for your kind words :)

Yes, you know, we're better producing software than documenting it... The "cm find" command is an extension of natural SQL, so the % will work on most backends (same with the 'like' keyword).

I'll file a request to get the wildcards documented! :)

Thanks,

pablo

Link to comment
Share on other sites

  • 8 months later...

In Plastic 3.0 branch explorer, I tried to add the following conditional format branch filter:

name like 'scm%'

We are using Plastic-JIRA integration, with branch prefix scm (default) to designate JIRA issue branches. So we have branch names of the form /main/scmxx (xx is of course the corresponding JIRA issue number). I wanted to highlight those in some pretty color so they are easy to spot. When I try to apply the abover filter I do not get the colorcoding for those branches. Note that I tried the cm find query on the command line and it listed all the matching branches as expected:

cm find branch where name like 'scm%'

Thanks!!!

Dean

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...