1083
1083
# Setting uncommitted to None when it is already None is not an error.
1084
1084
branch._put_uncommitted(None)
1086
def test_has_stored_uncommitted(self):
1087
branch = self.make_branch('b')
1088
self.assertFalse(branch.has_stored_uncommitted())
1089
branch._put_uncommitted(StringIO('hello'))
1090
self.assertTrue(branch.has_stored_uncommitted())
1091
branch._put_uncommitted(None)
1092
self.assertFalse(branch.has_stored_uncommitted())
1094
1086
def bind(self, branch, master):
1096
1088
branch.bind(master)
1103
1095
self.bind(branch, master)
1104
1096
return branch, master
1106
def test_has_stored_uncommitted_bound(self):
1107
branch, master = self.make_bound()
1108
self.assertFalse(branch.has_stored_uncommitted())
1109
master._put_uncommitted(StringIO('hello'))
1110
self.assertTrue(branch.has_stored_uncommitted())
1111
master._put_uncommitted(None)
1112
self.assertFalse(branch.has_stored_uncommitted())
1114
1098
def test_store_uncommitted(self):
1115
1099
branch = self.make_branch('b')
1116
1100
creator = FakeShelfCreator()
1117
self.assertFalse(branch.has_stored_uncommitted())
1101
self.assertIs(None, branch.get_unshelver(None))
1118
1102
branch.store_uncommitted(creator)
1119
1103
self.assertEqual('hello', branch._get_uncommitted().read())
1121
1105
def test_store_uncommitted_bound(self):
1122
1106
branch, master = self.make_bound()
1123
1107
creator = FakeShelfCreator()
1124
self.assertFalse(branch.has_stored_uncommitted())
1125
self.assertFalse(master.has_stored_uncommitted())
1108
self.assertIs(None, branch.get_unshelver(None))
1109
self.assertIs(None, master.get_unshelver(None))
1126
1110
branch.store_uncommitted(creator)
1127
1111
self.assertEqual('hello', master._get_uncommitted().read())
1136
1120
branch = self.make_branch('b')
1137
1121
branch._put_uncommitted(StringIO('hello'))
1138
1122
branch.store_uncommitted(None)
1139
self.assertFalse(branch.has_stored_uncommitted())
1123
self.assertIs(None, branch.get_unshelver(None))
1141
1125
def test_get_unshelver(self):
1142
1126
tree = self.make_branch_and_tree('tree')