Exemplo n.º 1
0
	def __init__(self, apiserver, entryPoints, username, password, filter):
		self.links = list()

		self.todo = dict()
		self.done = dict()
		self.skipped = dict()
		self.j = JiraAPI(apiserver, username, password)
		self.filter = filter

		issues = list()
		for entryPoint in entryPoints.split(','):
			if( entryPoint.find('-') != -1 ):
				i = self.j.fetchIssue(entryPoint)
				if( self.filter.useIssue( i ) ):
					issues.append( i )
			else:
				for i in self.j.fetchIssuesFromProject(entryPoint):
					if( self.filter.useIssue( i ) ):
						issues.append( i )

		for issue in issues:
			if( self.filter.useIssue( issue ) ):
				self.todo[issue.key] = issue
			else:
				self.skipped[issue.key] = issue

		#each execution of this loop will expand
		#the graph by one link in all directions
		while( not self.expand() ):
			pass

		#compact data for API caller and destroy temporaries
#		for issueKey in self.done:
#			del self.done[issueKey].links
		self.issues = self.done
		del self.done
		del self.skipped
		del self.todo
		del self.j
Exemplo n.º 2
0
#!/usr/bin/python
from  jiraapi import JiraAPI


#test config
j = JiraAPI("https://jira.atlassian.com", None, None ) #set up connection
issuename="CEP-154" #a single issue to test
projectname="CEP" #a project to iterate

print "Test:Fetching",issuename
i = j.fetchIssue(issuename)
if( i.key == issuename ):
	print "","(",i.status,":",i.priority,")",i
else:
	print "","Key Mismatch!", i.key, "vs", issuename

print "Test:Enumerate issues from",projectname
jissues = j.fetchIssuesFromProject(projectname)
for issue in jissues:
	i = j.fetchIssue(issue.key)
	if( issue.key == i.key ):
		print "","(",i.status,":",i.priority,")",i
	else:
		print "","Key Mismatch!", issue.key, "vs", i.key

	for l in i.links:
		print "","",l

print "Test:Fetching enumerated issues individually from",projectname
for issue in jissues:
	i = j.fetchIssue(issue.key)
Exemplo n.º 3
0
class JiraWalk:
	"""walk a Jira server collecting map of issues"""

	def expand( self ):
		"""expand graph by one link in all directions. Return true if done"""
		done = True

		thispass = self.todo
		self.todo = dict()

		for issueKey in thispass.keys():
			issue = thispass[issueKey]
			link_list = issue.links
			for link in link_list:
				if( link.inwardKey == issueKey ):
					otherKey = link.outwardKey
				else:
					otherKey = link.inwardKey

				if( otherKey in self.todo ):
					otherIssue = self.todo[otherKey]
				elif( otherKey in self.done ):
					otherIssue = self.done[otherKey]
				elif( otherKey in self.skipped ):
					continue
				elif( otherKey in thispass ):
					otherIssue = thispass[otherKey]
				else:
					otherIssue = self.j.fetchIssue( otherKey )
					if( self.filter.useIssue( otherIssue ) ):
						self.todo[otherKey] = otherIssue
					else:
						self.skipped[otherKey] = otherIssue
						continue

				if( link not in self.links ):
					if( self.filter.useLink( link ) ):
						self.links.append( link )

		self.done.update( thispass )
		return len(self.todo) == 0

	def __init__(self, apiserver, entryPoints, username, password, filter):
		self.links = list()

		self.todo = dict()
		self.done = dict()
		self.skipped = dict()
		self.j = JiraAPI(apiserver, username, password)
		self.filter = filter

		issues = list()
		for entryPoint in entryPoints.split(','):
			if( entryPoint.find('-') != -1 ):
				i = self.j.fetchIssue(entryPoint)
				if( self.filter.useIssue( i ) ):
					issues.append( i )
			else:
				for i in self.j.fetchIssuesFromProject(entryPoint):
					if( self.filter.useIssue( i ) ):
						issues.append( i )

		for issue in issues:
			if( self.filter.useIssue( issue ) ):
				self.todo[issue.key] = issue
			else:
				self.skipped[issue.key] = issue

		#each execution of this loop will expand
		#the graph by one link in all directions
		while( not self.expand() ):
			pass

		#compact data for API caller and destroy temporaries
#		for issueKey in self.done:
#			del self.done[issueKey].links
		self.issues = self.done
		del self.done
		del self.skipped
		del self.todo
		del self.j