Пример #1
0
    def _process_revtree(self, req):
        """Handle revtree generation requests"""
        tracrepos = self.env.get_repository()
        youngest = int(tracrepos.get_youngest_rev())
        oldest = max(self.oldest, int(tracrepos.get_oldest_rev()))
        if self.abstime:
            timebase = int(time.time())
        else:
            timebase = to_timestamp(tracrepos.get_changeset(youngest).date)
        revstore = RevtreeStore(self.env, req.authname, \
                                (oldest, youngest), 
                                timebase, self.style)
        if req.args.has_key('reset') and req.args['reset']:
            revstore.clear(req.session)
        else:
            revstore.load(req.session)
        if req.args:
            revstore.populate(req.args)
        revstore.compute_range(timebase)
        data = revstore.get_values()
                
        try:
            if not revstore.can_be_rendered():
                raise EmptyRangeError
            repos = Repository(self.env, req.authname)
            repos.build(self.bcre, revstore.revrange, revstore.timerange)
            (branches, authors) = \
                self._select_parameters(repos, req, revstore)
            svgrevtree = self.rt.get_revtree(repos, req)
            if revstore['branch']:
                sbranches = [revstore['branch']]
                sbranches.extend(filter(lambda t: t not in sbranches, 
                                        self.trunks))
            else:
                sbranches = None
            sauthors = revstore['author'] and [revstore['author']] or None
            if revstore['showdel']:
                hidetermbranch = False
            else:
                hidetermbranch = True
            svgrevtree.create(req, 
                              revisions=revstore.revrange, 
                              branches=sbranches, authors=sauthors, 
                              hidetermbranch=hidetermbranch, 
                              style=revstore['style'])
            svgrevtree.build()
            svgrevtree.render(self.scale*0.6)
            style = req.href.chrome('revtree/css/revtree.css')
            svgstyle = '<?xml-stylesheet href="%s" type="text/css"?>' % style
            data.update({
                'svg': Markup(unicode(str(svgrevtree), 'utf-8')),
                'svgstyle': Markup(svgstyle)
            })
            # create and order the drop-down list content, starting with the
            # global values 
            branches = repos.branches().keys()
            authors = repos.authors()
            # save the user parameters only if the tree can be rendered
            revstore.save(req.session)
        except EmptyRangeError:
            data.update({'errormsg': \
                         "Selected filters cannot render a revision tree"})
            # restore default parameters
            repos = Repository(self.env, req.authname)
            repos.build(self.bcre, revrange=(oldest, youngest))
            branches = repos.branches().keys()
            authors = repos.authors()
            
        revrange = repos.revision_range()
        revisions = self._get_ui_revisions((oldest, youngest), revrange)
        branches.sort()
        # prepend the trunks to the selected branches
        for b in filter(lambda t: t not in branches, self.trunks):
                branches.insert(0, b)
        branches = filter(None, branches)
        branches.insert(0, '')
        authors.sort()
        authors = filter(None, authors)
        authors.insert(0, '')

        dauthors = [dict(name=a, label=a or 'All') for a in authors]
        dbranches = [dict(name=b, label=b or 'All') for b in branches]
        
        data.update({
            'title': 'Revision Tree',
            'periods': self._get_periods(),
            'revmin': str(revrange[0]),
            'revmax': str(revrange[1]),
            'revisions': revisions,
            'branches': dbranches,
            'authors': dauthors
        })
                                                                               
        # add javascript for AJAX tooltips 
        add_script(req, 'revtree/js/svgtip.js')
        # add custom stylesheet
        add_stylesheet(req, 'revtree/css/revtree.css')
        return 'revtree.html', {'rt': data}, 'application/xhtml+xml'
