All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe-Gsx/Oe8HsFggBc27wqDAHg@public.gmane.org>
To: Daniel Vetter <daniel-/w4YWyX8dFk@public.gmane.org>,
	Christophe LEROY <christophe.leroy-GgN8y9CXRhA@public.gmane.org>
Cc: daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org,
	narmstrong-rdvid1DuHRBWk0Htik3J/w@public.gmane.org,
	airlied-cv59FeDIM0c@public.gmane.org,
	benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org,
	linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	Alexey.Brodkin-HKixBCOQz3hWk0Htik3J/w@public.gmane.org,
	will.deacon-5wv7dgnIgG8@public.gmane.org,
	fbarrat-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org,
	kernel list
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	paulus-mnsaURCQ41sdnm+yROfE0A@public.gmane.org,
	yamada.masahiro-uWyLwvC0a2jby3iVrkZq2A@public.gmane.org,
	mhocko-IBi9RG/b67k@public.gmane.org,
	viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	Pavel Machek <pavel-+ZI9xUNit7I@public.gmane.org>,
	hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org,
	JinHuiEric.Huang-5C7GfCeVMHo@public.gmane.org,
	Rex.Zhu-5C7GfCeVMHo@public.gmane.org,
	elfring-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	scott.bauer-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	David1.Zhou-5C7GfCeVMHo@public.gmane.org,
	architt-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org,
	x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	Wenjing.Liu-5C7GfCeVMHo@public.gmane.org,
	linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	Ding.Wang-5C7GfCeVMHo@public.gmane.org,
	aik-sLpHqDYs0B2HXe+LvDLADg@public.gmane.org,
	wens-jdAy2FN1RRM@public.gmane.org,
	mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	vbabka-AlSwsSmVLrQ@public.gmane.org,
	catalin.marinas-5wv7dgnIgG8@public.gmane.org,
	airlied-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	ruscur-3Su/lFKaw5ejKv3TNrM5DQ@public.gmane.org,
	shli-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org, andresx7@
Subject: Re: [PATCH] fix double ;;s in code
Date: Tue, 20 Feb 2018 17:19:31 +1100	[thread overview]
Message-ID: <87vaesrxn0.fsf@concordia.ellerman.id.au> (raw)
In-Reply-To: <20180219154135.GV22199-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>

Daniel Vetter <daniel@ffwll.ch> writes:
> On Sun, Feb 18, 2018 at 11:00:56AM +0100, Christophe LEROY wrote:
>> Le 17/02/2018 à 22:19, Pavel Machek a écrit :
>> > 
>> > Fix double ;;'s in code.
>> > 
>> > Signed-off-by: Pavel Machek <pavel@ucw.cz>
>> 
>> A summary of the files modified on top of the patch would help understand
>> the impact.
>> 
>> A maybe there should be one patch by area, eg one for each arch specific
>> modif and one for drivers/ and one for block/ ?
>
> Yeah, pls split this into one patch per area, with a suitable patch
> subject prefix. Look at git log of each file to get a feeling for what's
> the standard in each area.

This part is actually pretty annoying.

I hacked up a script (below) which seems to do a reasonable job in most
cases.

For this patch it gives:

  $ for f in $(git ls-files -m); do ./guess-prefix.py $f; done
  ARC: 
  ARC: 
  ARM: 
  arm64: ptrace: 
  KVM: PPC: 
  powerpc/powernv:
  x86/efi:
  block/sed-opal:
  clocksource: mips-gic: 
  clocksource/drivers/sun5i:
  drm/amd/display:
  drm/amd/powerplay:
  drm/msm/mdp5:
  drm: 
  iommu/vt-d:
  md: 
  soc: imx: gpc: 

I think those are correct except for:
 - "drm:" for "drivers/gpu/drm/scheduler" which has only a single commit.
 - "md:" for "drivers/md/raid1.c" which is tricked by inconsistent
    usage of "md: raid1:" and "md/raid1:".

But that seems like a reasonable hit rate.

