Пример #1
0
def _getFilteredListofIssueIDs(args):
    if args.id:
        issueId = identifiers.getFullIssueIdFromLeadingSubstr(args.id)
        if issueId == None:
            # See if this is a group ID
            if group.exists(args.id):
                return Group(args.id).getIssueIds()
            else:
                return None
            
        return [issueId]
    
    else:
        return _getAllIssueIDs()
Пример #2
0
def execute(args):
	# Are we deleting something?
	if args.d or args.D:
		
		# see if we're deleting an existing issue from a group
		issueToDelete = args.d if args.d else args.D
		issueID = identifiers.getFullIssueIdFromLeadingSubstr(issueToDelete)
		if issueID:
			force = False if args.d else True
			
			# If no groupname is given, then we will remove from all groups
			# ... notice the hack here where args.id is holding the groupname
			# due to the currently lame and hacky argparsing
			if not args.id:
				# Remove the issue from any groups that contained it
				groupnames = group.getGroupsForIssueId(issueID)
				
				if len(groupnames) == 0:
					print "No groups to delete issue from!"
					return None
				
				# If we're not forcing the remove, then we need to double-check
				# to make sure that we can actually remove the issue from each
				# group without breaking things
				for name in groupnames:
					if not Group(name)._canRmIssue(issueID,force):
						# Can't perform this operation without a force!
						print "Cannot delete issue from group '" + name + "' without force option, '-D'"
						return None
				
				# All clear to remove the issue!... groups first if you please...
				for name in groupnames: 
					Group(name).rmIssue(issueID,force)
					# HACK HACK HACK
					# Should be executing a git command here to add the
					# subsequent group changes to the index, but I'm taking
					# a shortcut for the moment

				return None
			
			# HACK HACK HACK
			# The command line parsing here is totally messed up and so
			# rather than using the groupname we have to pretend here
			# that the id is the groupname... the command line just
			# needs to be rewritten :(
			Group(args.id).rmIssue(issueID, force)
			
			# HACK HACK HACK
			# Should be executing a git command here to add the
			# subsequent group changes to the index, but I'm taking
			# a shortcut for the moment
			return None
		
		# see if we're deleting a group entirely
		if group.exists(args.d):
			print "groupname = " + args.d
			getCmd('git rm "' + Group(args.d).getPath() + '"')
			return None
		elif group.exists(args.D):
			print "groupname = " + args.D
			getCmd('git rm -f "' + Group(args.D).getPath() + '"')
			return None
		
		# tried to delete, but we couldn't figure out what...
		groupname = args.d if args.d else args.D
		print "Could not delete '" + groupname  + "' without force option, '-D'"
		return None
	
	if args.groupname == None and args.id == None:
		print "\n".join(group.getListOfAllGroups())
		return None
	
	if args.groupname == None:
		# We don't support this syntax yet
		print "Command not currently supported"
		return None
	
	# get the full issue ID & Add the issue to the group
	issueID = identifiers.getFullIssueIdFromLeadingSubstr(args.id)
	Group(args.groupname).addIssue(issueID)
	commit_helper.addToIndex('"' + Group(args.groupname).getPath() + '"')
	
	if args.commit:
		commit_helper.commit()