开发者

hudson - run tests only when specific branch of code changes

I'm currently using Hudson to build and test python and c++ application, using git as a backend.

I was wondering if there's a good way to set "run test X only if the files 开发者_如何学Gounder the directory /foo/bar/baz has changed".

EDIT: Yes, I know git-hooks exist, but I was wondering how to figure out the delta between the last checked out revision and current revision.


You could use the Git hooks to look through each new commit after a push and determine if the files touched in those commits are a part of your specified directory.

EDIT: You could do something like this:

  1. Get the SHA of the last commit on the server (git rev-parse origin/master)
  2. Get the SHA of the last commit on your local branch (git rev-parse master)
  3. Use the two SHA's to do a 'git diff --name-only SHA1 SHA2' on the server to see if a commit hit your directory.

The --name-only will return only the changed files.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