/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 bzrlib/workingtree_4.py

Get TestExecutable.test_06_pull working on DirState: fix cloning and the set_last_revision api on WorkingTree4.

Show diffs side-by-side

added added

removed removed

Lines of Context:
339
339
            self.branch.repository)
340
340
 
341
341
    @needs_tree_write_lock
 
342
    def set_last_revision(self, new_revision):
 
343
        """Change the last revision in the working tree."""
 
344
        parents = self.get_parent_ids()
 
345
        if new_revision in (NULL_REVISION, None):
 
346
            assert parents == [], (
 
347
                "setting the last parent to none with a pending merge is "
 
348
                "unsupported.")
 
349
            self.set_parent_ids([])
 
350
        else:
 
351
            self.set_parent_ids([new_revision] + parents[1:])
 
352
 
 
353
    @needs_tree_write_lock
342
354
    def set_parent_ids(self, revision_ids, allow_leftmost_as_ghost=False):
343
355
        """Set the parent ids to revision_ids.
344
356
        
393
405
 
394
406
    def _set_root_id(self, file_id):
395
407
        """See WorkingTree.set_root_id."""
396
 
        self.current_dirstate().set_path_id('', file_id)
397
 
        self._dirty = True
 
408
        state = self.current_dirstate()
 
409
        state.set_path_id('', file_id)
 
410
        self._dirty = state._dirblock_state == dirstate.DirState.IN_MEMORY_MODIFIED
398
411
 
399
412
    def unlock(self):
400
413
        """Unlock in format 4 trees needs to write the entire dirstate."""
542
555
            #wt.current_dirstate().set_path_id('', NEWROOT)
543
556
            wt.set_last_revision(revision_id)
544
557
            wt.flush()
545
 
            transform.build_tree(wt.basis_tree(), wt)
 
558
            basis = wt.basis_tree()
 
559
            basis.lock_read()
 
560
            transform.build_tree(basis, wt)
 
561
            basis.unlock()
546
562
        finally:
547
563
            control_files.unlock()
548
564
            wt.unlock()