{"action":"created","comment":{"url":"https://api.github.com/repos/jenkinsci/git-plugin/pulls/comments/114745048","pull_request_review_id":36236102,"id":114745048,"diff_hunk":"@@ -507,23 +699,76 @@ protected StandardUsernameCredentials getCredentials() {\n                                 GitClient.CREDENTIALS_MATCHER));\n     }\n \n-    protected abstract List<RefSpec> getRefSpecs();\n+    /**\n+     * @return the ref specs.\n+     * @deprecated use {@link RefSpecsSCMSourceTrait}\n+     */\n+    @Deprecated\n+    @Restricted(NoExternalUse.class)\n+    @RestrictedSince(\"3.4.0\")\n+    protected List<RefSpec> getRefSpecs() {\n+        return Collections.emptyList();\n+    }\n+\n+    /**\n+     * Instantiates a new {@link GitSCMBuilder}.\n+     * Subclasses should override this method if they want to use a custom {@link GitSCMBuilder} or if they need\n+     * to pre-decorare the builder.\n+     *\n+     * @param head     the {@link SCMHead}.\n+     * @param revision the {@link SCMRevision}.\n+     * @return the {@link GitSCMBuilder}\n+     * @see #decorate(GitSCMBuilder) for post-decoration.\n+     */\n+    protected GitSCMBuilder<?> newBuilder(@NonNull SCMHead head, @CheckForNull SCMRevision revision) {\n+        return new GitSCMBuilder<>(head, revision, getRemote(), getCredentialsId());\n+    }\n+\n+    /**\n+     * Performs final decoration of the {@link GitSCMBuilder}. This method is called by\n+     * {@link #build(SCMHead, SCMRevision)} immediately prior to returning {@link GitSCMBuilder#build()}.\n+     * Subclasses should override this method if they need to overrule builder behaviours defined by traits.\n+     *\n+     * @param builder the builder to decorate.\n+     */\n+    protected void decorate(GitSCMBuilder<?> builder) {\n+    }\n \n+    /**\n+     * {@inheritDoc}\n+     */\n     @NonNull\n     @Override\n     public SCM build(@NonNull SCMHead head, @CheckForNull SCMRevision revision) {\n-        List<GitSCMExtension> extensions = new ArrayList<GitSCMExtension>(getExtensions());\n-        if (revision instanceof SCMRevisionImpl) {\n-            extensions.add(new BuildChooserSetting(new SpecificRevisionBuildChooser((SCMRevisionImpl) revision)));\n+        GitSCMBuilder<?> builder = newBuilder(head, revision);\n+        if (Util.isOverridden(AbstractGitSCMSource.class, getClass(), \"getExtensions\")) {","path":"src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java","position":850,"original_position":850,"commit_id":"9399e865de0afb9d6b16ad70d4378bd25389fc10","original_commit_id":"9399e865de0afb9d6b16ad70d4378bd25389fc10","user":{"login":"stephenc","id":209336,"avatar_url":"https://avatars1.githubusercontent.com/u/209336?v=3","gravatar_id":"","url":"https://api.github.com/users/stephenc","html_url":"https://github.com/stephenc","followers_url":"https://api.github.com/users/stephenc/followers","following_url":"https://api.github.com/users/stephenc/following{/other_user}","gists_url":"https://api.github.com/users/stephenc/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenc/subscriptions","organizations_url":"https://api.github.com/users/stephenc/orgs","repos_url":"https://api.github.com/users/stephenc/repos","events_url":"https://api.github.com/users/stephenc/events{/privacy}","received_events_url":"https://api.github.com/users/stephenc/received_events","type":"User","site_admin":false},"body":"@rsandell This method is the one that needs great care and attention as we discussed previously.\r\n\r\nThe assumption is that any new subclasses cannot override these methods as they are `@Restricted` thus there are either no traits (because old implementations cannot have overridden `getTraits()`) or there are only traits...\r\n\r\nHence these methods just apply the *equivalent* decoration to the builder to result in the same behaviour as before...\r\n\r\nNow I have convinced myself of the equivalence, but I really need you to probe my self-convictions ;-)","created_at":"2017-05-04T10:47:01Z","updated_at":"2017-05-04T10:47:01Z","html_url":"https://github.com/jenkinsci/git-plugin/pull/494#discussion_r114745048","pull_request_url":"https://api.github.com/repos/jenkinsci/git-plugin/pulls/494","_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/git-plugin/pulls/comments/114745048"},"html":{"href":"https://github.com/jenkinsci/git-plugin/pull/494#discussion_r114745048"},"pull_request":{"href":"https://api.github.com/repos/jenkinsci/git-plugin/pulls/494"}}},"pull_request":{"url":"https://api.github.com/repos/jenkinsci/git-plugin/pulls/494","id":118943928,"html_url":"https://github.com/jenkinsci/git-plugin/pull/494","diff_url":"https://github.com/jenkinsci/git-plugin/pull/494.diff","patch_url":"https://github.com/jenkinsci/git-plugin/pull/494.patch","issue_url":"https://api.github.com/repos/jenkinsci/git-plugin/issues/494","number":494,"state":"open","locked":false,"title":"[JENKINS-43507] Allow SCMSource and SCMNavigator subtypes to share common traits","user":{"login":"stephenc","id":209336,"avatar_url":"https://avatars1.githubusercontent.com/u/209336?v=3","gravatar_id":"","url":"https://api.github.com/users/stephenc","html_url":"https://github.com/stephenc","followers_url":"https://api.github.com/users/stephenc/followers","following_url":"https://api.github.com/users/stephenc/following{/other_user}","gists_url":"https://api.github.com/users/stephenc/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenc/subscriptions","organizations_url":"https://api.github.com/users/stephenc/orgs","repos_url":"https://api.github.com/users/stephenc/repos","events_url":"https://api.github.com/users/stephenc/events{/privacy}","received_events_url":"https://api.github.com/users/stephenc/received_events","type":"User","site_admin":false},"body":"Downstream of https://github.com/jenkinsci/scm-api-plugin/pull/36\r\n\r\nSee [JENKINS-43507](https://issues.jenkins-ci.org/browse/JENKINS-43507)\r\n\r\n@reviewbybees \r\n\r\nTodo\r\n\r\n- [ ] Ensure that the trait implementations work correctly when GitHub and BitBucky branch sources pick up traits","created_at":"2017-05-04T10:42:11Z","updated_at":"2017-05-04T10:47:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"34ca681d4583cea4d8621a69d36557110a216d07","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/jenkinsci/git-plugin/pulls/494/commits","review_comments_url":"https://api.github.com/repos/jenkinsci/git-plugin/pulls/494/comments","review_comment_url":"https://api.github.com/repos/jenkinsci/git-plugin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jenkinsci/git-plugin/issues/494/comments","statuses_url":"https://api.github.com/repos/jenkinsci/git-plugin/statuses/9399e865de0afb9d6b16ad70d4378bd25389fc10","head":{"label":"stephenc:jenkins-43507","ref":"jenkins-43507","sha":"9399e865de0afb9d6b16ad70d4378bd25389fc10","user":{"login":"stephenc","id":209336,"avatar_url":"https://avatars1.githubusercontent.com/u/209336?v=3","gravatar_id":"","url":"https://api.github.com/users/stephenc","html_url":"https://github.com/stephenc","followers_url":"https://api.github.com/users/stephenc/followers","following_url":"https://api.github.com/users/stephenc/following{/other_user}","gists_url":"https://api.github.com/users/stephenc/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenc/subscriptions","organizations_url":"https://api.github.com/users/stephenc/orgs","repos_url":"https://api.github.com/users/stephenc/repos","events_url":"https://api.github.com/users/stephenc/events{/privacy}","received_events_url":"https://api.github.com/users/stephenc/received_events","type":"User","site_admin":false},"repo":{"id":60837194,"name":"git-plugin","full_name":"stephenc/git-plugin","owner":{"login":"stephenc","id":209336,"avatar_url":"https://avatars1.githubusercontent.com/u/209336?v=3","gravatar_id":"","url":"https://api.github.com/users/stephenc","html_url":"https://github.com/stephenc","followers_url":"https://api.github.com/users/stephenc/followers","following_url":"https://api.github.com/users/stephenc/following{/other_user}","gists_url":"https://api.github.com/users/stephenc/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenc/subscriptions","organizations_url":"https://api.github.com/users/stephenc/orgs","repos_url":"https://api.github.com/users/stephenc/repos","events_url":"https://api.github.com/users/stephenc/events{/privacy}","received_events_url":"https://api.github.com/users/stephenc/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/stephenc/git-plugin","description":"Git plugin for Jenkins","fork":true,"url":"https://api.github.com/repos/stephenc/git-plugin","forks_url":"https://api.github.com/repos/stephenc/git-plugin/forks","keys_url":"https://api.github.com/repos/stephenc/git-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stephenc/git-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stephenc/git-plugin/teams","hooks_url":"https://api.github.com/repos/stephenc/git-plugin/hooks","issue_events_url":"https://api.github.com/repos/stephenc/git-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/stephenc/git-plugin/events","assignees_url":"https://api.github.com/repos/stephenc/git-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/stephenc/git-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/stephenc/git-plugin/tags","blobs_url":"https://api.github.com/repos/stephenc/git-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stephenc/git-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stephenc/git-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/stephenc/git-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stephenc/git-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/stephenc/git-plugin/languages","stargazers_url":"https://api.github.com/repos/stephenc/git-plugin/stargazers","contributors_url":"https://api.github.com/repos/stephenc/git-plugin/contributors","subscribers_url":"https://api.github.com/repos/stephenc/git-plugin/subscribers","subscription_url":"https://api.github.com/repos/stephenc/git-plugin/subscription","commits_url":"https://api.github.com/repos/stephenc/git-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/stephenc/git-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/stephenc/git-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/stephenc/git-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/stephenc/git-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/stephenc/git-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stephenc/git-plugin/merges","archive_url":"https://api.github.com/repos/stephenc/git-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stephenc/git-plugin/downloads","issues_url":"https://api.github.com/repos/stephenc/git-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/stephenc/git-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/stephenc/git-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/stephenc/git-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stephenc/git-plugin/labels{/name}","releases_url":"https://api.github.com/repos/stephenc/git-plugin/releases{/id}","deployments_url":"https://api.github.com/repos/stephenc/git-plugin/deployments","created_at":"2016-06-10T09:30:41Z","updated_at":"2016-06-10T09:30:45Z","pushed_at":"2017-05-04T10:37:52Z","git_url":"git://github.com/stephenc/git-plugin.git","ssh_url":"git@github.com:stephenc/git-plugin.git","clone_url":"https://github.com/stephenc/git-plugin.git","svn_url":"https://github.com/stephenc/git-plugin","homepage":"http://wiki.jenkins-ci.org/display/JENKINS/Git Plugin","size":5071,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jenkinsci:master","ref":"master","sha":"b0a5ebf38d076f56ff72a5935f3fd80f05644412","user":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars3.githubusercontent.com/u/107424?v=3","gravatar_id":"","url":"https://api.github.com/users/jenkinsci","html_url":"https://github.com/jenkinsci","followers_url":"https://api.github.com/users/jenkinsci/followers","following_url":"https://api.github.com/users/jenkinsci/following{/other_user}","gists_url":"https://api.github.com/users/jenkinsci/gists{/gist_id}","starred_url":"https://api.github.com/users/jenkinsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenkinsci/subscriptions","organizations_url":"https://api.github.com/users/jenkinsci/orgs","repos_url":"https://api.github.com/users/jenkinsci/repos","events_url":"https://api.github.com/users/jenkinsci/events{/privacy}","received_events_url":"https://api.github.com/users/jenkinsci/received_events","type":"Organization","site_admin":false},"repo":{"id":612587,"name":"git-plugin","full_name":"jenkinsci/git-plugin","owner":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars3.githubusercontent.com/u/107424?v=3","gravatar_id":"","url":"https://api.github.com/users/jenkinsci","html_url":"https://github.com/jenkinsci","followers_url":"https://api.github.com/users/jenkinsci/followers","following_url":"https://api.github.com/users/jenkinsci/following{/other_user}","gists_url":"https://api.github.com/users/jenkinsci/gists{/gist_id}","starred_url":"https://api.github.com/users/jenkinsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenkinsci/subscriptions","organizations_url":"https://api.github.com/users/jenkinsci/orgs","repos_url":"https://api.github.com/users/jenkinsci/repos","events_url":"https://api.github.com/users/jenkinsci/events{/privacy}","received_events_url":"https://api.github.com/users/jenkinsci/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jenkinsci/git-plugin","description":"Git plugin for Jenkins","fork":true,"url":"https://api.github.com/repos/jenkinsci/git-plugin","forks_url":"https://api.github.com/repos/jenkinsci/git-plugin/forks","keys_url":"https://api.github.com/repos/jenkinsci/git-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jenkinsci/git-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jenkinsci/git-plugin/teams","hooks_url":"https://api.github.com/repos/jenkinsci/git-plugin/hooks","issue_events_url":"https://api.github.com/repos/jenkinsci/git-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/jenkinsci/git-plugin/events","assignees_url":"https://api.github.com/repos/jenkinsci/git-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/jenkinsci/git-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/jenkinsci/git-plugin/tags","blobs_url":"https://api.github.com/repos/jenkinsci/git-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jenkinsci/git-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jenkinsci/git-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/jenkinsci/git-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jenkinsci/git-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/jenkinsci/git-plugin/languages","stargazers_url":"https://api.github.com/repos/jenkinsci/git-plugin/stargazers","contributors_url":"https://api.github.com/repos/jenkinsci/git-plugin/contributors","subscribers_url":"https://api.github.com/repos/jenkinsci/git-plugin/subscribers","subscription_url":"https://api.github.com/repos/jenkinsci/git-plugin/subscription","commits_url":"https://api.github.com/repos/jenkinsci/git-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/jenkinsci/git-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/jenkinsci/git-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/jenkinsci/git-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/jenkinsci/git-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/jenkinsci/git-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jenkinsci/git-plugin/merges","archive_url":"https://api.github.com/repos/jenkinsci/git-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jenkinsci/git-plugin/downloads","issues_url":"https://api.github.com/repos/jenkinsci/git-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/jenkinsci/git-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/jenkinsci/git-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/jenkinsci/git-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jenkinsci/git-plugin/labels{/name}","releases_url":"https://api.github.com/repos/jenkinsci/git-plugin/releases{/id}","deployments_url":"https://api.github.com/repos/jenkinsci/git-plugin/deployments","created_at":"2010-04-15T21:07:21Z","updated_at":"2017-04-29T15:59:17Z","pushed_at":"2017-05-04T10:42:12Z","git_url":"git://github.com/jenkinsci/git-plugin.git","ssh_url":"git@github.com:jenkinsci/git-plugin.git","clone_url":"https://github.com/jenkinsci/git-plugin.git","svn_url":"https://github.com/jenkinsci/git-plugin","homepage":"http://wiki.jenkins-ci.org/display/JENKINS/Git Plugin","size":5158,"stargazers_count":439,"watchers_count":439,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":632,"mirror_url":null,"open_issues_count":65,"forks":632,"open_issues":65,"watchers":439,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/git-plugin/pulls/494"},"html":{"href":"https://github.com/jenkinsci/git-plugin/pull/494"},"issue":{"href":"https://api.github.com/repos/jenkinsci/git-plugin/issues/494"},"comments":{"href":"https://api.github.com/repos/jenkinsci/git-plugin/issues/494/comments"},"review_comments":{"href":"https://api.github.com/repos/jenkinsci/git-plugin/pulls/494/comments"},"review_comment":{"href":"https://api.github.com/repos/jenkinsci/git-plugin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jenkinsci/git-plugin/pulls/494/commits"},"statuses":{"href":"https://api.github.com/repos/jenkinsci/git-plugin/statuses/9399e865de0afb9d6b16ad70d4378bd25389fc10"}}}}
{"actor":{"display_login":"stephenc"}}