/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/tests/test_shelf_ui.py

  • Committer: Martin Pool
  • Date: 2010-01-08 00:44:26 UTC
  • mto: This revision was merged to the branch mainline in revision 4942.
  • Revision ID: mbp@sourcefrog.net-20100108004426-a0fewwjqe7a9m2bb
Review notes for stable branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008, 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2008 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
18
18
from cStringIO import StringIO
19
19
import os
20
20
import sys
21
 
from textwrap import dedent
22
21
 
23
22
from bzrlib import (
24
23
    errors,
505
504
        self.assertFileEqual(LINES_AJ, 'tree/foo')
506
505
        self.assertEqual(1, tree.get_shelf_manager().last_shelf())
507
506
 
508
 
    def test_unshelve_args_preview(self):
509
 
        tree = self.create_tree_with_shelf()
510
 
        write_diff_to = StringIO()
511
 
        unshelver = shelf_ui.Unshelver.from_args(
512
 
            directory='tree', action='preview', write_diff_to=write_diff_to)
513
 
        try:
514
 
            unshelver.run()
515
 
        finally:
516
 
            unshelver.tree.unlock()
517
 
        # The changes were not unshelved.
518
 
        self.assertFileEqual(LINES_AJ, 'tree/foo')
519
 
        self.assertEqual(1, tree.get_shelf_manager().last_shelf())
520
 
 
521
 
        # But the diff was written to write_diff_to.
522
 
        diff = write_diff_to.getvalue()
523
 
        expected = dedent("""\
524
 
            @@ -1,4 +1,4 @@
525
 
            -a
526
 
            +z
527
 
             b
528
 
             c
529
 
             d
530
 
            @@ -7,4 +7,4 @@
531
 
             g
532
 
             h
533
 
             i
534
 
            -j
535
 
            +y
536
 
 
537
 
            """)
538
 
        self.assertEqualDiff(expected, diff[-len(expected):])
539
 
 
540
507
    def test_unshelve_args_delete_only(self):
541
508
        tree = self.make_branch_and_tree('tree')
542
509
        manager = tree.get_shelf_manager()