Example #1
0
    def test_mode_full_clobber_no_existing_db(self):
        self.setup_step(
            mtn.Monotone(repourl='mtn://localhost/monotone',
                         mode='full',
                         method='clobber',
                         branch='master'))

        self.expect_commands(
            ExpectShell(workdir='wkdir',
                        command=['mtn',
                                 '--version']).stdout(self.MTN_VER).exit(0),
            ExpectStat(file='db.mtn', log_environ=True).exit(1),
            ExpectShell(workdir='.',
                        command=['mtn', 'db', 'init', '--db',
                                 'db.mtn']).exit(0),
            ExpectShell(workdir='.',
                        command=[
                            'mtn', 'pull', 'mtn://localhost/monotone?master',
                            '--db', 'db.mtn', '--ticker=dot'
                        ]).exit(0),
            ExpectRmdir(dir='wkdir', log_environ=True).exit(0),
            ExpectShell(workdir='.',
                        command=[
                            'mtn', 'checkout', 'wkdir', '--db', 'db.mtn',
                            '--branch', 'master'
                        ]).exit(0),
            ExpectShell(workdir='wkdir',
                        command=['mtn', 'automate', 'select',
                                 'w:']).stdout(self.REVID).exit(0))
        self.expect_outcome(result=SUCCESS)
        self.expect_property('got_revision', self.REVID, 'Monotone')
        return self.run_step()
Example #2
0
    def test_mode_full_clobber_no_existing_db(self):
        self.setupStep(
            mtn.Monotone(repourl='mtn://localhost/monotone',
                         mode='full',
                         method='clobber',
                         branch='master'))

        self.expectCommands(
            ExpectShell(workdir='wkdir', command=['mtn', '--version']) +
            ExpectShell.log('stdio', stdout=self.MTN_VER) + 0,
            Expect('stat', dict(file='db.mtn', logEnviron=True)) + 1,
            ExpectShell(workdir='.',
                        command=['mtn', 'db', 'init', '--db', 'db.mtn']) + 0,
            ExpectShell(workdir='.',
                        command=[
                            'mtn', 'pull', 'mtn://localhost/monotone?master',
                            '--db', 'db.mtn', '--ticker=dot'
                        ]) + 0,
            Expect('rmdir', dict(dir='wkdir', logEnviron=True)) + 0,
            ExpectShell(workdir='.',
                        command=[
                            'mtn', 'checkout', 'wkdir', '--db', 'db.mtn',
                            '--branch', 'master'
                        ]) + 0,
            ExpectShell(workdir='wkdir',
                        command=['mtn', 'automate', 'select', 'w:']) +
            ExpectShell.log('stdio', stdout=self.REVID) + 0,
        )
        self.expectOutcome(result=SUCCESS)
        self.expectProperty('got_revision', self.REVID, 'Monotone')
        return self.runStep()