Another approach would be to have a file that defines for each subsystem
what the preferred style is, but that is likely to be a PITA to
maintain.

cheers


#!/usr/bin/python3

import sys
import re
from subprocess import check_output
from collections import Counter

if len(sys.argv) != 2:
    print('Usage: %s <path>' % sys.argv[0], file=sys.stderr)
    sys.exit(1)

fname = sys.argv[1]

cmd = ['git', 'log', '--format=%s', '-n', '100', fname]
output = check_output(cmd).decode('utf-8')

ignore = ['License', 'Merge']

# Ordered list of patterns
patterns = [
    # Common style "foo/bar/baz: Fix the foo"
    re.compile('^([\w\-_]+: )+'),
    # Less common "foo bar baz: Fix the foo"
    re.compile('^([\w\-_]+:? )+: ')
]

words = []
for line in output.splitlines():
    prefix = line.split()[0]
    for patt in patterns:
        match = patt.search(line)
        if match:
            prefix = match.group(0)
            break

    if prefix in ignore:
        continue

    words.append(prefix)

# Warn if we didn't find many examples
if len(words) < 5:
    print("Warning: only found %d previous commits to guess from for" % len(words),
          fname, file=sys.stderr)

counts = Counter(words)
print(counts.most_common(1)[0][0])
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

WARNING: multiple messages have this Message-ID (diff)
From: Michael Ellerman <mpe@ellerman.id.au>
To: Daniel Vetter <daniel@ffwll.ch>,
	Christophe LEROY <christophe.leroy@c-s.fr>
Cc: Pavel Machek <pavel@ucw.cz>,
	elfring@users.sourceforge.net,
	kernel list <linux-kernel@vger.kernel.org>,
	vgupta@synopsys.com, linux@armlinux.org.uk, oleg@redhat.com,
	catalin.marinas@arm.com, will.deacon@arm.com, paulus@ozlabs.org,
	benh@kernel.crashing.org, ard.biesheuvel@linaro.org,
	tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com,
	x86@kernel.org, scott.bauer@intel.com,
	jonathan.derrick@intel.com, axboe@kernel.dk,
	daniel.lezcano@linaro.org, maxime.ripard@free-electrons.com,
	wens@csie.org, alexander.deucher@amd.com,
	christian.koenig@amd.com, David1.Zhou@amd.com, airlied@linux.ie,
	robdclark@gmail.com, joro@8bytes.org, shli@kernel.org,
	shawnguo@kernel.org, kernel@pengutronix.de,
	fabio.estevam@nxp.com, akpm@linux-foundation.org,
	Alexey.Brodkin@synopsys.com, mhocko@suse.com, vbabka@suse.cz,
	Vladislav.Zakharov@synopsys.com, noamca@mellanox.com,
	yamada.masahiro@socionext.com, sboyd@codeaurora.org,
	viresh.kumar@linaro.org, linus.walleij@linaro.org,
	heiko@sntech.de, aik@ozlabs.ru, ruscur@russell.cc,
	david@gibson.dropbear.id.au, fbarrat@linux.vnet.ibm.com,
	alistair@popple.id.au, robh@kernel.org, joe@perches.com,
	harry.wentland@amd.com, tony.cheng@amd.com, Wenjing.Liu@amd.com,
	airlied@redhat.com, Ding.Wang@amd.com, sylvia.tsai@amd.com,
	hersenxs.wu@amd.com, Rex.Zhu@amd.com, JinHuiEric.Huang@amd.com,
	dan.carpenter@oracle.com, architt@codeaurora.org,
	daniel.vetter@ffwll.ch, narmstrong@baylibre.com,
	ville.syrjala@linux.intel.com, jcrouse@codeaurora.org,
	aishpant@gmail.com, noralf@tronnes.org, andresx7@gmail.com,
	Monk.Liu@amd.com, nicolai.haehnle@amd.com,
	Andrey.Grodzovsky@amd.com, linux-snps-arc@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org, kvm-ppc@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org, linux-efi@vger.kernel.org,
	linux-block@vger.kernel.org, amd-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org,
	freedreno@lists.freedesktop.org,
	iommu@lists.linux-foundation.org, linux-raid@vger.kernel.org
