1
# Copyright (C) 2005-2010 Canonical Ltd
1
# Copyright (C) 2005-2012, 2016 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
188
188
wt2.merge_from_branch(wt.branch)
189
189
message = self.status_string(wt2, verbose=True)
190
190
self.assertStartsWith(message, "pending merges:\n")
191
self.assert_("Empty commit 3" in message)
191
self.assertTrue("Empty commit 3" in message)
192
192
self.assertEndsWith(message, "...\n")
194
194
def test_tree_status_ignores(self):
249
249
show_tree_status(wt, specific_files=['directory'], to_file=tof)
251
self.assertEquals(tof.readlines(),
251
self.assertEqual(tof.readlines(),
253
253
' directory/hello.c\n'
256
256
show_tree_status(wt, specific_files=['directory'], to_file=tof,
259
self.assertEquals(tof.readlines(), ['? directory/hello.c\n'])
259
self.assertEqual(tof.readlines(), ['? directory/hello.c\n'])
262
262
show_tree_status(wt, specific_files=['dir2'], to_file=tof)
264
self.assertEquals(tof.readlines(),
264
self.assertEqual(tof.readlines(),
269
269
show_tree_status(wt, specific_files=['dir2'], to_file=tof, short=True)
271
self.assertEquals(tof.readlines(), ['? dir2/\n'])
271
self.assertEqual(tof.readlines(), ['? dir2/\n'])
274
274
revs = [RevisionSpec.from_string('0'), RevisionSpec.from_string('1')]
275
275
show_tree_status(wt, specific_files=['test.c'], to_file=tof,
276
276
short=True, revision=revs)
278
self.assertEquals(tof.readlines(), ['+N test.c\n'])
278
self.assertEqual(tof.readlines(), ['+N test.c\n'])
281
281
show_tree_status(wt, specific_files=['missing.c'], to_file=tof)
283
self.assertEquals(tof.readlines(),
283
self.assertEqual(tof.readlines(),
288
288
show_tree_status(wt, specific_files=['missing.c'], to_file=tof,
291
self.assertEquals(tof.readlines(),
291
self.assertEqual(tof.readlines(),
292
292
['+! missing.c\n'])
294
294
def test_specific_files_conflicts(self):
627
627
self.assertContainsRe(result, "added:\n hello.txt\n" \
628
628
"unknown:\n world.txt\n")
629
629
result2 = self.run_bzr("status -r 0..")[0]
630
self.assertEquals(result2, result)
630
self.assertEqual(result2, result)
632
632
def test_status_short(self):
633
633
tree = self.make_branch_and_tree('.')
649
649
self.assertContainsRe(result, "[+]N hello.txt\n" \
650
650
"[?] world.txt\n")
651
651
result2 = self.run_bzr("status -S -r 0..")[0]
652
self.assertEquals(result2, result)
652
self.assertEqual(result2, result)
654
654
def test_status_versioned(self):
655
655
tree = self.make_branch_and_tree('.')
671
671
self.assertContainsRe(result, "added:\n hello.txt\n")
672
672
self.assertNotContainsRe(result, "unknown:\n world.txt\n")
673
673
result2 = self.run_bzr("status --versioned -r 0..")[0]
674
self.assertEquals(result2, result)
674
self.assertEqual(result2, result)
676
676
def test_status_SV(self):
677
677
tree = self.make_branch_and_tree('.')
693
693
self.assertContainsRe(result, "[+]N hello.txt\n")
695
695
result2 = self.run_bzr("status -SV -r 0..")[0]
696
self.assertEquals(result2, result)
696
self.assertEqual(result2, result)
698
698
def assertStatusContains(self, pattern, short=False):
699
699
"""Run status, and assert it contains the given pattern"""
750
750
self.run_bzr('merge ../b', working_dir='a')
751
751
out, err = self.run_bzr('status --no-pending', working_dir='a')
752
self.assertEquals(out, "added:\n b\n")
752
self.assertEqual(out, "added:\n b\n")
754
754
def test_pending_specific_files(self):
755
755
"""With a specific file list, pending merges are not shown."""
787
787
working_tree = self.make_uncommitted_tree()
788
788
stdout, stderr = self.run_bzr("status")
790
self.assertEquals(stdout, """\
790
self.assertEqual(stdout, """\
797
797
working_tree = self.make_uncommitted_tree()
798
798
stdout, stderr = self.run_bzr('status')
800
self.assertEquals(stdout, u"""\
800
self.assertEqual(stdout, u"""\
803
803
""".encode('latin-1'))