75
76
def __test_loop(self, count):
76
77
self.tree = self.make_branch_and_tree('.')
77
78
self.__create_and_add_test_file()
82
# Modify the test file
83
# write in binary mode because on win32 line-endings should be LF
84
f = file('test_file', 'wb')
85
f.write(self.MODIFIED)
90
new_date = _patch_header_date(self.tree,
91
self.tree.inventory.path2id('test_file'), 'test_file')
94
self.run_bzr('shelve', '--all', retcode=0)
96
# Make sure there is no diff anymore
97
self.assertEqual(self.capture('diff', retcode=0), '')
99
# Make sure the file is actually back the way it was
100
self.assertEqual(file('test_file').read(), self.ORIGINAL)
102
self._check_shelf('00', new_date=new_date)
105
self.run_bzr('unshelve', '--all', retcode=0)
109
# Check the shelved patch was backed up
110
self._check_shelf('00~', new_date=new_date)
112
# Make sure the file is back the way it should be
113
self.assertEqual(file('test_file').read(), self.MODIFIED)
79
self.tree.lock_write()
84
# Modify the test file
85
# write in binary mode because on win32 line-endings should be
87
f = file('test_file', 'wb')
88
f.write(self.MODIFIED)
93
new_date = _patch_header_date(self.tree,
94
self.tree.inventory.path2id('test_file'), 'test_file')
97
self.run_bzr('shelve', '--all', retcode=0)
99
# Make sure there is no diff anymore
100
self.assertEqual(self.capture('diff', retcode=0), '')
102
# Make sure the file is actually back the way it was
103
self.assertEqual(file('test_file').read(), self.ORIGINAL)
105
self._check_shelf('00', new_date=new_date)
108
self.run_bzr('unshelve', '--all', retcode=0)
112
# Check the shelved patch was backed up
113
self._check_shelf('00~', new_date=new_date)
115
# Make sure the file is back the way it should be
116
self.assertEqual(file('test_file').read(), self.MODIFIED)
115
120
def test_shelf_nothing_to_shelve(self):