view tests/test-dispatch.py @ 23970:8a544fb645bb stable

rebase: ensure rebase revision remains visible (issue4504) Before this changeset rebase was getting very confused if any revision in the rebase set became hidden. This was fairly easy to achieve if a rebased revision was made visible by the working copy location. The rebase process would update somewhere else and the revision would become hidden. To work around this issue, we ensure rebased revisions remain visible for the whole process. This is a simple change suitable for stable. More subtle usage of unfiltered repository in rebase may solve this issue more cleanly.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 27 Jan 2015 12:33:56 +0000
parents 08bfec2ef031
children 06245740b408
line wrap: on
line source

import os
from mercurial import dispatch

def testdispatch(cmd):
    """Simple wrapper around dispatch.dispatch()

    Prints command and result value, but does not handle quoting.
    """
    print "running: %s" % (cmd,)
    req = dispatch.request(cmd.split())
    result = dispatch.dispatch(req)
    print "result: %r" % (result,)


testdispatch("init test1")
os.chdir('test1')

# create file 'foo', add and commit
f = open('foo', 'wb')
f.write('foo\n')
f.close()
testdispatch("add foo")
testdispatch("commit -m commit1 -d 2000-01-01 foo")

# append to file 'foo' and commit
f = open('foo', 'ab')
f.write('bar\n')
f.close()
testdispatch("commit -m commit2 -d 2000-01-02 foo")

# check 88803a69b24 (fancyopts modified command table)
testdispatch("log -r 0")
testdispatch("log -r tip")