def test_cascade_hook_type(self): """If you write a hook for hg and git and they don't have the same hook phase available, you can specify what phase you want for each SCM The following hook will run at the update phase for hg repos and post-applypatch for git repos A hg repo. If both are available the order of the tuple is honored. """ os.environ["HG_NODE"] = "a"*40 parser = inputparser.fromphases((('hg', 'update'), ('git', 'post-applypatch'))) assert(isinstance(parser, hgupdateinputparser)) del os.environ["HG_NODE"] parser = inputparser.fromphases((('hg', 'update'), ('git', 'post-applypatch'))) assert(isinstance(parser, gitpostapplypatchinputparser))
def __init__(self, phase=None, phases=None): self.runlist = [] if phases is not None: self.revdata = inputparser.fromphases(phases).parse() else: self.revdata = inputparser.fromphase(phase).parse()
def test_cascade_hook_notfound(self): os.environ["HG_NODE"] = "a"*40 with self.assertRaises(NotImplementedError): parser = inputparser.fromphases((('hg', 'post-applypatch'), ('git', 'blah')))