Example #3
0
    def test_mode_full_clean_patch_worker_2_16(self):
        self.setup_step(mtn.Monotone(repourl='mtn://localhost/monotone',
                                     mode='full',
                                     method='clean',
                                     branch='master'),
                        patch=(1, 'patch'),
                        worker_version={'*': '2.16'})

        self.expect_commands(
            ExpectShell(workdir='wkdir',
                        command=['mtn',
                                 '--version']).stdout(self.MTN_VER).exit(0),
            ExpectStat(file='db.mtn', log_environ=True).exit(0),
            ExpectShell(workdir='.',
                        command=['mtn', 'db', 'info', '--db',
                                 'db.mtn']).stdout('').exit(0),
            ExpectShell(workdir='.',
                        command=[
                            'mtn', 'pull', 'mtn://localhost/monotone?master',
                            '--db', 'db.mtn', '--ticker=dot'
                        ]).exit(0),
            ExpectStat(file='wkdir/.buildbot-patched',
                       log_environ=True).exit(1),
            ExpectStat(file='wkdir/_MTN', log_environ=True).exit(0),
            ExpectShell(workdir='wkdir',
                        command=['mtn', 'ls',
                                 'unknown']).stdout('file1\nfile2').exit(0),
            ExpectRmdir(dir=['wkdir/file1', 'wkdir/file2'],
                        log_environ=True).exit(0),
            ExpectShell(workdir='wkdir',
                        command=[
                            'mtn', 'update', '--revision', 'h:master',
                            '--branch', 'master'
                        ]).exit(0),
            ExpectDownloadFile(blocksize=32768,
                               maxsize=None,
                               reader=ExpectRemoteRef(
                                   remotetransfer.StringFileReader),
                               slavedest='.buildbot-diff',
                               workdir='wkdir',
                               mode=None).exit(0),
            ExpectDownloadFile(blocksize=32768,
                               maxsize=None,
                               reader=ExpectRemoteRef(
                                   remotetransfer.StringFileReader),
                               slavedest='.buildbot-patched',
                               workdir='wkdir',
                               mode=None).exit(0),
            ExpectShell(workdir='wkdir',
                        command=[
                            'patch', '-p1', '--remove-empty-files', '--force',
                            '--forward', '-i', '.buildbot-diff'
                        ]).exit(0),
            ExpectRmdir(dir='wkdir/.buildbot-diff', log_environ=True).exit(0),
            ExpectShell(workdir='wkdir',
                        command=['mtn', 'automate', 'select',
                                 'w:']).stdout(self.REVID).exit(0))
        self.expect_outcome(result=SUCCESS)
        self.expect_property('got_revision', self.REVID, 'Monotone')
        return self.run_step()
Example #4
0
 def test_incorrect_method(self):
     self.assertRaisesConfigError(
         "Invalid method for mode == full",
         lambda: mtn.Monotone(repourl='mtn://localhost/monotone',
                              mode='full',
                              method='wrongmethod',
                              branch='master'))
Example #5
0
    def test_mode_incremental(self):
        self.setupStep(
            mtn.Monotone(repourl='mtn://localhost/monotone',
                         mode='incremental',
                         branch='master'))

        self.expectCommands(
            ExpectShell(workdir='wkdir', command=['mtn', '--version']) +
            ExpectShell.log('stdio', stdout=self.MTN_VER) + 0,
            Expect('stat', dict(file='db.mtn', logEnviron=True)) + 0,
            ExpectShell(workdir='.',
                        command=['mtn', 'db', 'info', '--db', 'db.mtn']) +
            ExpectShell.log('stdio', stdout='') + 0,
            ExpectShell(workdir='.',
                        command=[
                            'mtn', 'pull', 'mtn://localhost/monotone?master',
                            '--db', 'db.mtn', '--ticker=dot'
                        ]) + 0,
            Expect('stat', dict(file='wkdir/.buildbot-patched',
                                logEnviron=True)) + 1,
            Expect('stat', dict(file='wkdir/_MTN', logEnviron=True)) + 0,
            ExpectShell(workdir='wkdir',
                        command=[
                            'mtn', 'update', '--revision', 'h:master',
                            '--branch', 'master'
                        ]) + 0,
            ExpectShell(workdir='wkdir',
                        command=['mtn', 'automate', 'select', 'w:']) +
            ExpectShell.log('stdio', stdout=self.REVID) + 0,
        )
        self.expectOutcome(result=SUCCESS)
        self.expectProperty('got_revision', self.REVID, 'Monotone')
        return self.runStep()
Example #6
0
 def test_incremental_invalid_method(self):
     self.assertRaisesConfigError(
         "Incremental mode does not require method",
         lambda: mtn.Monotone(repourl='mtn://localhost/monotone',
                              mode='incremental',
                              method='fresh',
                              branch="master"))
