diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-01-06 09:46:31 -0500 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-01-07 15:35:15 -0500 |
commit | 05fd374d11fdc3c742efbf1a5c3e192003df234b (patch) | |
tree | 33d2f7cd13a9f82188e0f7dfb551d226ed10a139 /buildstream/plugins/sources/git.py | |
parent | 9be39f79a896f57e1b7649c319b672f3eea9c85c (diff) | |
download | buildstream-05fd374d11fdc3c742efbf1a5c3e192003df234b.tar.gz |
git.py source plugin: Now refresh() returns boolean
Diffstat (limited to 'buildstream/plugins/sources/git.py')
-rw-r--r-- | buildstream/plugins/sources/git.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/buildstream/plugins/sources/git.py b/buildstream/plugins/sources/git.py index cfaa2cdf6..e98e5f284 100644 --- a/buildstream/plugins/sources/git.py +++ b/buildstream/plugins/sources/git.py @@ -253,13 +253,18 @@ class GitSource(Source): def refresh(self, node): # If self.track is not specified it's not an error, just silently return if not self.track: - return + return False - # Update self.mirror.ref and node.ref from the self.track branch self.mirror.ensure() self.mirror.fetch() - node['ref'] = self.mirror.ref = self.mirror.latest_commit(self.track) - self.mirror.assert_ref() + + # Update self.mirror.ref and node.ref from the self.track branch + new_ref = self.mirror.latest_commit(self.track) + changed = False + if self.mirror.ref != new_ref: + changed = True + node['ref'] = self.mirror.ref = new_ref + self.mirror.assert_ref() # After refreshing we may have a new ref, so we need to ensure # that we've cached the desired refs in our mirrors of submodules. @@ -267,6 +272,8 @@ class GitSource(Source): self.refresh_submodules() self.fetch_submodules() + return changed + def fetch(self): # Here we are only interested in ensuring that our mirror contains # the self.mirror.ref commit. |