65
65
reporter.report(file_id, (old_path, path), versioned_change, renamed,
66
66
modified, exe_change, kind)
67
67
if expected_lines is not None:
68
self.assertEqualDiff('\n'.join(expected_lines), '\n'.join(result))
68
for i in range(len(expected_lines)):
69
self.assertEqualDiff(expected_lines[i], result[i])
70
71
self.assertEqual([], result)
122
123
renamed=False, modified='created', exe_change=False,
123
124
kind=(None, 'file'), unversioned_filter=lambda x:True)
125
def test_missing(self):
126
self.assertReport('+! missing.c', file_id=None, path='missing.c',
127
old_path=None, versioned_change='added',
128
renamed=False, modified='missing', exe_change=False,
131
126
def test_view_filtering(self):
132
127
# If a file in within the view, it should appear in the output
133
128
expected_lines = [
285
280
('branch/f2', '2\n'),
286
281
('branch/f3', '3\n'),
287
282
('branch/f4', '4\n'),
288
('branch/f5', '5\n'),
289
283
('branch/dir/',),
291
285
wt.add(['f1', 'f2', 'f3', 'f4', 'dir'],
292
286
['f1-id', 'f2-id', 'f3-id', 'f4-id', 'dir-id'])
293
287
wt.commit('commit one', rev_id='1')
295
# TODO add rename,removed,etc. here?
297
os.unlink('branch/f5')
299
289
long_status = """added:
308
296
short_status = """A dir/
316
303
repo = wt.branch.repository
320
307
def test_delta_show_short_status_no_filter(self):
321
308
d, long_status, short_status = self._get_delta()
323
_mod_delta.report_delta(out, d, short_status=True)
324
self.assertEqual(short_status, out.getvalue())
310
d.show(out, short_status=True)
311
self.assertEquals(short_status, out.getvalue())
326
313
def test_delta_show_long_status_no_filter(self):
327
314
d, long_status, short_status = self._get_delta()
329
_mod_delta.report_delta(out, d, short_status=False)
330
self.assertEqual(long_status, out.getvalue())
316
d.show(out, short_status=False)
317
self.assertEquals(long_status, out.getvalue())
332
319
def test_delta_show_no_filter(self):
333
320
d, long_status, short_status = self._get_delta()
335
322
def not_a_filter(path, file_id):
337
_mod_delta.report_delta(out, d, short_status=True, filter=not_a_filter)
338
self.assertEqual(short_status, out.getvalue())
324
d.show(out, short_status=True, filter=not_a_filter)
325
self.assertEquals(short_status, out.getvalue())
340
327
def test_delta_show_short_status_single_file_filter(self):
341
328
d, long_status, short_status = self._get_delta()
343
330
def only_f2(path, file_id):
344
331
return path == 'f2'
345
_mod_delta.report_delta(out, d, short_status=True, filter=only_f2)
346
self.assertEqual("A f2\n", out.getvalue())
332
d.show(out, short_status=True, filter=only_f2)
333
self.assertEquals("A f2\n", out.getvalue())
348
335
def test_delta_show_long_status_single_file_filter(self):
349
336
d, long_status, short_status = self._get_delta()
351
338
def only_f2(path, file_id):
352
339
return path == 'f2'
353
_mod_delta.report_delta(out, d, short_status=False, filter=only_f2)
354
self.assertEqual("added:\n f2\n", out.getvalue())
340
d.show(out, short_status=False, filter=only_f2)
341
self.assertEquals("added:\n f2\n", out.getvalue())
356
343
def test_delta_show_short_status_single_file_id_filter(self):
357
344
d, long_status, short_status = self._get_delta()
359
346
def only_f2_id(path, file_id):
360
347
return file_id == 'f2-id'
361
_mod_delta.report_delta(out, d, short_status=True, filter=only_f2_id)
362
self.assertEqual("A f2\n", out.getvalue())
348
d.show(out, short_status=True, filter=only_f2_id)
349
self.assertEquals("A f2\n", out.getvalue())