def getFullIssueDisplay(self): from groups.group import getGroupsForIssueId lines = [] lines.extend([str(Color('yellow')) + "Issue ID: " + self.getIdStr() + '\n']) lines.extend([str(Color('none')) + "Created: " + str(Color('green')) + self.getCreatedDateStr() + '\t' + str(Color('none')) + "Author: " + self.getCreatedAuthorStr() + '\n']) lines.extend([str(Color('none')) + "Modified: " + str(Color('green')) + self.getModifiedDateStr() + '\t' + str(Color('none')) + "Author: " + self.getModifiedAuthorStr() + '\n']) lines.extend([str(Color('none')) + "Status: " # The tab formatting here is horribly wrong, but works for now... need to fix it later :( + self.getStatusStr() + ('\t\t\t' if len(self.getStatusStr()) < 7 else '\t\t') + str(Color('none')) + "Groups: " + str(Color('blue')) + ', '.join(getGroupsForIssueId(self.getIdStr())) + '\n']) lines.extend(['\n']) lines.extend([str(Color('none')) + "Title: " + self.getTitle() + '\n']) lines.extend(['-' * 80]) lines.extend(['\n']) lines.extend(str(Color('none')) + self.getDescription()) line = "" for l in lines: line += l return line
def execute(args): if (args.id): issueID = getFullIssueIdFromLeadingSubstr(args.id) if issueID == None: print "Could not find issue: " + args.id return None # See if we can remove this issue at all without a --force issuePath = getPathFromId(issueID) if not args.force: issueStatus = getCmd("git status --porcelain -- " + issuePath) if issueStatus and issueStatus[0] =='A': print "Cannot remove issue without --force" return None # Remove the issue from any groups that contained it groupnames = group.getGroupsForIssueId(issueID) # 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... this seems like hack... # Why should we be having to check first before we execute later? # Should we just perform the change on the group objects and then # commit them?... maybe I'm missing something and this isn't a big deal. for name in groupnames: if not Group(name)._canRmIssueFromGroup(issueID,args.force): # Can't perform this operation without a force! print "Cannot remove issue from group '" + group + "' without --force" return None # All clear to remove the issue!... groups first if you please... for name in groupnames: Group(name).rmIssue(issueID, args.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 issueTitle = Issue(issueID).getTitle() # Remove the issue commit_helper.remove(issuePath, args.force) if args.commit: commit_helper.commit()
def getOneLineStr(self, columns): from groups.group import getGroupsForIssueId line = "" for column in columns: color = str(column.color) field = "" if column.name == 'id': field = self.getShortIdStr() elif column.name == 'status': field = self.getStatusStr() elif column.name == 'title': field = self.getTitle() elif column.name == 'cdate': field = self.getCreatedDateStr() elif column.name == 'mdate': field = self.getModifiedDateStr() elif column.name == 'groups': field = ', '.join(getGroupsForIssueId(self.getIdStr())) line += color + truncateOrPadStrToWidth(field, column.length) + ' ' return line
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()