Example #7
0
    def test_mode_incremental(self):
        self.setup_step(
            mtn.Monotone(repourl='mtn://localhost/monotone',
                         mode='incremental',
                         branch='master'))

        self.expect_commands(
            ExpectShell(workdir='wkdir',
                        command=['mtn',
                                 '--version']).stdout(self.MTN_VER).exit(0),
            ExpectStat(file='db.mtn', log_environ=True).exit(0),
            ExpectShell(workdir='.',
                        command=['mtn', 'db', 'info', '--db',
                                 'db.mtn']).stdout('').exit(0),
            ExpectShell(workdir='.',
                        command=[
                            'mtn', 'pull', 'mtn://localhost/monotone?master',
                            '--db', 'db.mtn', '--ticker=dot'
                        ]).exit(0),
            ExpectStat(file='wkdir/.buildbot-patched',
                       log_environ=True).exit(1),
            ExpectStat(file='wkdir/_MTN', log_environ=True).exit(0),
            ExpectShell(workdir='wkdir',
                        command=[
                            'mtn', 'update', '--revision', 'h:master',
                            '--branch', 'master'
                        ]).exit(0),
            ExpectShell(workdir='wkdir',
                        command=['mtn', 'automate', 'select',
                                 'w:']).stdout(self.REVID).exit(0))
        self.expect_outcome(result=SUCCESS)
        self.expect_property('got_revision', self.REVID, 'Monotone')
        return self.run_step()
Example #8
0
    def test_mode_full_clean_patch_fail(self):
        self.setupStep(mtn.Monotone(repourl='mtn://localhost/monotone',
                                    mode='full',
                                    method='clean',
                                    branch='master'),
                       patch=(1, 'patch'))

        self.expectCommands(
            ExpectShell(workdir='wkdir', command=['mtn', '--version']) +
            ExpectShell.log('stdio', stdout=self.MTN_VER) + 0,
            Expect('stat', dict(file='db.mtn', logEnviron=True)) + 0,
            ExpectShell(workdir='.',
                        command=['mtn', 'db', 'info', '--db', 'db.mtn']) +
            ExpectShell.log('stdio', stdout='') + 0,
            ExpectShell(workdir='.',
                        command=[
                            'mtn', 'pull', 'mtn://localhost/monotone?master',
                            '--db', 'db.mtn', '--ticker=dot'
                        ]) + 0,
            Expect('stat', dict(file='wkdir/.buildbot-patched',
                                logEnviron=True)) + 1,
            Expect('stat', dict(file='wkdir/_MTN', logEnviron=True)) + 0,
            ExpectShell(workdir='wkdir', command=['mtn', 'ls', 'unknown']) +
            ExpectShell.log('stdio', stdout='file1\nfile2') + 0,
            Expect('rmdir',
                   dict(dir=['wkdir/file1', 'wkdir/file2'], logEnviron=True)) +
            0,
            ExpectShell(workdir='wkdir',
                        command=[
                            'mtn', 'update', '--revision', 'h:master',
                            '--branch', 'master'
                        ]) + 0,
            Expect(
                'downloadFile',
                dict(blocksize=16384,
                     maxsize=None,
                     reader=ExpectRemoteRef(remotetransfer.StringFileReader),
                     workerdest='.buildbot-diff',
                     workdir='wkdir',
                     mode=None)) + 0,
            Expect(
                'downloadFile',
                dict(blocksize=16384,
                     maxsize=None,
                     reader=ExpectRemoteRef(remotetransfer.StringFileReader),
                     workerdest='.buildbot-patched',
                     workdir='wkdir',
                     mode=None)) + 0,
            ExpectShell(workdir='wkdir',
                        command=[
                            'patch', '-p1', '--remove-empty-files', '--force',
                            '--forward', '-i', '.buildbot-diff'
                        ]) + 0,
            Expect('rmdir', dict(dir='wkdir/.buildbot-diff',
                                 logEnviron=True)) + 1,
        )
        self.expectOutcome(result=FAILURE, state_string="update (failure)")
        return self.runStep()
