tests/test-dispatch.py
changeset 5147 f3f033def181
child 5185 18a9fbb5cd78
equal deleted inserted replaced
5146:ce21f76751f4 5147:f3f033def181
       
     1 import os
       
     2 from mercurial import commands
       
     3 
       
     4 def dispatch(cmd):
       
     5     """Simple wrapper around commands.dispatch()
       
     6 
       
     7     Prints command and result value, but does not handle quoting.
       
     8     """
       
     9     print "running: %s" % (cmd,)
       
    10     result = commands.dispatch(cmd.split())
       
    11     print "result: %r" % (result,)
       
    12 
       
    13 
       
    14 dispatch("init test1")
       
    15 os.chdir('test1')
       
    16 
       
    17 # create file 'foo', add and commit
       
    18 f = file('foo', 'wb')
       
    19 f.write('foo\n')
       
    20 f.close()
       
    21 dispatch("add foo")
       
    22 dispatch("commit -m commit1 -d 2000-01-01 foo")
       
    23 
       
    24 # append to file 'foo' and commit
       
    25 f = file('foo', 'ab')
       
    26 f.write('bar\n')
       
    27 f.close()
       
    28 dispatch("commit -m commit2 -d 2000-01-02 foo")
       
    29 
       
    30 # check 88803a69b24 (fancyopts modified command table)
       
    31 dispatch("log -r 0")
       
    32 dispatch("log -r tip")