~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/script.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-12-14 18:03:42 UTC
  • mfrom: (4871.4.2 admin-guide-upgrade)
  • Revision ID: pqm@pqm.ubuntu.com-20091214180342-nk22cwvqcz54e331
(nmb) Add upgrade section to admin-guide

Show diffs side-by-side

added added

removed removed

Lines of Context:
402
402
            retcode = 0
403
403
        return retcode, None, err
404
404
 
405
 
    def do_mv(self, test_case, input, args):
406
 
        err = None
407
 
        def error(msg, src, dst):
408
 
            return "mv: cannot move %s to %s: %s\n" % (src, dst, msg)
409
 
 
410
 
        if not args or len(args) != 2:
411
 
            raise SyntaxError("Usage: mv path1 path2")
412
 
        src, dst = args
413
 
        try:
414
 
            real_dst = dst
415
 
            if os.path.isdir(dst):
416
 
                real_dst = os.path.join(dst, os.path.basename(src))
417
 
            os.rename(src, real_dst)
418
 
        except OSError, e:
419
 
            if e.errno == errno.ENOENT:
420
 
                err = error('No such file or directory', src, dst)
421
 
            else:
422
 
                raise
423
 
        if err:
424
 
            retcode = 1
425
 
        else:
426
 
            retcode = 0
427
 
        return retcode, None, err
428
 
 
429
 
 
430
405
 
431
406
class TestCaseWithMemoryTransportAndScript(tests.TestCaseWithMemoryTransport):
432
407
    """Helper class to experiment shell-like test and memory fs.