Example #9
0
    def test_mode_incremental_retry(self):
        self.setupStep(
            mtn.Monotone(repourl='mtn://localhost/monotone',
                         mode='incremental',
                         branch='master',
                         retry=(0, 1)))

        self.expectCommands(
            ExpectShell(workdir='wkdir', command=['mtn', '--version']) +
            ExpectShell.log(
                'stdio',
                stdout=
                'monotone 1.0 (base revision: a7c3a1d9de1ba7a62c9dd9efee17252234bb502c)'
            ) + 0,
            ExpectShell(workdir='wkdir',
                        command=['mtn', 'db', 'info', '--db', '../db.mtn']) +
            ExpectShell.log('stdio', stdout='') + 0,
            Expect('stat', dict(file='wkdir/.buildbot-patched',
                                logEnviron=True)) + 1,
            Expect('stat', dict(file='wkdir/_MTN', logEnviron=True)) + 1,
            ExpectShell(workdir='wkdir',
                        command=['mtn', 'db', 'init', '--db', '../db.mtn']) +
            0,
            ExpectShell(workdir='wkdir',
                        command=[
                            'mtn', 'pull', 'mtn://localhost/monotone?master',
                            '--db=../db.mtn', '--ticker=dot'
                        ]) + 1,
            Expect('rmdir', dict(dir='wkdir', logEnviron=True, timeout=1200)) +
            0,
            Expect('rmdir', dict(dir='db.mtn', logEnviron=True,
                                 timeout=1200)) + 0,
            ExpectShell(workdir='wkdir',
                        command=['mtn', 'db', 'init', '--db', '../db.mtn']) +
            0,
            ExpectShell(workdir='wkdir',
                        command=[
                            'mtn', 'pull', 'mtn://localhost/monotone?master',
                            '--db=../db.mtn', '--ticker=dot'
                        ]) + 0,
            ExpectShell(workdir='wkdir',
                        command=[
                            'mtn', 'checkout', '.', '--db=../db.mtn',
                            '--branch', 'master'
                        ]) + 0,
            ExpectShell(workdir='wkdir',
                        command=['mtn', 'automate', 'select', 'w:']) +
            ExpectShell.log(
                'stdio', stdout='95215e2a9a9f8b6f5c9664e3807cd34617ea928c') +
            0,
        )
        self.expectOutcome(result=SUCCESS, status_text=["update"])
        self.expectProperty('got_revision',
                            '95215e2a9a9f8b6f5c9664e3807cd34617ea928c',
                            'Monotone')
        return self.runStep()
Example #10
0
    def test_worker_connection_lost(self):
        self.setup_step(
            mtn.Monotone(repourl='mtn://localhost/monotone',
                         mode='full',
                         method='clean',
                         branch='master'))

        self.expect_commands(
            ExpectShell(workdir='wkdir', command=['mtn', '--version']).stdout(
                self.MTN_VER).error(error.ConnectionLost()))
        self.expect_outcome(result=RETRY, state_string="update (retry)")
        return self.run_step()
Example #11
0
    def test_mode_full_fresh(self):
        self.setupStep(
            mtn.Monotone(repourl='mtn://localhost/monotone',
                         mode='full',
                         method='fresh',
                         branch='master'))

        self.expectCommands(
            ExpectShell(workdir='wkdir', command=['mtn', '--version']) +
            ExpectShell.log(
                'stdio',
                stdout=
                'monotone 1.0 (base revision: a7c3a1d9de1ba7a62c9dd9efee17252234bb502c)'
            ) + 0,
            ExpectShell(workdir='wkdir',
                        command=['mtn', 'db', 'info', '--db', '../db.mtn']) +
            ExpectShell.log('stdio', stdout='') + 0,
            Expect('stat', dict(file='wkdir/.buildbot-patched',
                                logEnviron=True)) + 1,
            Expect('stat', dict(file='wkdir/_MTN', logEnviron=True)) + 0,
            Expect('stat', dict(file='db.mtn', logEnviron=True)) + 0,
            ExpectShell(workdir='wkdir', command=['mtn', 'ls', 'unknown']) +
            ExpectShell.log('stdio', stdout='file1\nfile2') + 0,
            ExpectShell(workdir='wkdir', command=['mtn', 'ls', 'ignored']) +
            ExpectShell.log('stdio', stdout='file3\nfile4') + 0,
            Expect(
                'rmdir',
                dict(dir=[
                    'wkdir/file1', 'wkdir/file2', 'wkdir/file3', 'wkdir/file4'
                ],
                     logEnviron=True)) + 0,
            ExpectShell(workdir='wkdir',
                        command=[
                            'mtn', 'pull', 'mtn://localhost/monotone?master',
                            '--db=../db.mtn', '--ticker=dot'
                        ]) + 0,
            ExpectShell(workdir='wkdir',
                        command=[
                            'mtn', 'update', '--db=../db.mtn', '-r',
                            'h:master', '-b', 'master'
                        ]) + 0,
            ExpectShell(workdir='wkdir',
                        command=['mtn', 'automate', 'select', 'w:']) +
            ExpectShell.log(
                'stdio', stdout='95215e2a9a9f8b6f5c9664e3807cd34617ea928c') +
            0,
        )
        self.expectOutcome(result=SUCCESS, status_text=["update"])
        self.expectProperty('got_revision',
                            '95215e2a9a9f8b6f5c9664e3807cd34617ea928c',
                            'Monotone')
        return self.runStep()
