You can call svnlook dirs-changed
to get changed paths in the committed revision. Pipe this command's output to grep
and search for "branches/b". If the output of the command has "/branches/b", then run the job. Exit, otherwise.
Check this question for the sample code: Post-commit hook failed (exit code 3) with output.