~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_uncommit.py

  • Committer: Martin Packman
  • Date: 2012-01-05 09:50:04 UTC
  • mfrom: (6424 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6426.
  • Revision ID: martin.packman@canonical.com-20120105095004-mia9xb7y0efmto0v
Merge bzr.dev to resolve conflicts in bzrlib.builtins

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
from bzrlib.bzrdir import BzrDirMetaFormat1
23
23
from bzrlib.errors import BoundBranchOutOfDate
24
24
from bzrlib.tests import TestCaseWithTransport
 
25
from bzrlib.tests.matchers import ContainsNoVfsCalls
25
26
from bzrlib.tests.script import (
26
27
    run_script,
27
28
    ScriptRunner,
72
73
        $ bzr uncommit
73
74
        ...
74
75
        The above revision(s) will be removed.
75
 
        2>Uncommit these revisions? [y/n]: 
 
76
        2>Uncommit these revisions? ([y]es, [n]o): no
76
77
        <n
77
78
        Canceled
78
79
        """)
119
120
        t_a.commit('commit 3')
120
121
        b = t_a.branch.create_checkout('b').branch
121
122
        uncommit.uncommit(b)
122
 
        self.assertEqual(len(b.revision_history()), 2)
123
 
        self.assertEqual(len(t_a.branch.revision_history()), 2)
 
123
        self.assertEqual(b.last_revision_info()[0], 2)
 
124
        self.assertEqual(t_a.branch.last_revision_info()[0], 2)
124
125
        # update A's tree to not have the uncommitted revision referenced.
125
126
        t_a.update()
126
127
        t_a.commit('commit 3b')
294
295
        tree.branch.tags.set_tag("atag", revid)
295
296
        out, err = self.run_bzr('uncommit --keep-tags --force tree')
296
297
        self.assertEquals({"atag": revid}, tree.branch.tags.get_tag_dict())
 
298
 
 
299
 
 
300
class TestSmartServerUncommit(TestCaseWithTransport):
 
301
 
 
302
    def test_uncommit(self):
 
303
        self.setup_smart_server_with_call_log()
 
304
        t = self.make_branch_and_tree('from')
 
305
        for count in range(2):
 
306
            t.commit(message='commit %d' % count)
 
307
        self.reset_smart_call_log()
 
308
        out, err = self.run_bzr(['uncommit', '--force', self.get_url('from')])
 
309
        # This figure represent the amount of work to perform this use case. It
 
310
        # is entirely ok to reduce this number if a test fails due to rpc_count
 
311
        # being too low. If rpc_count increases, more network roundtrips have
 
312
        # become necessary for this use case. Please do not adjust this number
 
313
        # upwards without agreement from bzr's network support maintainers.
 
314
        self.assertLength(14, self.hpss_calls)
 
315
        self.assertLength(1, self.hpss_connections)
 
316
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)