本文整理汇总了Python中trac.ticket.model.Ticket.get_changelog方法的典型用法代码示例。如果您正苦于以下问题:Python Ticket.get_changelog方法的具体用法?Python Ticket.get_changelog怎么用?Python Ticket.get_changelog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trac.ticket.model.Ticket
的用法示例。
在下文中一共展示了Ticket.get_changelog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_changelog_with_attachment
# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import get_changelog [as 别名]
def test_changelog_with_attachment(self):
"""Verify ordering of attachments and comments in the changelog."""
tkt_id = self._insert_ticket("Test", reporter="joe", component="foo")
ticket = Ticket(self.env, tkt_id)
t1 = datetime(2001, 1, 1, 1, 1, 1, 0, utc)
ticket.save_changes("jane", "Testing", t1)
t2 = datetime(2001, 1, 1, 1, 1, 2, 0, utc)
db = self.env.get_db_cnx()
cursor = db.cursor()
cursor.execute(
"INSERT INTO attachment (type,id,filename,size,time,"
" description,author,ipnr) "
"VALUES ('ticket',%s,'file.txt',1234,%s,"
" 'My file','mark','')",
(str(tkt_id), to_utimestamp(t2)),
)
db.commit()
t3 = datetime(2001, 1, 1, 1, 1, 3, 0, utc)
ticket.save_changes("jim", "Other", t3)
log = ticket.get_changelog()
self.assertEqual(4, len(log))
self.assertEqual((t1, "jane", "comment", "1", "Testing", True), log[0])
self.assertEqual(
[(t2, "mark", "attachment", "", "file.txt", False), (t2, "mark", "comment", "", "My file", False)],
sorted(log[1:3]),
)
self.assertEqual((t3, "jim", "comment", "2", "Other", True), log[3])
示例2: get_changelog
# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import get_changelog [as 别名]
def get_changelog( self , ticketid):
t = Ticket(self.macroenv.tracenv, ticketid)
try:
return( t.get_changelog() )
except:
self.macroenv.tracenv.log.warning("get_changelog failed on ticket %s", ticketid)
return [] # no changelogs
示例3: test_changelog_with_reverted_change
# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import get_changelog [as 别名]
def test_changelog_with_reverted_change(self):
tkt_id = self._insert_ticket("Test", reporter="joe", component="foo")
ticket = Ticket(self.env, tkt_id)
ticket["component"] = "bar"
ticket["component"] = "foo"
now = datetime(2001, 1, 1, 1, 1, 1, 0, utc)
ticket.save_changes("jane", "Testing", now)
self.assertEqual([(now, "jane", "comment", "1", "Testing", True)], list(ticket.get_changelog()))
示例4: test_prop_whitespace_change_is_not_saved
# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import get_changelog [as 别名]
def test_prop_whitespace_change_is_not_saved(self):
ticket = Ticket(self.env)
ticket.populate({'summary': 'ticket summary'})
ticket.insert()
ticket['summary'] = ' ticket summary '
ticket.save_changes()
self.assertEqual(0, len(ticket.get_changelog()))
示例5: test_can_save_ticket_without_explicit_username
# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import get_changelog [as 别名]
def test_can_save_ticket_without_explicit_username(self):
ticket = Ticket(self.env)
ticket.insert()
ticket['summary'] = 'another summary'
ticket.save_changes()
for change in ticket.get_changelog():
self.assertEqual(None, change[1])
示例6: test_changelog_with_reverted_change
# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import get_changelog [as 别名]
def test_changelog_with_reverted_change(self):
tkt_id = self._insert_ticket('Test', reporter='joe', component='foo')
ticket = Ticket(self.env, tkt_id)
ticket['component'] = 'bar'
ticket['component'] = 'foo'
now = datetime(2001, 1, 1, 1, 1, 1, 0, utc)
ticket.save_changes('jane', 'Testing', now)
self.assertEqual([(now, 'jane', 'comment', '1', 'Testing', True)],
list(ticket.get_changelog()))
示例7: test_can_save_ticket_without_explicit_comment
# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import get_changelog [as 别名]
def test_can_save_ticket_without_explicit_comment(self):
ticket = Ticket(self.env)
ticket.insert()
ticket['summary'] = 'another summary'
ticket.save_changes('foo')
changes = ticket.get_changelog()
comment_change = [c for c in changes if c[2] == 'comment'][0]
self.assertEqual('1', comment_change[3])
self.assertEqual('', comment_change[4])
示例8: test_can_save_ticket_without_explicit_comment
# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import get_changelog [as 别名]
def test_can_save_ticket_without_explicit_comment(self):
ticket = Ticket(self.env)
ticket.insert()
ticket["summary"] = "another summary"
ticket.save_changes("foo")
changes = ticket.get_changelog()
comment_change = [c for c in changes if c[2] == "comment"][0]
self.assertEqual("1", comment_change[3])
self.assertEqual("", comment_change[4])
示例9: test_process_commit
# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import get_changelog [as 别名]
def test_process_commit(self):
commits = []
time = self.now
for data in COMMITS:
c = GitHubCommit(self.env, git_url=GIT_URL, **data)
c.time = time
c.save()
commits.append(c)
time = time + 60
# parse commit for the first time (with a clone)
self.ticker_updater.process_commit(commits[0])
tkt1 = Ticket(self.env, 1)
change_log = tkt1.get_changelog()
eq_(1, len(change_log))
eq_('Damien Lebrun <[email protected]>', change_log[0][1])
eq_(
'Commit %(id)s:\n\n%(message)s\n\nSource: [%(url)s]' % COMMITS[0],
change_log[0][4])
# parse same commit (still clone),
# should not update the ticket
self.ticker_updater.process_commit(commits[1])
tkt1 = Ticket(self.env, 1)
change_log = tkt1.get_changelog()
eq_(1, len(change_log))
# parse the commit from the main git repository
# Should update the repository
self.ticker_updater.process_commit(commits[2])
tkt1 = Ticket(self.env, 1)
change_log = tkt1.get_changelog()
eq_(3, len(change_log))
eq_('Damien Lebrun <[email protected]>', change_log[1][1])
eq_(
'Commit %(id)s:\n\n%(message)s\n\nSource: [%(url)s]' % COMMITS[2],
change_log[1][4])
eq_('Damien Lebrun <[email protected]>', change_log[2][1])
eq_('resolution',change_log[2][2])
eq_('fixed',change_log[2][4])
示例10: test_subsecond_change
# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import get_changelog [as 别名]
def test_subsecond_change(self):
"""Perform two ticket changes within a second."""
tkt_id = self._insert_ticket("Test", reporter="joe", component="foo")
ticket = Ticket(self.env, tkt_id)
t1 = datetime(2001, 1, 1, 1, 1, 1, 123456, utc)
ticket.save_changes("jane", "Testing", t1)
t2 = datetime(2001, 1, 1, 1, 1, 1, 123789, utc)
ticket.save_changes("jim", "Other", t2)
log = ticket.get_changelog()
self.assertEqual(2, len(log))
self.assertEqual((t1, "jane", "comment", "1", "Testing", True), log[0])
self.assertEqual((t2, "jim", "comment", "2", "Other", True), log[1])
示例11: testComplexNotification
# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import get_changelog [as 别名]
def testComplexNotification(self):
env = Environment(ENV)
ticket1 = Ticket(env)
ticket1['summary'] = 'Fix please.'
ticket1['status'] = 'new'
ticket1_id = ticket1.insert()
ticket2 = Ticket(env)
ticket2['summary'] = 'This one too, thanks.'
ticket2['status'] = 'new'
ticket2_id = ticket2.insert()
ticket1 = Ticket(env, ticket1_id)
self.assertEqual(ticket1['status'], 'new')
self.assertEqual(ticket1['resolution'], '')
ticket2 = Ticket(env, ticket2_id)
self.assertEqual(ticket2['status'], 'new')
self.assertEqual(ticket2['resolution'], '')
message1 = "Fix #%d: you're welcome." % ticket1_id
self.makeGitCommit(ALTGIT, 'newfile', 'with some new content', message1)
message2 = "See #%d: you bet." % ticket2_id
self.makeGitCommit(ALTGIT, 'newfile', 'with improved content', message2)
self.openGitHubHook(2, 'alt')
ticket1 = Ticket(env, ticket1_id)
self.assertEqual(ticket1['status'], 'closed')
self.assertEqual(ticket1['resolution'], 'fixed')
changelog1 = ticket1.get_changelog()
self.assertEqual(len(changelog1), 4)
self.assertEqual(changelog1[0][2], 'comment')
self.assertIn("you're welcome", changelog1[0][4])
ticket2 = Ticket(env, ticket2_id)
self.assertEqual(ticket2['status'], 'new')
self.assertEqual(ticket2['resolution'], '')
changelog2 = ticket2.get_changelog()
self.assertEqual(len(changelog2), 1)
self.assertEqual(changelog2[0][2], 'comment')
self.assertIn("you bet", changelog2[0][4])
示例12: test_changelog
# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import get_changelog [as 别名]
def test_changelog(self):
tkt_id = self._insert_ticket('Test', reporter='joe', component='foo',
milestone='bar')
ticket = Ticket(self.env, tkt_id)
ticket['component'] = 'bar'
ticket['milestone'] = 'foo'
now = datetime(2001, 1, 1, 1, 1, 1, 0, utc)
ticket.save_changes('jane', 'Testing', now)
changelog = sorted(ticket.get_changelog())
self.assertEqual([(now, 'jane', 'comment', '1', 'Testing', True),
(now, 'jane', 'component', 'foo', 'bar', True),
(now, 'jane', 'milestone', 'bar', 'foo', True)],
changelog)
示例13: _delete_change
# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import get_changelog [as 别名]
def _delete_change(self, id, ts, field=None):
"""Delete the change on the given ticket at the given timestamp."""
db = self.env.get_db_cnx()
cursor = db.cursor()
ticket = Ticket(self.env,id)
if field:
if field == 'attachment':
pass # Better handling still pending
else:
custom_fields = [f['name'] for f in ticket.fields if f.get('custom')]
if field != "comment" and not [1 for time, author, field2, oldval, newval, _ in ticket.get_changelog() if time > ts and field == field2]:
oldval = [old for _, _, field2, old, _, _ in ticket.get_changelog(ts) if field2 == field][0]
if field in custom_fields:
cursor.execute("UPDATE ticket_custom SET value=%s WHERE ticket=%s AND name=%s", (oldval, id, field))
else:
cursor.execute("UPDATE ticket SET %s=%%s WHERE id=%%s" % field, (oldval, id))
cursor.execute("DELETE FROM ticket_change WHERE ticket = %s AND time = %s AND field = %s", (id, ts, field))
else:
for _, _, field, _, _, _ in ticket.get_changelog(ts):
self._delete_change(id, ts, field)
db.commit()
示例14: test_changelog_with_reverted_change
# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import get_changelog [as 别名]
def test_changelog_with_reverted_change(self):
tkt_id = self._insert_ticket('Test', reporter='joe', component='foo')
ticket = Ticket(self.env, tkt_id)
ticket['component'] = 'bar'
ticket['component'] = 'foo'
ticket.save_changes('jane', 'Testing', when=42)
for t, author, field, old, new, permanent in ticket.get_changelog():
self.assertEqual((42, 'jane', True), (t, author, permanent))
if field == 'comment':
self.assertEqual(('', 'Testing'), (old, new))
else:
self.fail('Unexpected change (%s)'
% ((t, author, field, old, new),))
示例15: test_changelog
# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import get_changelog [as 别名]
def test_changelog(self):
tkt_id = self._insert_ticket("Test", reporter="joe", component="foo", milestone="bar")
ticket = Ticket(self.env, tkt_id)
ticket["component"] = "bar"
ticket["milestone"] = "foo"
now = datetime(2001, 1, 1, 1, 1, 1, 0, utc)
ticket.save_changes("jane", "Testing", now)
changelog = sorted(ticket.get_changelog())
self.assertEqual(
[
(now, "jane", "comment", "1", "Testing", True),
(now, "jane", "component", "foo", "bar", True),
(now, "jane", "milestone", "bar", "foo", True),
],
changelog,
)