Fix branch detection in prepare-gerrit-repos

This corrects two bugs:

1) We need to detect the branch of Gerrit that is being checked out
in order to determine whether each submodule has that branch.  We were
using "zuul.branch" which is the branch of the change being tested,
but that only works for branched source code repos.  It doesn't work
for jobs in unbranched repos like zuul/jobs.  To allow this to run
there, let's just directly check the branch of Gerrit that is checked

2) A logic error caused the repo_has_dependent_change fact to search
for dependent changes that matched the repo of the change under test,
but we actually need to search for changes for the repo we're checking

Change-Id: I4e09c6c8ba752ae1af2907a20153d21d9f769e1c
3 files changed
tree: c4cb9b2cf167156145a1df8549f25238875d035b
  1. .gitreview
  4. playbooks/
  5. roles/
  6. zuul.d/