Subject: Re: [PATCH] fix double ;;s in code
Date: Tue, 20 Feb 2018 17:19:31 +1100	[thread overview]
Message-ID: <87vaesrxn0.fsf@concordia.ellerman.id.au> (raw)
In-Reply-To: <20180219154135.GV22199@phenom.ffwll.local>

Daniel Vetter <daniel@ffwll.ch> writes:
> On Sun, Feb 18, 2018 at 11:00:56AM +0100, Christophe LEROY wrote:
>> Le 17/02/2018 =C3=A0 22:19, Pavel Machek a =C3=A9crit=C2=A0:
>> >=20
>> > Fix double ;;'s in code.
>> >=20
>> > Signed-off-by: Pavel Machek <pavel@ucw.cz>
>>=20
>> A summary of the files modified on top of the patch would help understand
>> the impact.
>>=20
>> A maybe there should be one patch by area, eg one for each arch specific
>> modif and one for drivers/ and one for block/ ?
>
> Yeah, pls split this into one patch per area, with a suitable patch
> subject prefix. Look at git log of each file to get a feeling for what's
> the standard in each area.

This part is actually pretty annoying.

I hacked up a script (below) which seems to do a reasonable job in most
cases.

For this patch it gives:

  $ for f in $(git ls-files -m); do ./guess-prefix.py $f; done
  ARC:=20
  ARC:=20
  ARM:=20
  arm64: ptrace:=20
  KVM: PPC:=20
  powerpc/powernv:
  x86/efi:
  block/sed-opal:
  clocksource: mips-gic:=20
  clocksource/drivers/sun5i:
  drm/amd/display:
  drm/amd/powerplay:
  drm/msm/mdp5:
  drm:=20
  iommu/vt-d:
  md:=20
  soc: imx: gpc:=20

I think those are correct except for:
 - "drm:" for "drivers/gpu/drm/scheduler" which has only a single commit.
 - "md:" for "drivers/md/raid1.c" which is tricked by inconsistent
    usage of "md: raid1:" and "md/raid1:".

But that seems like a reasonable hit rate.

Another approach would be to have a file that defines for each subsystem
what the preferred style is, but that is likely to be a PITA to
maintain.

cheers


#!/usr/bin/python3

import sys
import re
from subprocess import check_output
from collections import Counter

if len(sys.argv) !=3D 2:
    print('Usage: %s <path>' % sys.argv[0], file=3Dsys.stderr)
    sys.exit(1)

fname =3D sys.argv[1]

cmd =3D ['git', 'log', '--format=3D%s', '-n', '100', fname]
output =3D check_output(cmd).decode('utf-8')

ignore =3D ['License', 'Merge']

# Ordered list of patterns
patterns =3D [
    # Common style "foo/bar/baz: Fix the foo"
    re.compile('^([\w\-_]+: )+'),
    # Less common "foo bar baz: Fix the foo"
    re.compile('^([\w\-_]+:? )+: ')
]

words =3D []
for line in output.splitlines():
    prefix =3D line.split()[0]
    for patt in patterns:
        match =3D patt.search(line)
        if match:
            prefix =3D match.group(0)
            break

    if prefix in ignore:
        continue

    words.append(prefix)

# Warn if we didn't find many examples
if len(words) < 5:
    print("Warning: only found %d previous commits to guess from for" % len=
(words),
          fname, file=3Dsys.stderr)

counts =3D Counter(words)
print(counts.most_common(1)[0][0])

WARNING: multiple messages have this Message-ID (diff)
From: mpe@ellerman.id.au (Michael Ellerman)
To: linux-snps-arc@lists.infradead.org
Subject: [PATCH] fix double ;;s in code
Date: Tue, 20 Feb 2018 17:19:31 +1100	[thread overview]
Message-ID: <87vaesrxn0.fsf@concordia.ellerman.id.au> (raw)
In-Reply-To: <20180219154135.GV22199@phenom.ffwll.local>

