/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/test_revert.py

  • Committer: Gustav Hartvigsson
  • Date: 2021-01-09 21:36:27 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20210109213627-h1xwcutzy9m7a99b
Added 'Case Preserving Working Tree Use Cases' from Canonical Wiki

* Addod a page from the Canonical Bazaar wiki
  with information on the scmeatics of case
  perserving filesystems an a case insensitive
  filesystem works.
  
  * Needs re-work, but this will do as it is the
    same inforamoton as what was on the linked
    page in the currint documentation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
85
85
 
86
86
    def tree_with_executable(self):
87
87
        tree = self.make_branch_and_tree('tree')
88
 
        tt = transform.TreeTransform(tree)
 
88
        tt = tree.transform()
89
89
        tt.new_file('newfile', tt.root, [b'helooo!'], b'newfile-id', True)
90
90
        tt.apply()
91
91
        with tree.lock_write():
95
95
 
96
96
    def test_preserve_execute(self):
97
97
        tree = self.tree_with_executable()
98
 
        tt = transform.TreeTransform(tree)
 
98
        tt = tree.transform()
99
99
        newfile = tt.trans_id_tree_path('newfile')
100
100
        tt.delete_contents(newfile)
101
101
        tt.create_file([b'Woooorld!'], newfile)
111
111
 
112
112
    def test_revert_executable(self):
113
113
        tree = self.tree_with_executable()
114
 
        tt = transform.TreeTransform(tree)
 
114
        tt = tree.transform()
115
115
        newfile = tt.trans_id_tree_path('newfile')
116
116
        tt.set_executability(False, newfile)
117
117
        tt.apply()
124
124
        tree = self.make_branch_and_tree('.')
125
125
        self.build_tree(['file'])
126
126
        tree.add('file')
127
 
        tree.commit('added file', rev_id=b'rev1')
 
127
        rev1 = tree.commit('added file')
 
128
        with tree.lock_read():
 
129
            file_sha = tree.get_file_sha1('file')
128
130
        os.unlink('file')
129
131
        tree.commit('removed file')
130
132
        self.assertPathDoesNotExist('file')
131
 
        tree.revert(old_tree=tree.branch.repository.revision_tree(b'rev1'))
 
133
        tree.revert(old_tree=tree.branch.repository.revision_tree(rev1))
 
134
        self.assertEqual({'file': file_sha}, tree.merge_modified())
132
135
        self.assertPathExists('file')
133
136
        tree.revert()
134
137
        self.assertPathDoesNotExist('file')
156
159
        tree.add(['file1'])
157
160
        tree.commit('first')
158
161
        tree.set_root_id(b'temp-root-id')
159
 
        self.assertEqual(b'temp-root-id', tree.get_root_id())
 
162
        self.assertEqual(b'temp-root-id', tree.path2id(''))
160
163
        tree.revert()
161
 
        self.assertEqual(b'initial-root-id', tree.get_root_id())
 
164
        self.assertEqual(b'initial-root-id', tree.path2id(''))