~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_merger.py

(mbp) tolerate empty limbo and pending-deletion directories (bug 427773)
 (Martin Pool)

Show diffs side-by-side

added added

removed removed

Lines of Context:
175
175
        transform.finalize()
176
176
        return (limbodir, deletiondir)
177
177
 
178
 
    def test_merge_with_existing_limbo(self):
179
 
        wt = self.make_branch_and_tree('this')
180
 
        (limbodir, deletiondir) =  self.get_limbodir_deletiondir(wt)
181
 
        os.mkdir(limbodir)
 
178
    def test_merge_with_existing_limbo_empty(self):
 
179
        """Empty limbo dir is just cleaned up - see bug 427773"""
 
180
        wt = self.make_branch_and_tree('this')
 
181
        (limbodir, deletiondir) =  self.get_limbodir_deletiondir(wt)
 
182
        os.mkdir(limbodir)
 
183
        self.do_merge(wt, wt)
 
184
 
 
185
    def test_merge_with_existing_limbo_non_empty(self):
 
186
        wt = self.make_branch_and_tree('this')
 
187
        (limbodir, deletiondir) =  self.get_limbodir_deletiondir(wt)
 
188
        os.mkdir(limbodir)
 
189
        os.mkdir(os.path.join(limbodir, 'something'))
182
190
        self.assertRaises(errors.ExistingLimbo, self.do_merge, wt, wt)
183
191
        self.assertRaises(errors.LockError, wt.unlock)
184
192
 
185
 
    def test_merge_with_pending_deletion(self):
186
 
        wt = self.make_branch_and_tree('this')
187
 
        (limbodir, deletiondir) =  self.get_limbodir_deletiondir(wt)
188
 
        os.mkdir(deletiondir)
 
193
    def test_merge_with_pending_deletion_empty(self):
 
194
        wt = self.make_branch_and_tree('this')
 
195
        (limbodir, deletiondir) =  self.get_limbodir_deletiondir(wt)
 
196
        os.mkdir(deletiondir)
 
197
        self.do_merge(wt, wt)
 
198
 
 
199
    def test_merge_with_pending_deletion_non_empty(self):
 
200
        """Also see bug 427773"""
 
201
        wt = self.make_branch_and_tree('this')
 
202
        (limbodir, deletiondir) =  self.get_limbodir_deletiondir(wt)
 
203
        os.mkdir(deletiondir)
 
204
        os.mkdir(os.path.join(deletiondir, 'something'))
189
205
        self.assertRaises(errors.ExistingPendingDeletion, self.do_merge, wt, wt)
190
206
        self.assertRaises(errors.LockError, wt.unlock)
191
207