当前位置: 首页>>代码示例>>Python>>正文


Python RepositoryManager.get_changeset方法代码示例

本文整理汇总了Python中trac.versioncontrol.RepositoryManager.get_changeset方法的典型用法代码示例。如果您正苦于以下问题:Python RepositoryManager.get_changeset方法的具体用法?Python RepositoryManager.get_changeset怎么用?Python RepositoryManager.get_changeset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在trac.versioncontrol.RepositoryManager的用法示例。


在下文中一共展示了RepositoryManager.get_changeset方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: from_comment

# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import get_changeset [as 别名]
    def from_comment(cls, env, comment, user=None, notify=True):
        """
        Creates a subscription from a Comment object.
        """
        sub = {
            'user': user or comment.author,
            'type': comment.type,
            'notify': notify,
        }

        # Munge attachments
        if comment.type == 'attachment':
            sub['path'] = comment.path.split(':')[1]
            sub['repos'] = ''
            sub['rev'] = ''

        # Munge changesets and browser
        if comment.type in ('changeset', 'browser'):
            if comment.type == 'browser':
                sub['path'] = comment.path
            else:
                sub['path'] = ''
            repo = RepositoryManager(env).get_repository(None)
            try:
                sub['repos'] = repo.reponame
                try:
                    _cs = repo.get_changeset(comment.revision)
                    sub['rev'] = _cs.rev
                except NoSuchChangeset:
                    # Invalid changeset
                    return None
            finally:
                repo.close()

        return cls._from_dict(env, sub)
开发者ID:trainormg,项目名称:trac-code-comments-plugin,代码行数:37,代码来源:subscription.py

示例2: expand_macro

# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import get_changeset [as 别名]
 def expand_macro(self, formatter, name, content, args=None):
     args = args or {}
     reponame = args.get('repository') or ''
     rev = args.get('revision')
     repos = RepositoryManager(self.env).get_repository(reponame)
     try:
         changeset = repos.get_changeset(rev)
         message = changeset.message
         rev = changeset.rev
         resource = repos.resource
     except Exception:
         message = content
         resource = Resource('repository', reponame)
     if formatter.context.resource.realm == 'ticket':
         ticket_re = CommitTicketUpdater.ticket_re
         if not any(int(tkt_id) == int(formatter.context.resource.id)
                    for tkt_id in ticket_re.findall(message)):
             return tag.p(_("(The changeset message doesn't reference this "
                            "ticket)"), class_='hint')
     if ChangesetModule(self.env).wiki_format_messages:
         return tag.div(format_to_html(self.env,
             formatter.context.child('changeset', rev, parent=resource),
             message, escape_newlines=True), class_='message')
     else:
         return tag.pre(message, class_='message')
开发者ID:aroth-arsoft,项目名称:arsoft-trac-commitupdater,代码行数:27,代码来源:commit_updater.py

示例3: expand_macro

# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import get_changeset [as 别名]
 def expand_macro(self, formatter, name, content, args={}):
     reponame = args.get('repository') or ''
     rev = args.get('revision')
     repos = RepositoryManager(self.env).get_repository(reponame)
     try:
         changeset = repos.get_changeset(rev)
         message = changeset.message
         
         # add review status to commit message (
         review = CodeReview(self.env, reponame, rev)
         status = review.encode(review.status)
         message += '\n\n{{{#!html \n'
         message += '<div class="codereviewstatus">'
         message += '  <div class="system-message %s">' % status.lower()
         message += '    <p>Code review status: '
         message += '      <span>%s</span>' % review.status
         message += '    </p>'
         message += '  </div>'
         message += '</div>'
         message += '\n}}}'
         
         rev = changeset.rev
         resource = repos.resource
     except Exception, e:
         message = content
         resource = Resource('repository', reponame)
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:28,代码来源:web_ui.py

示例4: expand_macro

# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import get_changeset [as 别名]
 def expand_macro(self, formatter, name, content, args={}):
     reponame = args.get("repository") or ""
     rev = args.get("revision")
     repos = RepositoryManager(self.env).get_repository(reponame)
     try:
         changeset = repos.get_changeset(rev)
         message = changeset.message
         rev = changeset.rev
         resource = repos.resource
     except Exception:
         message = content
         resource = Resource("repository", reponame)
     if formatter.context.resource.realm == "ticket":
         ticket_re = CommitTicketUpdater.ticket_re
         if not any(int(tkt_id) == int(formatter.context.resource.id) for tkt_id in ticket_re.findall(message)):
             return tag.p("(The changeset message doesn't reference this " "ticket)", class_="hint")
     if ChangesetModule(self.env).wiki_format_messages:
         return tag.div(
             format_to_html(
                 self.env, formatter.context.child("changeset", rev, parent=resource), message, escape_newlines=True
             ),
             class_="message",
         )
     else:
         return tag.pre(message, class_="message")
开发者ID:moreati,项目名称:trac-gitsvn,代码行数:27,代码来源:commit_updater.py

示例5: _update_tickets

# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import get_changeset [as 别名]
 def _update_tickets(self, req, review):
     """Updates the tickets referenced by the given review's changeset
     with a comment of field changes.  Field changes and command execution
     may occur if specified in trac.ini and the review's changeset is the
     last one of the ticket."""
     status = review.encode(review.status).lower()
     summary = review.summaries[-1]
     
     # build comment
     if summary['status']:
         comment = "Code review set to %(status)s" % summary
     else:
         comment = "Code review comment"
     summary['_ref'] = review.changeset
     if review.repo:
         summary['_ref'] += '/' + review.repo
     comment += " for [%(_ref)s]:\n\n%(summary)s" % summary
     
     # find and update tickets
     # TODO: handle when there's no explicitly named repo
     repo = RepositoryManager(self.env).get_repository(review.repo)
     changeset = repo.get_changeset(review.changeset)
     ticket_re = CommitTicketUpdater.ticket_re
     tickets = ticket_re.findall(changeset.message)
     
     invoked = False
     for ticket in tickets:
         tkt = Ticket(self.env, ticket)
         
         # determine ticket changes
         changes = {}
         if self._is_complete(ticket, tkt, review, failed_ok=True):
             changes = self._get_ticket_changes(tkt, status)
         
         # update ticket if there's a review summary or ticket changes
         if summary['summary'] or changes:
             for field,value in changes.items():
                 tkt[field] = value
             tkt.save_changes(author=summary['reviewer'], comment=comment)
         
         # check to invoke command
         if not invoked and self._is_complete(ticket, tkt, review):
             self._execute_command(status)
             invoked = True
     
     return tickets
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:48,代码来源:web_ui.py

示例6: expand_macro

# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import get_changeset [as 别名]
 def expand_macro(self, formatter, name, content, args={}):
     if args:
         reponame = args.get('repository', '')
         rev = args.get('revision')
     else:
         if ',' in content:
             reponame = ''
             rev = 0
             for c in [x.strip() for x in content.split(',')]:
                 if c.isnumeric():
                     rev = c
                 else:
                     reponame = c
         else:
             rev = content.strip()
             reponame = ''
     repos = RepositoryManager(self.env).get_repository(reponame)
     if repos:
         changeset = repos.get_changeset(rev)
         message = changeset.message
         rev = changeset.rev
     else:
         message = content
     if formatter.context.resource.realm == 'ticket':
         ticket_re = CommitTicketUpdater.ticket_re
         if not any(int(tkt_id) == formatter.context.resource.id
                    for tkt_id in ticket_re.findall(message)):
             return tag.div(tag.p(_("(The changeset message doesn't "
                 "reference this ticket)"), class_='hint'),
                 class_='commitmessage')
     if ChangesetModule(self.env).wiki_format_messages:
         return tag.div(format_to_html(self.env,
             formatter.context('changeset', rev, parent=repos.resource),
             message, escape_newlines=True), class_='commitmessage')
     else:
         return tag.pre(message, class_='commitmessage')
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:38,代码来源:web_ui.py


注:本文中的trac.versioncontrol.RepositoryManager.get_changeset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。