1
# Copyright (C) 2005-2010 Canonical Ltd
1
# Copyright (C) 2005-2011 Canonical Ltd
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
251
252
wt.commit(message='add file1 and file2')
252
253
self.run_bzr('branch parent child')
253
254
os.unlink('child/file1')
254
file('child/file2', 'wb').write('hello\n')
255
with file('child/file2', 'wb') as f: f.write('hello\n')
255
256
self.run_bzr(['commit', '-m', 'remove file1 and modify file2',
257
258
os.chdir('parent')
282
283
self.checkDelta(logentry.delta, added=['file1', 'file2'])
286
class TestFormatSignatureValidity(tests.TestCaseWithTransport):
287
class UTFLoopbackGPGStrategy(gpg.LoopbackGPGStrategy):
288
def verify(self, content, testament):
289
return (gpg.SIGNATURE_VALID,
290
u'UTF8 Test \xa1\xb1\xc1\xd1\xe1\xf1 <jrandom@example.com>')
292
def has_signature_for_revision_id(self, revision_id):
295
def get_signature_text(self, revision_id):
298
def test_format_signature_validity_utf(self):
299
"""Check that GPG signatures containing UTF-8 names are formatted
301
# Monkey patch to use our UTF-8 generating GPGStrategy
302
self.overrideAttr(gpg, 'GPGStrategy', self.UTFLoopbackGPGStrategy)
303
wt = self.make_branch_and_tree('.')
304
revid = wt.commit('empty commit')
305
repo = wt.branch.repository
306
# Monkey patch out checking if this rev is actually signed, since we
307
# can't sign it without a heavier TestCase and LoopbackGPGStrategy
308
# doesn't care anyways.
309
self.overrideAttr(repo, 'has_signature_for_revision_id',
310
self.has_signature_for_revision_id)
311
self.overrideAttr(repo, 'get_signature_text', self.get_signature_text)
312
out = log.format_signature_validity(revid, repo)
314
u'valid signature from UTF8 Test \xa1\xb1\xc1\xd1\xe1\xf1 <jrandom@example.com>',
285
318
class TestShortLogFormatter(TestCaseForLogFormatter):
287
320
def test_trailing_newlines(self):
1310
1343
class TestLogWithBugs(TestCaseForLogFormatter, TestLogMixin):
1312
1345
def setUp(self):
1313
TestCaseForLogFormatter.setUp(self)
1346
super(TestLogWithBugs, self).setUp()
1314
1347
log.properties_handler_registry.register(
1315
1348
'bugs_properties_handler',
1316
1349
log._bugs_properties_handler)
1390
1423
class TestLogForAuthors(TestCaseForLogFormatter):
1392
1425
def setUp(self):
1393
TestCaseForLogFormatter.setUp(self)
1426
super(TestLogForAuthors, self).setUp()
1394
1427
self.wt = self.make_standard_commit('nicky',
1395
1428
authors=['John Doe <jdoe@example.com>',
1396
1429
'Jane Rey <jrey@example.com>'])
1570
1603
def assertLogRevnos(self, expected_revnos, b, start, end,
1571
1604
exclude_common_ancestry, generate_merge_revisions=True):
1572
1605
# FIXME: the layering in log makes it hard to test intermediate levels,
1573
# I wish adding filters with their parameters were easier...
1606
# I wish adding filters with their parameters was easier...
1574
1607
# -- vila 20100413
1575
1608
iter_revs = log._calc_view_revisions(
1576
1609
b, start, end, direction='reverse',