Пример #2
0
    def _process_revtree(self, req):
        """Handle revtree generation requests"""
        tracrepos = self.env.get_repository()
        youngest = int(tracrepos.get_youngest_rev())
        if self.abstime:
            timebase = int(time.time())
        else:
            timebase = int(tracrepos.get_changeset(youngest).date)
        revstore = RevtreeStore(self.env, req.authname, (self.oldest, youngest), timebase, self.style)
        revstore.load(req.session)
        revstore.populate(req.args)
        revstore.compute_range(timebase)

        # fill in the HDF
        for field in revstore.fields:
            req.hdf["revtree." + field] = revstore[field]
        req.hdf["title"] = "Revision Tree"
        req.hdf["revtree.periods"] = self._get_periods()

        # add javascript for AJAX tooltips
        add_script(req, "revtree/js/jquery.js")
        add_script(req, "revtree/js/svgtip.js")

        try:
            if not revstore.can_be_rendered():
                raise EmptyRangeError

            repos = Repository(self.env, req.authname)
            repos.build(self.bcre, revstore.revrange, revstore.timerange)

            (branches, authors) = self._select_parameters(repos, req, revstore)

            svgrevtree = RevtreeSystem(self.env).get_revtree(repos)
            svgrevtree.create(
                req,
                revstore.revrange,
                revstore.get_branches(),
                revstore.get_authors(),
                revstore.get_hidetermbranch(),
                revstore.get_style(),
            )
            svgrevtree.build()
            svgrevtree.render(self.scale * 0.6)
            req.hdf.set_unescaped("revtree.svg.image", str(svgrevtree))

            # create and order the drop-down list content, starting with the
            # global values
            branches = repos.branches().keys()
            authors = repos.authors()
            branches.sort()
            authors.sort()
            # prepend the trunks to the selected branches
            for b in self.trunks:
                if b not in branches:
                    branches.insert(0, b)
            branches.insert(0, revstore.anybranch)
            authors.insert(0, revstore.anyauthor)

            # save the user parameters only if the tree can be rendered
            revstore.save(req.session)

        except EmptyRangeError:
            req.hdf["revtree.errormsg"] = "Selected filters cannot render" " a revision tree"
            # restore default parameters
            repos = Repository(self.env, req.authname)
            repos.build(self.bcre, revrange=(self.oldest, youngest))
            branches = repos.branches().keys()
            branches.sort()
            branches.reverse()
            authors = repos.authors()
            authors.sort()

        revrange = repos.revision_range()
        revisions = self._get_ui_revisions((self.oldest, youngest), revrange)

        # fill in the HDF
        req.hdf["revtree.revmin"] = revrange[0]
        req.hdf["revtree.revmax"] = revrange[1]
        req.hdf["revtree.revisions"] = revisions
        req.hdf["revtree.branches"] = branches
        req.hdf["revtree.authors"] = authors

        add_stylesheet(req, "revtree/css/revtree.css")
        return "revtree.cs", "application/xhtml+xml"
Пример #3
0
    def _process_revtree(self, req):
        """Handle revtree generation requests"""
        tracrepos = self.env.get_repository()
        youngest = int(tracrepos.get_youngest_rev())
        oldest = max(self.oldest, int(tracrepos.get_oldest_rev()))
        if self.abstime:
            timebase = int(time.time())
        else:
            timebase = to_timestamp(tracrepos.get_changeset(youngest).date)
        revstore = RevtreeStore(self.env, req.authname, \
                                (oldest, youngest),
                                timebase, self.style)
        if req.args.has_key('reset') and req.args['reset']:
            revstore.clear(req.session)
        else:
            revstore.load(req.session)
        if req.args:
            revstore.populate(req.args)
        revstore.compute_range(timebase)
        data = revstore.get_values()

        try:
            if not revstore.can_be_rendered():
                raise EmptyRangeError
            repos = Repository(self.env, req.authname)
            repos.build(self.bcre, revstore.revrange, revstore.timerange)
            (branches, authors) = \
                self._select_parameters(repos, req, revstore)
            svgrevtree = self.rt.get_revtree(repos, req)
            if revstore['branch']:
                sbranches = [revstore['branch']]
                sbranches.extend(
                    filter(lambda t: t not in sbranches, self.trunks))
            else:
                sbranches = None
            sauthors = revstore['author'] and [revstore['author']] or None
            if revstore['showdel']:
                hidetermbranch = False
            else:
                hidetermbranch = True
            svgrevtree.create(req,
                              revisions=revstore.revrange,
                              branches=sbranches,
                              authors=sauthors,
                              hidetermbranch=hidetermbranch,
                              style=revstore['style'])
            svgrevtree.build()
            svgrevtree.render(self.scale * 0.6)
            style = req.href.chrome('revtree/css/revtree.css')
            svgstyle = '<?xml-stylesheet href="%s" type="text/css"?>' % style
            data.update({
                'svg': Markup(unicode(str(svgrevtree), 'utf-8')),
                'svgstyle': Markup(svgstyle)
            })
            # create and order the drop-down list content, starting with the
            # global values
            branches = repos.branches().keys()
            authors = repos.authors()
            # save the user parameters only if the tree can be rendered
            revstore.save(req.session)
        except EmptyRangeError:
            data.update({'errormsg': \
                         "Selected filters cannot render a revision tree"})
            # restore default parameters
            repos = Repository(self.env, req.authname)
            repos.build(self.bcre, revrange=(oldest, youngest))
            branches = repos.branches().keys()
            authors = repos.authors()

        revrange = repos.revision_range()
        revisions = self._get_ui_revisions((oldest, youngest), revrange)
        branches.sort()
        # prepend the trunks to the selected branches
        for b in filter(lambda t: t not in branches, self.trunks):
            branches.insert(0, b)
        branches = filter(None, branches)
        branches.insert(0, '')
        authors.sort()
        authors = filter(None, authors)
        authors.insert(0, '')

        dauthors = [dict(name=a, label=a or 'All') for a in authors]
        dbranches = [dict(name=b, label=b or 'All') for b in branches]

        data.update({
            'title': 'Revision Tree',
            'periods': self._get_periods(),
            'revmin': str(revrange[0]),
            'revmax': str(revrange[1]),
            'revisions': revisions,
            'branches': dbranches,
            'authors': dauthors
        })

        # add javascript for AJAX tooltips
        add_script(req, 'revtree/js/svgtip.js')
        # add custom stylesheet
        add_stylesheet(req, 'revtree/css/revtree.css')
        return 'revtree.html', {'rt': data}, 'application/xhtml+xml'