Example #12
0
    def test_slave_connection_lost(self):
        self.setupStep(
            mtn.Monotone(repourl='mtn://localhost/monotone',
                         mode='full',
                         method='clean',
                         branch='master'))

        self.expectCommands(
            ExpectShell(workdir='wkdir', command=['mtn', '--version']) +
            ExpectShell.log('stdio', stdout=self.MTN_VER) +
            ('err', error.ConnectionLost()), )
        self.expectOutcome(result=RETRY, state_string="update (retry)")
        return self.runStep()
Example #13
0
    def test_mode_full_copy(self):
        self.setupStep(
            mtn.Monotone(repourl='mtn://localhost/monotone',
                         mode='full',
                         method='copy',
                         branch='master'))

        self.expectCommands(
            ExpectShell(workdir='wkdir', command=['mtn', '--version']) +
            ExpectShell.log(
                'stdio',
                stdout=
                'monotone 1.0 (base revision: a7c3a1d9de1ba7a62c9dd9efee17252234bb502c)'
            ) + 0,
            ExpectShell(workdir='wkdir',
                        command=['mtn', 'db', 'info', '--db', '../db.mtn']) +
            ExpectShell.log('stdio', stdout='') + 0,
            Expect('stat', dict(file='wkdir/.buildbot-patched',
                                logEnviron=True)) + 1,
            Expect('rmdir', dict(dir='wkdir', logEnviron=True, timeout=1200)) +
            0,
            Expect('stat', dict(file='source/_MTN', logEnviron=True)) + 0,
            Expect('stat', dict(file='db.mtn', logEnviron=True)) + 0,
            ExpectShell(workdir='source',
                        command=[
                            'mtn', 'pull', 'mtn://localhost/monotone?master',
                            '--db=../db.mtn', '--ticker=dot'
                        ]) + 0,
            ExpectShell(workdir='source',
                        command=[
                            'mtn', 'update', '--db=../db.mtn', '-r',
                            'h:master', '-b', 'master'
                        ]) + 0,
            Expect(
                'cpdir', {
                    'fromdir': 'source',
                    'todir': 'build',
                    'logEnviron': True,
                    'timeout': 1200
                }) + 0,
            ExpectShell(workdir='build',
                        command=['mtn', 'automate', 'select', 'w:']) +
            ExpectShell.log(
                'stdio', stdout='95215e2a9a9f8b6f5c9664e3807cd34617ea928c') +
            0,
        )
        self.expectOutcome(result=SUCCESS)
        self.expectProperty('got_revision',
                            '95215e2a9a9f8b6f5c9664e3807cd34617ea928c',
                            'Monotone')
        return self.runStep()
Example #14
0
    def test_database_invalid(self):
        self.setupStep(
            mtn.Monotone(repourl='mtn://localhost/monotone',
                         mode='incremental',
                         branch='master'))

        self.expectCommands(
            ExpectShell(workdir='wkdir', command=['mtn', '--version']) +
            ExpectShell.log('stdio', stdout=self.MTN_VER) + 0,
            Expect('stat', dict(file='db.mtn', logEnviron=True)) + 0,
            ExpectShell(workdir='.',
                        command=['mtn', 'db', 'info', '--db', 'db.mtn']) +
            ExpectShell.log('stdio', stdout='not a monotone database') + 0,
        )
        self.expectOutcome(result=FAILURE)
        return self.runStep()
