~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Aaron Bentley
  • Date: 2012-07-13 19:32:33 UTC
  • mto: This revision was merged to the branch mainline in revision 6540.
  • Revision ID: aaron@aaronbentley.com-20120713193233-l6y0l0twwhd3wmka
Switch to much simpler implementation of restore_uncommitted.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1368
1368
            self.unlock()
1369
1369
        note('Uncommitted changes stored in branch "%s".', self.branch.nick)
1370
1370
 
1371
 
    def get_uncommitted_data(self):
1372
 
        base_revision_id, records = self.branch.get_uncommitted_data()
1373
 
        if base_revision_id is None:
1374
 
            return None, None
 
1371
    def restore_uncommitted(self, delete=True):
 
1372
        transform = self.branch._get_uncommitted()
 
1373
        if transform is None:
 
1374
            return
 
1375
        unshelver = shelf.Unshelver.from_tree_and_shelf(self, transform)
1375
1376
        try:
1376
 
            base_tree = self.revision_tree(base_revision_id)
1377
 
        except errors.NoSuchRevisionInTree:
1378
 
            repo = self.branch.repository
1379
 
            base_tree = repo.revision_tree(base_revision_id)
1380
 
        tt = transform.TransformPreview(base_tree)
1381
 
        tt.deserialize(records)
1382
 
        return base_tree, tt
 
1377
            merger = unshelver.make_merger()
 
1378
            merger.ignore_zero = True
 
1379
            merger.do_merge()
 
1380
        finally:
 
1381
            unshelver.finalize()
1383
1382
 
1384
1383
    def revision_tree(self, revision_id):
1385
1384
        """See Tree.revision_tree.