Jump to content
nqramjets

cm find with multiple attributes

Recommended Posts

In order to maintain state in Plastic I'm attempting to use multiple attributes; It's easy enough to apply multiple attributes to a single branch, but I can't seem to get a find command to work. Unless I'm missing something there is no obvious way to get a cm find where clause to feature more than one attribute/attrvalue combination.

 

In my case I have a branch with the following two attributes and values:

Status = 'Deprecated'

TestFlag = 'TRUE'

 

This is only thing that seems reasonable to try, but does not work (not surprised really because there is only a single, unqualified "attrvalue")

 

>cm find branches where attribute = 'Status' and attrvalue = 'Deprecated' and attribute = 'TestFlag' and attrvalue = 'TRUE'

>Total: 0

 

Obviously I can test for one attribute individually and it works just fine.

>cm find branches where attribute = 'TestFlag' and attrvalue = 'TRUE'

>Total: 1

 

>cm find branches where attribute = 'Status' and attrvalue = 'Deprecated'

>Total: 1

 

Isn't this a common thing? Is this not possible?

 

Furthermore, I would really like this for use in the branch inclusion/exclusion/format rules!

 

Thanks,

Ryan

Share this post


Link to post
Share on other sites

Hi @nqramjets! (OMG so sorry about the 4 years delay!) Hi @omris! (and welcome)

My attributes:

>cm find attributes
objid:6@repid:490@repserver:localhost:8087 -- git-repo-sync --> 1ead4e7c-2305-411e-a36a-08283ad7eb50|Test1@catacroquer@cloud|https://github.com/PlasticSCM/plastic-cmdrunner.git
objid:4@repid:490@repserver:localhost:8087 -- BUILD --> OK
objid:4@repid:490@repserver:localhost:8087 -- STAGE --> B
objid:496@repid:490@repserver:localhost:8087 -- BUILD --> NOK
objid:496@repid:490@repserver:localhost:8087 -- STAGE --> B

Total: 5

Combined query example #1:

>cm find "branch where (attribute='BUILD' and attrvalue='OK') and (attribute='STAGE' and attrvalue='B')" --nototal
4        11/07/2013 12:42:36 /main    manu     LocalBoatGameTest1 T

Combined query example #2:

>cm find "branch where (attribute='BUILD' and attrvalue='NOK') and (attribute='STAGE' and attrvalue='B')" --nototal
496      23/11/2018 10:37:49 /main/task002 manu     LocalBoatGameTest1 T

Hope it helps!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×