Example #15
0
    def test_database_invalid(self):
        self.setup_step(
            mtn.Monotone(repourl='mtn://localhost/monotone',
                         mode='incremental',
                         branch='master'))

        self.expect_commands(
            ExpectShell(workdir='wkdir',
                        command=['mtn',
                                 '--version']).stdout(self.MTN_VER).exit(0),
            ExpectStat(file='db.mtn', log_environ=True).exit(0),
            ExpectShell(workdir='.',
                        command=['mtn', 'db', 'info', '--db', 'db.mtn'
                                 ]).stdout('not a monotone database').exit(0))
        self.expect_outcome(result=FAILURE)
        return self.run_step()
Example #16
0
    def test_slave_connection_lost(self):
        self.setupStep(
            mtn.Monotone(repourl='mtn://localhost/monotone',
                         mode='full',
                         method='clean',
                         branch='master'))

        self.expectCommands(
            ExpectShell(workdir='wkdir', command=['mtn', '--version']) +
            ExpectShell.log(
                'stdio',
                stdout=
                'monotone 1.0 (base revision: a7c3a1d9de1ba7a62c9dd9efee17252234bb502c)'
            ) + ('err', error.ConnectionLost()), )
        self.expectOutcome(
            result=RETRY, status_text=["update", "exception", "slave", "lost"])
        return self.runStep()
Example #17
0
    def test_mode_full_no_method(self):
        self.setupStep(
            mtn.Monotone(repourl='mtn://localhost/monotone',
                         mode='full', branch='master'))

        self.expectCommands(
            ExpectShell(workdir='wkdir',
                        command=['mtn', '--version'])
            + ExpectShell.log('stdio', stdout=self.MTN_VER)
            + 0,
            Expect('stat', dict(file='db.mtn',
                                logEnviron=True))
            + 0,
            ExpectShell(workdir='.',
                        command=['mtn', 'db', 'info', '--db', 'db.mtn'])
            + ExpectShell.log('stdio',
                              stdout='')
            + 0,
            ExpectShell(workdir='.',
                        command=['mtn', 'pull',
                                 'mtn://localhost/monotone?master',
                                 '--db', 'db.mtn', '--ticker=dot'])
            + 0,
            Expect('rmdir', dict(dir='wkdir',
                                 logEnviron=True,
                                 timeout=1200))
            + 0,
            Expect('stat', dict(file='source/_MTN',
                                logEnviron=True))
            + 0,
            ExpectShell(workdir='source',
                        command=['mtn', 'update', '--revision', 'h:master',
                                 '--branch', 'master'])
            + 0,
            Expect('cpdir', {'fromdir': 'source', 'todir': 'build',
                             'logEnviron': True, 'timeout': 1200})
            + 0,
            ExpectShell(workdir='build',
                        command=['mtn', 'automate', 'select', 'w:'])
            + ExpectShell.log('stdio', stdout=self.REVID)
            + 0,
        )
        self.expectOutcome(result=SUCCESS)
        self.expectProperty('got_revision', self.REVID, 'Monotone')
        return self.runStep()
Example #18
0
    def test_mode_full_no_method(self):
        self.setup_step(
            mtn.Monotone(repourl='mtn://localhost/monotone',
                         mode='full', branch='master'))

        self.expect_commands(
            ExpectShell(workdir='wkdir',
                        command=['mtn', '--version'])
            .stdout(self.MTN_VER)
            .exit(0),
            ExpectStat(file='db.mtn', log_environ=True)
            .exit(0),
            ExpectShell(workdir='.',
                        command=['mtn', 'db', 'info', '--db', 'db.mtn'])
            .stdout('')
            .exit(0),
            ExpectShell(workdir='.',
                        command=['mtn', 'pull',
                                 'mtn://localhost/monotone?master',
                                 '--db', 'db.mtn', '--ticker=dot'])
            .exit(0),
            ExpectRmdir(dir='wkdir', log_environ=True, timeout=1200)
            .exit(0),
            ExpectStat(file='source/_MTN', log_environ=True)
            .exit(0),
            ExpectShell(workdir='source',
                        command=['mtn', 'update', '--revision', 'h:master',
                                 '--branch', 'master'])
            .exit(0),
            ExpectCpdir(fromdir='source', todir='build', log_environ=True, timeout=1200)
            .exit(0),
            ExpectShell(workdir='build',
                        command=['mtn', 'automate', 'select', 'w:'])
            .stdout(self.REVID)
            .exit(0)
        )
        self.expect_outcome(result=SUCCESS)
        self.expect_property('got_revision', self.REVID, 'Monotone')
        return self.run_step()
