Jump to content


Extracting CL which matches certain description

perforce api p4java groovy p4api

  • Please log in to reply
No replies to this topic

#1 sravs

sravs

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 08 March 2018 - 08:33 PM

I am trying to extract a list of CL in a depot that matches a certain description and i dont have a success. below is my code and the error i get
/* ALL MY IMPORTS */
/* MY PERFORCE AND HTTP modules using grapes */

  /* SERVER LOGIN CONDITIONS */
List<IFileSpec> fileList = server.getDepotFiles(FileSpecBuilder.makeFileSpecList("//depot/release/prod/..."), false)
List<IChangelistSummary> changelistList = server.getChangelists(fileList,null)
def clList = [:]
def discl = []
if (changelistList != null) {
changelistList.each { IChangelistSummary cl ->
if (cl.getId() != null) {
println cl.getId()
IChangelist cld = server.getChangelist(cl.getId())
   println cld.getDescription()

if(!(discl.contains(cl.getId())) && !(cl.getDescription().startsWith("Build with EF")) && !(cl.getUsername().matches("mb_ccatt")) ){
  discl << cl.getId
clList
.put(cl.getId(),cl.getUsername())
  }
   }
}
}
   clList.each{ key,value ->
   println "\t$key: $value"
}
server.disconnect()
Below is the log, as you see till certain extent all the print statments look good, and suddenly it throws a exception
com.perforce.p4java.impl.generic.core.User@55322aab
Which i dont understand where from it is getting User index?
192359
Prod Copy Up using p4 copy from Dev-XXX to ZZZZ-Release using newly created label Dev-XXX.CCversion-XXX.20180212_103004.ICM730.COPY_UP_depot_mode

194118
Merging from ZZZZ-Release PARENT CL 194248   Yadav __ Description: 1802_UAT_Defect1234_Change

  com
.perforce.p4java.impl.generic.core.User@55322aab
  Caught: groovy.lang.MissingPropertyException: No such property: getId for
  class: com.perforce.p4java.impl.generic.core.ChangelistSummary
  groovy.lang.MissingPropertyException: No such property: getId for class:
  com.perforce.p4java.impl.generic.core.ChangelistSummary
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53)
at org.codehaus.groovy.runtime.callsite.GetEffectivePojoPropertySite.getProperty(GetEffectivePojoPropertySite.java:66)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:296)
at cllist_new$_run_closure1.doCall(cllist_new.groovy:34)
at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.
.java:1022)
        at groovy.lang.Closure.call(Closure.java:414)
        at groovy.lang.Closure.call(Closure.java:430)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2040)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2025)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2066)
        at org.codehaus.groovy.runtime.dgm$163.invoke(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
        at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
        at cllist_new.run(cllist_new.groovy:27)
        at groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:263)
        at groovy.lang.GroovyShell.run(GroovyShell.java:518)
        at groovy.lang.GroovyShell.run(GroovyShell.java:507)
        at groovy.ui.GroovyMain.processOnce(GroovyMain.java:653)
        at groovy.ui.GroovyMain.run(GroovyMain.java:384)
        at groovy.ui.GroovyMain.process(GroovyMain.java:370)
        at groovy.ui.GroovyMain.processArgs(GroovyMain.java:129)
        at groovy.ui.GroovyMain.main(GroovyMain.java:109)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:109)
        at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:131)





Also tagged with one or more of these keywords: perforce, api, p4java, groovy, p4api

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users