~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_shelf.py

  • Committer: Vincent Ladeuil
  • Date: 2011-06-27 15:42:09 UTC
  • mfrom: (5993 +trunk)
  • mto: (5993.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 5994.
  • Revision ID: v.ladeuil+lp@free.fr-20110627154209-azubuhbuxsz109hq
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
568
568
        list(creator.iter_shelvable())
569
569
        creator.shelve_deletion('foo-id')
570
570
        creator.shelve_deletion('bar-id')
571
 
        shelf_file = open('shelf', 'w+b')
572
 
        self.addCleanup(shelf_file.close)
573
 
        creator.write_shelf(shelf_file)
574
 
        creator.transform()
575
 
        creator.finalize()
 
571
        with open('shelf', 'w+b') as shelf_file:
 
572
            creator.write_shelf(shelf_file)
 
573
            creator.transform()
 
574
            creator.finalize()
576
575
        # validate the test setup
577
576
        self.assertTrue('foo-id' in tree)
578
577
        self.assertTrue('bar-id' in tree)
579
578
        self.assertFileEqual('baz', 'tree/foo/bar')
580
 
        shelf_file.seek(0)
581
 
        unshelver = shelf.Unshelver.from_tree_and_shelf(tree, shelf_file)
582
 
        self.addCleanup(unshelver.finalize)
583
 
        unshelver.make_merger().do_merge()
 
579
        with open('shelf', 'r+b') as shelf_file:
 
580
            unshelver = shelf.Unshelver.from_tree_and_shelf(tree, shelf_file)
 
581
            self.addCleanup(unshelver.finalize)
 
582
            unshelver.make_merger().do_merge()
584
583
        self.assertFalse('foo-id' in tree)
585
584
        self.assertFalse('bar-id' in tree)
586
585