@@ -160,23 +160,20 @@ def get_candidate_fix_versions(self, merge_branches=('master',)):
160160 mainline_versions = [x for x in unreleased_versions
161161 if mainline_version_regex .match (x .name )]
162162
163+ mainline_non_patch_versions = []
164+ for v in mainline_versions :
165+ (major , minor , patch ) = v .name .split ("." )
166+ if patch == "0" :
167+ mainline_non_patch_versions .append (v )
168+
169+ if len (mainline_versions ) > len (mainline_non_patch_versions ):
170+ # If there is a non-patch release, suggest that instead
171+ mainline_versions = mainline_non_patch_versions
172+
163173 default_fix_versions = [
164174 fix_version_from_branch (x , mainline_versions ).name
165175 for x in merge_branches ]
166176
167- for v in default_fix_versions :
168- # Handles the case where we have forked a release branch but not
169- # yet made the release. In this case, if the PR is committed to
170- # the master branch and the release branch, we only consider the
171- # release branch to be the fix version. E.g. it is not valid to
172- # have both 1.1.0 and 1.0.0 as fix versions.
173- (major , minor , patch ) = v .split ("." )
174- if patch == "0" :
175- previous = "%s.%s.%s" % (major , int (minor ) - 1 , 0 )
176- if previous in default_fix_versions :
177- default_fix_versions = [x for x in default_fix_versions
178- if x != v ]
179-
180177 return all_versions , default_fix_versions
181178
182179 def resolve (self , fix_versions , comment ):
@@ -200,26 +197,29 @@ def resolve(self, fix_versions, comment):
200197
201198 def show (self ):
202199 fields = self .issue .fields
200+ print (format_jira_output (self .jira_id , fields .status .name ,
201+ fields .summary , fields .assignee ,
202+ fields .components ))
203203
204- assignee = fields .assignee
205- if assignee is None :
206- assignee = "NOT ASSIGNED!!!"
207- else :
208- assignee = assignee .displayName
209204
210- components = fields .components
211- if len (components ) == 0 :
212- components = 'NO COMPONENTS!!!'
213- else :
214- components = ', ' .join ((x .name for x in components ))
215-
216- print ("=== JIRA {} ===" .format (self .jira_id ))
217- print ("Summary\t \t {}" .format (fields .summary ))
218- print ("Assignee\t {}" .format (assignee ))
219- print ("Components\t {}" .format (components ))
220- print ("Status\t \t {}" .format (fields .status .name ))
221- print ("URL\t \t {}/{}" .format ('/' .join ((JIRA_API_BASE , 'browse' )),
222- self .jira_id ))
205+ def format_jira_output (jira_id , status , summary , assignee , components ):
206+ if assignee is None :
207+ assignee = "NOT ASSIGNED!!!"
208+ else :
209+ assignee = assignee .displayName
210+
211+ if len (components ) == 0 :
212+ components = 'NO COMPONENTS!!!'
213+ else :
214+ components = ', ' .join ((x .name for x in components ))
215+
216+ return """=== JIRA {} ===
217+ Summary\t \t {}
218+ Assignee\t {}
219+ Components\t {}
220+ Status\t \t {}
221+ URL\t \t {}/{}""" .format (jira_id , summary , assignee , components , status ,
222+ '/' .join ((JIRA_API_BASE , 'browse' )), jira_id )
223223
224224
225225class GitHubAPI (object ):
0 commit comments