Daniel Vetter <daniel at ffwll.ch> writes:
> On Sun, Feb 18, 2018@11:00:56AM +0100, Christophe LEROY wrote:
>> Le 17/02/2018 ? 22:19, Pavel Machek a ?crit?:
>> > 
>> > Fix double ;;'s in code.
>> > 
>> > Signed-off-by: Pavel Machek <pavel at ucw.cz>
>> 
>> A summary of the files modified on top of the patch would help understand
>> the impact.
>> 
>> A maybe there should be one patch by area, eg one for each arch specific
>> modif and one for drivers/ and one for block/ ?
>
> Yeah, pls split this into one patch per area, with a suitable patch
> subject prefix. Look at git log of each file to get a feeling for what's
> the standard in each area.

This part is actually pretty annoying.

I hacked up a script (below) which seems to do a reasonable job in most
cases.

For this patch it gives:

  $ for f in $(git ls-files -m); do ./guess-prefix.py $f; done
  ARC: 
  ARC: 
  ARM: 
  arm64: ptrace: 
  KVM: PPC: 
  powerpc/powernv:
  x86/efi:
  block/sed-opal:
  clocksource: mips-gic: 
  clocksource/drivers/sun5i:
  drm/amd/display:
  drm/amd/powerplay:
  drm/msm/mdp5:
  drm: 
  iommu/vt-d:
  md: 
  soc: imx: gpc: 

I think those are correct except for:
 - "drm:" for "drivers/gpu/drm/scheduler" which has only a single commit.
 - "md:" for "drivers/md/raid1.c" which is tricked by inconsistent
    usage of "md: raid1:" and "md/raid1:".

But that seems like a reasonable hit rate.

Another approach would be to have a file that defines for each subsystem
what the preferred style is, but that is likely to be a PITA to
maintain.

cheers


#!/usr/bin/python3

import sys
import re
from subprocess import check_output
from collections import Counter

if len(sys.argv) != 2:
    print('Usage: %s <path>' % sys.argv[0], file=sys.stderr)
    sys.exit(1)

fname = sys.argv[1]

cmd = ['git', 'log', '--format=%s', '-n', '100', fname]
output = check_output(cmd).decode('utf-8')

ignore = ['License', 'Merge']

# Ordered list of patterns
patterns = [
    # Common style "foo/bar/baz: Fix the foo"
    re.compile('^([\w\-_]+: )+'),
    # Less common "foo bar baz: Fix the foo"
    re.compile('^([\w\-_]+:? )+: ')
]

words = []
for line in output.splitlines():
    prefix = line.split()[0]
    for patt in patterns:
        match = patt.search(line)
        if match:
            prefix = match.group(0)
            break

    if prefix in ignore:
        continue

    words.append(prefix)

# Warn if we didn't find many examples
if len(words) < 5:
    print("Warning: only found %d previous commits to guess from for" % len(words),
          fname, file=sys.stderr)

