From bd697063f357e3c600ed446d0e35ba71baf4c2cb Mon Sep 17 00:00:00 2001
From: Marco Clemencic <marco.clemencic@cern.ch>
Date: Mon, 30 Jan 2017 17:51:42 +0100
Subject: [PATCH] highlight changes between checkouts

call `git show-branch` to show the difference (in commits) between the
current checkout/build and the previous one
---
 python/LbNightlyTools/CheckoutMethods.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/python/LbNightlyTools/CheckoutMethods.py b/python/LbNightlyTools/CheckoutMethods.py
index 8b158fae..2ac0cd50 100644
--- a/python/LbNightlyTools/CheckoutMethods.py
+++ b/python/LbNightlyTools/CheckoutMethods.py
@@ -316,6 +316,14 @@ class GitRepository(object):
         cmd.extend(args)
         return Popen(cmd, cwd=self.path, stdout=PIPE).communicate()[0].strip()
 
+    def show_branch(self, *args):
+        '''
+        Simple wrapper around "git show-branch".
+        '''
+        cmd = ['git', 'show-branch']
+        cmd.extend(args)
+        log_call(cmd, cwd=self.path)
+
 
 class GitMergeHandler(GitRepository):
     '''
@@ -635,6 +643,11 @@ def git(proj, url=None, commit=None, export=False, merges=None):
             commit = 'HEAD'
         repo.tag(tag_name, commit=commit, force=True)
         repo.push_tag(tag_name, remote='lhcb-nightlies', force=True)
+        # report changes between the previous build and this one
+        repo.show_branch('--sha1-name',
+                         '{0}/{1}'.format(proj.slot.name,
+                                          proj.slot.build_id - 1),
+                         tag_name)
     except Exception, x:  # pylint: disable=W0703
         log.warning('failed to record built sources: %s', x)
     return _merge_outputs(outputs)
-- 
GitLab