From patchwork Thu Sep 29 09:41:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 16210 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 3001238EB; Thu, 29 Sep 2016 11:42:09 +0200 (CEST) Received: from mail-wm0-f50.google.com (mail-wm0-f50.google.com [74.125.82.50]) by dpdk.org (Postfix) with ESMTP id 56750378E for ; Thu, 29 Sep 2016 11:42:07 +0200 (CEST) Received: by mail-wm0-f50.google.com with SMTP id 197so4912070wmk.1 for ; Thu, 29 Sep 2016 02:42:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=63T9IniFM+Y9yKxr+fdhSDxnFFxcRxFOU9b7VpupckQ=; b=r4WGwfrQIrMtC4KoZUVw07bcw+NJrZogYotOGa5P1jzLu4MMjlUu+STKnfJq0WnBX/ yiSmthufOiZ5qB7O4xMs2okwsZEWRBtYQaLJW0oyziP7JHSUXaJBGz0XOCKUq4TdW3S6 kFAJqsnuyqR9aagAHhdZ2C5EaFPR3RMUbd/pup4ozlGA+5dvw++ObQfuHoz+bFgHcxmX vwlkTi8h6XTyBIV61mVOYH1/f589FrMyO1Yio3FbwzGQ+x0V0bt5BiNW06H8029PAV98 fy1nw+JuFW2Dypgz5L5BGk478bwxiejsEXeJVAxsqYgwTyaxZ4eAEqTHirQnFtFiOKCs 3qtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=63T9IniFM+Y9yKxr+fdhSDxnFFxcRxFOU9b7VpupckQ=; b=PVFqOMQaT5C5YYS/miSQAKtYKK5sQU88OUp+36r6x+tw/+OOsK6TibpxRVuUJXVJfw U+TBAddt6FDLAHCCCDGXiRwX2cli+EHlcn2mZkCTFh2jRqbUSN3Gia+lWASbVZHcn40N MgslSp7h9nh15XkNT8UOYZs1PecB2nW++rK9ZmXLsFyOkERsuBWQROsFPYiMkw//s1fY KQFwdbno0oE4GLvJLKbmb6HnxLBBKtQwAFGmX2fOJrW8pBJ1kXGYGPfIR5V/oc5sSVdh zdbDdt/7gMnx4FdOdXK+tM9/0XeGzQXn0/BWrY94079Lf3JxyFawS3GrMAvuPOFp3/IE SqiQ== X-Gm-Message-State: AA6/9RmrrtsmDOW4Ck0CN0Z8dVlzDsAWg831K6k+I1qeau9nyJZCTtWulnhIcODIN0xUsuUl X-Received: by 10.28.223.67 with SMTP id w64mr1780427wmg.84.1475142127066; Thu, 29 Sep 2016 02:42:07 -0700 (PDT) Received: from XPS13.localdomain (184.203.134.77.rev.sfr.net. [77.134.203.184]) by smtp.gmail.com with ESMTPSA id u72sm13581314wmu.10.2016.09.29.02.42.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Sep 2016 02:42:06 -0700 (PDT) From: Thomas Monjalon To: dev@dpdk.org Cc: Yuanhan Liu Date: Thu, 29 Sep 2016 11:41:50 +0200 Message-Id: <1475142110-8294-1-git-send-email-thomas.monjalon@6wind.com> X-Mailer: git-send-email 2.7.0 Subject: [dpdk-dev] [PATCH] scripts: show fixes with release version of bug X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This script can help to find commits to backport in stable branches. Fixes are found if there is the word "fix" in the headline or if there is a tag Fixes: or Reverts: in the message. Chained fixes of fixes are explored to find the oldest origin. Fixes of not released bugs are ignored. Signed-off-by: Thomas Monjalon --- scripts/git-log-fixes.sh | 63 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100755 scripts/git-log-fixes.sh diff --git a/scripts/git-log-fixes.sh b/scripts/git-log-fixes.sh new file mode 100755 index 0000000..cb7ed2e --- /dev/null +++ b/scripts/git-log-fixes.sh @@ -0,0 +1,63 @@ +#! /bin/sh -e + +if [ $# -lt 1 ] ; then + echo 'range argument required' >&2 + exit 1 +fi +range="$*" + +# get major release version of a commit +commit_version () # +{ + tag=$(git tag -l --contains $1 | head -n1) + if [ -z "$tag" ] ; then + # before -rc1 tag of release in progress + make showversion | cut -d'.' -f-2 + else + echo $tag | sed 's,^v,,' | sed 's,-rc.*,,' + fi +} + +# get bug origin hashes of a fix +origin_filter () # +{ + git log --format='%b' -1 $1 | + sed -n 's,^ *\([Ff]ixes\|[Rr]everts\): *\([0-9a-f]*\).*,\2,p' +} + +# get oldest major release version of bug origins +origin_version () # ... +{ + for origin in $* ; do + # check hash is valid + git rev-parse -q --verify $1 >&- || continue + # get version of this bug origin + local origver=$(commit_version $origin) + local roothashes=$(origin_filter $origin) + if [ -n "$roothashes" ] ; then + # look chained fix of fix recursively + local rootver="$(origin_version $roothashes)" + [ -n "$rootver" ] || continue + echo "$rootver (partially fixed in $origver)" + else + echo "$origver" + fi + # filter the oldest origin + done | sort -uV | head -n1 +} + +git log --oneline --reverse $range | +while read id headline ; do + origins=$(origin_filter $id) + [ -n "$origins" ] || echo "$headline" | grep -q fix || continue + version=$(commit_version $id) + if [ -n "$origins" ] ; then + origver="$(origin_version $origins)" + [ -n "$origver" ] || continue + # ignore fix of bug introduced in the same release + ! echo "$origver" | grep -q "^$version" || continue + else + origver='N/A' + fi + printf '%s %7s %s (%s)\n' $version $id "$headline" "$origver" +done