示例#1
0
    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))
示例#2
0
文件: hooklib.py 项目: aflp91/hooklib
 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()
示例#3
0
 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()
示例#4
0
 def test_cascade_hook_notfound(self):
     os.environ["HG_NODE"] = "a"*40
     with self.assertRaises(NotImplementedError):
         parser = inputparser.fromphases((('hg', 'post-applypatch'),
                                          ('git', 'blah')))