コード例 #1
0
ファイル: tool.py プロジェクト: ScientificRevenue/backlogger
def init(section):
    print color.success_blue('# ') + 'Fetching stories from Backlog and Queue...'
    progress.update(0, 2)
    backlog_stories = filter_not_accepted(section.backlog.fetch_stories())
    backlog_stories_sorted = effort_sorted(backlog_stories)
    progress.update(1, 2)
    queue_backlog = filter_backlog(section.queue.fetch_stories())
    progress.finish()
    
    print color.success_blue('# ') + 'Writing original story order to config file...'
    section.order = map(lambda story: (story.id, story.current_state), backlog_stories)
    section.write_order()
    progress.finish()
    
    def move_to_estimator(story, origin):
        story.description = getattr(story, 'description', '') + '\n' + origin_key + origin
        story.sync_to_project(section.estimator, safe=True)
    
    for story in backlog_stories_sorted:
        if story.story_type == 'release' and story.current_state == 'unscheduled':
            story.current_state = 'unstarted'
            continue
        
        if story.story_type != 'release' and story.current_state in ['unscheduled', 'unstarted']:
            story.current_state = 'started'
            if not hasattr(story, 'estimate') and story.is_estimatable():
                print color.warn('Warning: ') + 'Story %s has no estimate. Adding an estimate of one; this is needed to start the story in Estimator.' % story.name
                story.estimate = 1

    print color.success_blue('# ') + 'Moving stories from Backlog to Estimator...'
    progress.iter(backlog_stories_sorted, move_to_estimator, 'backlog')

    for story in queue_backlog: story.current_state = 'unscheduled'
    print color.success_blue('# ') + 'Moving stories from Queue to Estimator...'
    progress.iter(queue_backlog[::-1], move_to_estimator, 'queue')
コード例 #2
0
def get_existing(stories, project):
    existing_stories = []

    def check_exist(story):
        try:
            project.fetch_story(story.id)
        except Exception:
            print color.warn(
                "Warning: "
            ) + "Story %s was deleted in Estimator (ignore above error if you meant to delete this story)" % story.name
            return
        existing_stories.append(story)

    progress.iter(stories, check_exist)
    return existing_stories
コード例 #3
0
ファイル: tool.py プロジェクト: ScientificRevenue/backlogger
def finalize(section):
    print color.success_blue('# ') + 'Fetching stories from Estimator...'
    estimator_stories = section.estimator.fetch_stories()
    estimator_backlog = filter_backlog(estimator_stories)
    estimator_icebox = filter_icebox(estimator_stories)
    # stories that originally came from the backlog
    from_backlog = filter(lambda story: parse_tag(story, origin_key) == 'backlog', 
                          estimator_backlog)
    # stories that originally came from the queue
    from_queue = filter(lambda story: parse_tag(story, origin_key) == 'queue', estimator_backlog)
    # newly created stories
    no_from = filter(lambda story: story not in (from_backlog+from_queue), estimator_backlog)
    progress.finish()

    for story in estimator_icebox:
        if parse_tag(story, effort_key) == 'backlog':
            print color.warn('Warning: ') + 'Story \"%s\" is from the backlog, but was placed in Estimator icebox. It will be moved to backlog of Queue.' % story.name
    
    print color.success_blue('# ') + 'Filtering out nonexistant stories...'
    existing_backlog = get_existing(from_backlog, section.estimator)
    
    print color.success_blue('# ') + 'Restoring states and moving stories from Backlog...'
    restore_states(existing_backlog, section.order)
    progress.iter(existing_backlog, lambda story: story.sync_to_project(section.backlog,safe=True))

    print color.success_blue('# ') + 'Ordering stories originally from Backlog...'
    order_backlog(existing_backlog, section.order)
                
    print color.success_blue('# ') + 'Moving new stories from Queue into icebox of Backlog...'
    progress.iter(list(reversed(from_queue)), move_to_icebox, section.backlog)

    print color.success_blue('# ') + 'Moving stories created in Estimator to icebox of Backlog...'
    progress.iter(no_from, move_to_icebox, section.backlog)

    print color.success_blue('# ') + 'Moving stories from icebox of Estimator to backlog of Queue...'
    progress.iter(estimator_icebox, move_to_backlog, section.queue)
    
    print color.success_blue('# ') + 'Formatting tags...'
    progress.iter(estimator_stories, finalize_tags)

    print color.success_blue('# ') + 'Deleting Estimator...'
    section.estimator.delete()
    progress.finish()
    
    abandon_session_config(section)
コード例 #4
0
ファイル: tests.py プロジェクト: ScientificRevenue/backlogger
queue_include = [{'name' : 'Queue include item #1', 'current_state' : 'accepted', 'story_type' : 'chore'}, 
                 {'name' : 'Queue include item #2', 'current_state' : 'started', 'story_type' : 'bug', 'description' : 'This bug has been annoying us for a while.'}, 
                 {'name' : 'Queue include item #3', 'current_state' : 'finished', 'estimate' : 50},
                 {'name' : 'Queue include item #4', 'current_state' : 'unstarted', 'story_type' : 'release', 'description' : 'Test description.\n\n@effortOrder:1234'}, 
                 {'name' : 'Queue include item #5', 'current_state' : 'delivered', 'estimate' : 3, 'story_type' : 'feature'}, 
                 {'name' : 'Queue include item #6', 'current_state' : 'rejected', 'estimate' : 8, 'labels' : ['label1', 'label2']}]
qi_stories = []

backlog_start = [{'name' : 'Backlog item #1', 'current_state' : 'accepted', 'estimate' : 1}, 
                 {'name' : 'Backlog item #2', 'current_state' : 'started', 'story_type' : 'bug', 'description' : '@effortOrder:0'},
                 {'name' : 'Backlog item #3', 'current_state' : 'delivered', 'story_type' : 'feature', 'estimate' : 50, 'description' : '@effortOrder:2'},
                 {'name' : 'Backlog item #4', 'current_state' : 'finished', 'estimate' : 5},
                 {'name' : 'Backlog item #5', 'current_state' : 'unstarted', 'story_type' : 'chore', 'description' : '@effortOrder:1'},
                 {'name' : 'Backlog item #6', 'current_state' : 'unstarted', 'story_type' : 'release'},
                 {'name' : 'Backlog item #7', 'current_state' : 'unstarted', 'story_type' : 'bug', 'description' : 'This bug would have been caught with a test suite.'},
                 {'name' : 'Backlog icebox item #2', 'current_state' : 'unscheduled', 'story_type' : 'chore'},
                 {'name' : 'Backlog icebox item #1', 'current_state' : 'unscheduled', 'estimate' : 5}]

backlog_stories = []

print color.success_blue('# ') + 'Generating Queue not include...'
progress.iter(queue_not_include, lambda attrs: qni_stories.append(queue.create_story(attrs)))
print color.success_blue('# ') + 'Generating Queue include...'
progress.iter(queue_include, lambda attrs: qi_stories.append(queue.create_story(attrs)))

print color.success_blue('# ') + 'Generating Backlog...'
progress.iter(backlog_start, lambda attrs: backlog_stories.append(backlog.create_story(attrs)))

# tool.run_session(config.load_section(config.eng_sec))