Пример #4
0
    def _process_revtree(self, req):
        """Handle revtree generation requests"""
        tracrepos = self.env.get_repository()
        youngest = int(tracrepos.get_youngest_rev())
        if self.abstime:
            timebase = int(time.time())
        else:
            timebase = int(tracrepos.get_changeset(youngest).date)
        revstore = RevtreeStore(self.env, req.authname, \
                                (self.oldest, youngest),
                                timebase, self.style)
        revstore.load(req.session)
        revstore.populate(req.args)
        revstore.compute_range(timebase)

        # fill in the HDF
        for field in revstore.fields:
            req.hdf['revtree.' + field] = revstore[field]
        req.hdf['title'] = 'Revision Tree'
        req.hdf['revtree.periods'] = self._get_periods()

        # add javascript for AJAX tooltips
        add_script(req, 'revtree/js/jquery.js')
        add_script(req, 'revtree/js/svgtip.js')

        try:
            if not revstore.can_be_rendered():
                raise EmptyRangeError

            repos = Repository(self.env, req.authname)
            repos.build(self.bcre, revstore.revrange, revstore.timerange)

            (branches, authors) = \
                self._select_parameters(repos, req, revstore)

            svgrevtree = RevtreeSystem(self.env).get_revtree(repos)
            svgrevtree.create(req, revstore.revrange, revstore.get_branches(),
                              revstore.get_authors(),
                              revstore.get_hidetermbranch(),
                              revstore.get_style())
            svgrevtree.build()
            svgrevtree.render(self.scale * 0.6)
            req.hdf.set_unescaped('revtree.svg.image', str(svgrevtree))

            # create and order the drop-down list content, starting with the
            # global values
            branches = repos.branches().keys()
            authors = repos.authors()
            branches.sort()
            authors.sort()
            # prepend the trunks to the selected branches
            for b in self.trunks:
                if b not in branches:
                    branches.insert(0, b)
            branches.insert(0, revstore.anybranch)
            authors.insert(0, revstore.anyauthor)

            # save the user parameters only if the tree can be rendered
            revstore.save(req.session)

        except EmptyRangeError:
            req.hdf['revtree.errormsg'] = "Selected filters cannot render" \
                                          " a revision tree"
            # restore default parameters
            repos = Repository(self.env, req.authname)
            repos.build(self.bcre, revrange=(self.oldest, youngest))
            branches = repos.branches().keys()
            branches.sort()
            branches.reverse()
            authors = repos.authors()
            authors.sort()

        revrange = repos.revision_range()
        revisions = self._get_ui_revisions((self.oldest, youngest), revrange)

        # fill in the HDF
        req.hdf['revtree.revmin'] = revrange[0]
        req.hdf['revtree.revmax'] = revrange[1]
        req.hdf['revtree.revisions'] = revisions
        req.hdf['revtree.branches'] = branches
        req.hdf['revtree.authors'] = authors

        add_stylesheet(req, 'revtree/css/revtree.css')
        return 'revtree.cs', 'application/xhtml+xml'