Example #19
0
 def test_branch(self):
     self.assertRaisesConfigError(
         "must provide branch", lambda: mtn.Monotone(
             repourl='mtn://localhost/monotone',
             mode="full",
         ))
Example #20
0
 def test_repourl(self):
     self.assertRaisesConfigError(
         "must provide repourl",
         lambda: mtn.Monotone(mode="full", branch="master"))
Example #21
0
    def test_mode_full_clean_patch(self):
        self.setupStep(mtn.Monotone(repourl='mtn://localhost/monotone',
                                    mode='full',
                                    method='clean',
                                    branch='master'),
                       patch=(1, 'patch'))

        self.expectCommands(
            ExpectShell(workdir='wkdir', command=['mtn', '--version']) +
            ExpectShell.log(
                'stdio',
                stdout=
                'monotone 1.0 (base revision: a7c3a1d9de1ba7a62c9dd9efee17252234bb502c)'
            ) + 0,
            ExpectShell(workdir='wkdir',
                        command=['mtn', 'db', 'info', '--db', '../db.mtn']) +
            ExpectShell.log('stdio', stdout='') + 0,
            Expect('stat', dict(file='wkdir/.buildbot-patched',
                                logEnviron=True)) + 1,
            Expect('stat', dict(file='wkdir/_MTN', logEnviron=True)) + 0,
            Expect('stat', dict(file='db.mtn', logEnviron=True)) + 0,
            ExpectShell(workdir='wkdir', command=['mtn', 'ls', 'unknown']) +
            ExpectShell.log('stdio', stdout='file1\nfile2') + 0,
            Expect(
                'rmdir',
                dict(dir=['wkdir/file1', 'wkdir/file2'],
                     logEnviron=True,
                     timeout=1200)) + 0,
            ExpectShell(workdir='wkdir',
                        command=[
                            'mtn', 'pull', 'mtn://localhost/monotone?master',
                            '--db=../db.mtn', '--ticker=dot'
                        ]) + 0,
            ExpectShell(workdir='wkdir',
                        command=[
                            'mtn', 'update', '--db=../db.mtn', '-r',
                            'h:master', '-b', 'master'
                        ]) + 0,
            Expect(
                'downloadFile',
                dict(blocksize=16384,
                     maxsize=None,
                     reader=ExpectRemoteRef(_FileReader),
                     slavedest='.buildbot-diff',
                     workdir='wkdir',
                     mode=None)) + 0,
            Expect(
                'downloadFile',
                dict(blocksize=16384,
                     maxsize=None,
                     reader=ExpectRemoteRef(_FileReader),
                     slavedest='.buildbot-patched',
                     workdir='wkdir',
                     mode=None)) + 0,
            ExpectShell(workdir='wkdir',
                        command=[
                            'patch', '-p1', '--remove-empty-files', '--force',
                            '--forward', '-i', '.buildbot-diff'
                        ]) + 0,
            Expect(
                'rmdir',
                dict(dir='wkdir/.buildbot-diff', logEnviron=True,
                     timeout=1200)) + 0,
            ExpectShell(workdir='wkdir',
                        command=['mtn', 'automate', 'select', 'w:']) +
            ExpectShell.log(
                'stdio', stdout='95215e2a9a9f8b6f5c9664e3807cd34617ea928c') +
            0,
        )
        self.expectOutcome(result=SUCCESS, status_text=["update"])
        self.expectProperty('got_revision',
                            '95215e2a9a9f8b6f5c9664e3807cd34617ea928c',
                            'Monotone')
        return self.runStep()