counts = Counter(words)
print(counts.most_common(1)[0][0])

  parent reply	other threads:[~2018-02-20  6:19 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-17 21:19 [PATCH] fix double ;;s in code Pavel Machek
2018-02-17 21:19 ` Pavel Machek
2018-02-17 21:19 ` Pavel Machek
2018-02-18 10:00 ` Christophe LEROY
2018-02-18 10:00 ` Christophe LEROY
2018-02-18 10:00   ` Christophe LEROY
2018-02-18 10:00   ` Christophe LEROY
2018-02-18 10:00   ` Christophe LEROY
2018-02-19 15:41   ` Daniel Vetter
2018-02-19 15:41     ` Daniel Vetter
2018-02-19 15:41     ` Daniel Vetter
2018-02-19 15:41     ` Daniel Vetter
2018-02-19 19:33     ` Pavel Machek
2018-02-19 19:33     ` Pavel Machek
2018-02-19 19:33       ` Pavel Machek
2018-02-19 19:33       ` Pavel Machek
2018-02-20  1:25       ` Rob Clark
2018-02-20  1:25         ` Rob Clark
2018-02-20  1:25         ` Rob Clark
2018-02-20  1:25         ` Rob Clark
2018-02-20  8:03       ` Jani Nikula
2018-02-20  8:03         ` Jani Nikula
2018-02-20 16:34         ` Alex Deucher
2018-02-20 16:34           ` Alex Deucher
2018-02-20 16:34           ` Alex Deucher
2018-02-20 23:47         ` Andrew Morton
2018-02-20 23:47           ` Andrew Morton
2018-02-20 23:47           ` Andrew Morton
     [not found]     ` <20180219154135.GV22199-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2018-02-19 19:33       ` Pavel Machek
2018-02-20  6:19       ` Michael Ellerman [this message]
2018-02-20  6:19         ` Michael Ellerman
2018-02-20  6:19         ` Michael Ellerman
2018-02-20 16:41         ` Joe Perches
2018-02-20 16:41           ` Joe Perches
2018-02-20 16:41           ` Joe Perches
2018-02-20 16:41           ` Joe Perches
2018-02-20  5:33 ` Vineet Gupta
2018-02-20  5:33 ` Vineet Gupta
2018-02-22  9:09 ` Shawn Guo
2018-02-22  9:09   ` Shawn Guo
2018-02-22  9:09   ` Shawn Guo
2018-02-24  8:52   ` Pavel Machek
2018-02-24  8:52     ` Pavel Machek
2018-02-24  8:52     ` Pavel Machek
2018-02-24  8:56     ` Shawn Guo
2018-02-24  8:56       ` Shawn Guo
2018-02-24  8:56       ` Shawn Guo
  -- strict thread matches above, loose matches on Subject: below --
2018-02-17 21:19 Pavel Machek
2018-02-17 21:19 Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vaesrxn0.fsf@concordia.ellerman.id.au \
    --to=mpe-gsx/oe8hsfggbc27wqdahg@public.gmane.org \
    --cc=Alexey.Brodkin-HKixBCOQz3hWk0Htik3J/w@public.gmane.org \
    --cc=David1.Zhou-5C7GfCeVMHo@public.gmane.org \
    --cc=Ding.Wang-5C7GfCeVMHo@public.gmane.org \
    --cc=JinHuiEric.Huang-5C7GfCeVMHo@public.gmane.org \
    --cc=Rex.Zhu-5C7GfCeVMHo@public.gmane.org \
    --cc=Wenjing.Liu-5C7GfCeVMHo@public.gmane.org \
    --cc=aik-sLpHqDYs0B2HXe+LvDLADg@public.gmane.org \
    --cc=airlied-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=airlied-cv59FeDIM0c@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=architt-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org \
    --cc=catalin.marinas-5wv7dgnIgG8@public.gmane.org \
    --cc=christophe.leroy-GgN8y9CXRhA@public.gmane.org \
    --cc=dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
    --cc=daniel-/w4YWyX8dFk@public.gmane.org \
    --cc=daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=elfring-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=fbarrat-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
    --cc=heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org \
    --cc=hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org \
    --cc=joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org \
    --cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mhocko-IBi9RG/b67k@public.gmane.org \
    --cc=mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=narmstrong-rdvid1DuHRBWk0Htik3J/w@public.gmane.org \
    --cc=paulus-mnsaURCQ41sdnm+yROfE0A@public.gmane.org \
    --cc=pavel-+ZI9xUNit7I@public.gmane.org \
    --cc=ruscur-3Su/lFKaw5ejKv3TNrM5DQ@public.gmane.org \
    --cc=scott.bauer-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=shli-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=vbabka-AlSwsSmVLrQ@public.gmane.org \
    --cc=viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=wens-jdAy2FN1RRM@public.gmane.org \
    --cc=will.deacon-5wv7dgnIgG8@public.gmane.org \
    --cc=x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=yamada.masahiro-uWyLwvC0a2jby3iVrkZq2A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.