Doeth... slightly better

for (AbstractProject project:
Jenkins.getInstance().getAllItems(AbstractProject.class)) {
    if (item.getSCM() instanceof MercurialSCM) {
      MercurialSCM hg = (MercurialSCM)item.getSCM()
      if (repo.matcher().matches(hg.getSource()))
        result.add(project);
    }
}


On 31 May 2013 12:41, Stephen Connolly <[email protected]>wrote:

> Pattern repo = ...;
> List<AbstractProject<?,?>> result = new ArrayList<AbstractProject<?,?>>();
>
> for (Item item: Jenkins.getInstance().getAllItems()) {
>   if (item instanceof AbstractProject) {
>     AbstractProject<?,?> project = (AbstractProject)item;
>     if (item.getSCM() instanceof MercurialSCM) {
>       MercurialSCM hg = (MercurialSCM)item.getSCM()
>       if (repo.matcher().matches(hg.getSource()))
>         result.add(project);
>     }
>   }
> }
>
>
> On 31 May 2013 11:47, Dirk Heinrichs <[email protected]> wrote:
>
>>  Hi,****
>>
>> ** **
>>
>> is it possible to (programmatically) find out which projects use a given
>> (Mercurial) repository? If so, how?****
>>
>> ** **
>>
>> Thanks...****
>>
>> ** **
>>
>>                 Dirk****
>>
>> ** **
>>
>> [image: cid:[email protected]]****
>>
>> *Dirk Heinrichs*, Senior Systems Engineer, Infrastructure****
>>
>> Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach****
>>
>> *Tel:* +49 2226 1596666 1149****
>>
>> *Email:* [email protected]****
>>
>> *Skype:* dirk.heinrichs.recommind****
>>
>> *www.recommind.com* <http://www.recommind.com/>****
>>
>> ** **
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Jenkins Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


<<image001.gif>>

Reply via email to