本文整理汇总了Python中rabbitvcs.ui.action.SVNAction.get_result方法的典型用法代码示例。如果您正苦于以下问题:Python SVNAction.get_result方法的具体用法?Python SVNAction.get_result怎么用?Python SVNAction.get_result使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rabbitvcs.ui.action.SVNAction
的用法示例。
在下文中一共展示了SVNAction.get_result方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SVNAnnotate
# 需要导入模块: from rabbitvcs.ui.action import SVNAction [as 别名]
# 或者: from rabbitvcs.ui.action.SVNAction import get_result [as 别名]
class SVNAnnotate(Annotate):
def __init__(self, path, revision=None):
Annotate.__init__(self, path, revision)
self.svn = self.vcs.svn()
if revision is None:
revision = "HEAD"
self.path = path
self.get_widget("from").set_text(str(1))
self.get_widget("to").set_text(str(revision))
self.table = rabbitvcs.ui.widget.Table(
self.get_widget("table"),
[gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING,
gobject.TYPE_STRING, gobject.TYPE_STRING],
[_("Line"), _("Revision"), _("Author"),
_("Date"), _("Text")]
)
self.table.allow_multiple()
self.load()
#
# Helper methods
#
def load(self):
from_rev_num = self.get_widget("from").get_text().lower()
to_rev_num = self.get_widget("to").get_text().lower()
if not from_rev_num.isdigit():
MessageBox(_("The from revision field must be an integer"))
return
from_rev = self.svn.revision("number", number=int(from_rev_num))
to_rev = self.svn.revision("head")
if to_rev_num.isdigit():
to_rev = self.svn.revision("number", number=int(to_rev_num))
self.action = SVNAction(
self.svn,
notification=False
)
self.action.append(
self.svn.annotate,
self.path,
from_rev,
to_rev
)
self.action.append(self.populate_table)
self.action.append(self.enable_saveas)
self.action.start()
@gtk_unsafe
def populate_table(self):
blamedict = self.action.get_result(0)
self.table.clear()
for item in blamedict:
# remove fractional seconds and timezone information from
# the end of the string provided by pysvn:
# * timezone should be always "Z" (for UTC), "%Z" is not yet
# yet supported by strptime
# * fractional could be parsed with "%f" since python 2.6
# but this precision is not needed anyway
# * the datetime module does not include strptime until python 2.4
# so this workaround is required for now
datestr = item["date"][0:-8]
date = datetime(*time.strptime(datestr,"%Y-%m-%dT%H:%M:%S")[:-2])
self.table.append([
item["number"],
item["revision"].number,
item["author"],
rabbitvcs.util.helper.format_datetime(date),
item["line"]
])
def generate_string_from_result(self):
blamedict = self.action.get_result(0)
text = ""
for item in blamedict:
datestr = item["date"][0:-8]
date = datetime(*time.strptime(datestr,"%Y-%m-%dT%H:%M:%S")[:-2])
text += "%s\t%s\t%s\t%s\t%s\n" % (
item["number"],
item["revision"].number,
item["author"],
rabbitvcs.util.helper.format_datetime(date),
item["line"]
)
return text