~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Aaron Bentley
  • Date: 2012-07-18 19:55:04 UTC
  • mto: This revision was merged to the branch mainline in revision 6540.
  • Revision ID: aaron@aaronbentley.com-20120718195504-hrl4w190lynohkhd
Cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
1352
1352
                basis_tree.unlock()
1353
1353
        return conflicts
1354
1354
 
 
1355
    @needs_write_lock
1355
1356
    def store_uncommitted(self):
1356
 
        self.lock_write()
 
1357
        """Store uncommitted changes from the tree in the branch."""
 
1358
        target_tree = self.basis_tree()
 
1359
        shelf_creator = shelf.ShelfCreator(self, target_tree)
1357
1360
        try:
1358
 
            target_tree = self.basis_tree()
1359
 
            shelf_creator = shelf.ShelfCreator(self, target_tree)
1360
 
            try:
1361
 
                if not shelf_creator.shelve_all():
1362
 
                    return
1363
 
                self.branch.store_uncommitted(shelf_creator)
1364
 
                shelf_creator.transform()
1365
 
            finally:
1366
 
                shelf_creator.finalize()
 
1361
            if not shelf_creator.shelve_all():
 
1362
                return
 
1363
            self.branch.store_uncommitted(shelf_creator)
 
1364
            shelf_creator.transform()
1367
1365
        finally:
1368
 
            self.unlock()
 
1366
            shelf_creator.finalize()
1369
1367
        note('Uncommitted changes stored in branch "%s".', self.branch.nick)
1370
1368
 
1371
 
    def restore_uncommitted(self, delete=True):
 
1369
    @needs_write_lock
 
1370
    def restore_uncommitted(self):
 
1371
        """Restore uncommitted changes from the branch into the tree."""
1372
1372
        unshelver = self.branch.get_unshelver(self)
1373
1373
        if unshelver is None:
1374
1374
            return