(2) Should I implement my own SCMHeadCategory to for my P4Head (extends SCMHead)? If I need different types (e.g. 'Branches', 'Pull Requests') I need new implementations of SCMHead and a corresponding SCMHeadCategory?
What do the docs say: https://github.com/jenkinsci/scm-api-plugin/blob/master/docs/implementation.adoc Hint: I believe the docs are very explicit on that subject. There is, to my mind, an unambiguous answer directly to your question (somewhere in the middle third of the docs) Each jenkins.scm.api.SCMSourceDescriptor should provide the concrete instances of the jenkins.scm.api.SCMHeadCategory that are potentially generated by their jenkins.scm.api.SCMSource instances. Then each jenkins.scm.api.SCMSource instance can filter down that list to the actual categories that may be returned by that specific source. For example, a GitHub source may return "Branches", "Pull Requests" and "Tags" but the user may have configured their specific source for a specific project to only build "Branches" and "Tags". I really am looking for people to find faults in the docs. If I keep giving people answers then I become the scalability issue. I would much rather that people can solve the problems by reading documentation. That means that my efforts deliver a multiple rather than everything being rate limited by my time and availability. By using the docs and suggesting improvements we make the whole community better. ;-) Before I posted I had read the implementation doc, it covers a lot and not easy to dip into. A few more sections and headers would help out ;-) It would be nice to add anchor markers when sending out links in emails. The example for Accurev shows you reusing UncategorisedSCMSourceCategory and calling it 'Streams' and using TagSCMHeadCategory and calling it 'Snapshots'. protected SCMHeadCategory[] createCategories() { return new SCMSourceCategory[]{ new UncategorizedSCMSourceCategory( new NonLocalizable("Streams") // Better: Messages._AccurevSCMSource_StreamHeadCategory() ), new TagSCMHeadCategory( new NonLocalizable("Snapshots") // Better: Messages._AccurevSCMSource_SnapshotHeadCategory() ) }; } The Descriptor adds these to the createCategories, but doesn't say how they get referenced. BTW: UncategorizedSCMHeadCategory.INSTANCE should be DEFAULT protected SCMHeadCategory[] createCategories() { return new SCMHeadCategory[]{ UncategorizedSCMHeadCategory.INSTANCE, ChangeRequestSCMHeadCategory.DEFAULT, TagSCMHeadCategory.DEFAULT }; The Tip's box starting 'Both tags and regular branches can normally use...' (somewhere near the middle) is very hard to read as the text is cropped and you have to scroll sideways to read it (viewed in Chrome on OS X). The example inside this tip box using 'implements ChangeRequestSCMHead2' hints that Change requests are managed differently; and this has confused me further? So does each SCMSource have to override createCategories() in its own implementation of SCMSourceDescriptor? but how does it link to the SCMRevsion when retrieve adds them to observe? I'm clearly missing something and I can't find a working example? Is this implemented anywhere for real? I can't see it in the git, github and accurev plugins. Sorry if I don't get it, I only posted as I could not get my head around the docs. -------------------------------------------------------------------------------- Perforce Software UK Ltd is registered in England and Wales as company no. 3816019 at the following address: West Forest Gate, Wellington Road, Wokingham, RG40 2AT, UK -------------------------------------------------------------------------------- -- You received this message because you are subscribed to the Google Groups "Jenkins Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/B86AE584-8232-494B-A301-408058D85EF4%40perforce.com. For more options, visit https://groups.google.com/d/optout.
