[Mesa-stable] [Mesa-dev] [PATCH] bugzilla_mesa.sh: sort the bugs list by number

Chad Versace chad.versace at intel.com
Tue Jun 23 09:36:50 PDT 2015


On Tue 23 Jun 2015, Ilia Mirkin wrote:
> On Tue, Jun 23, 2015 at 12:05 PM, Chad Versace <chad.versace at intel.com> wrote:
> > On Fri 19 Jun 2015, Emil Velikov wrote:
> >> Cc: "10.5 10.6" <mesa-stable at lists.freedesktop.org>
> >> Suggested-by: Ilia Mirkin <imirkin at alum.mit.edu>
> >> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
> >
> >
> >> -urls=$(git log $* | grep 'bugs.freedesktop.org/show_bug' | sed -e $trim_before -e $trim_after -e $use_https | sort | uniq)
> >> +urls=$(git log $* | grep 'bugs.freedesktop.org/show_bug' | sed -e $trim_before -e $trim_after -e $use_https | sort-n | uniq)
> >
> > That can't be right! A space is needed between 'sort' and '-n'.
> 
> The approach is flawed... sort -n expects the number first, not in the
> middle/last. This was my suggestion to Emil:
> 
> git log $* | grep 'bugs.freedesktop.org/show_bug' | sed -e
> 's/.*show_bug.cgi?id=\([0-9]*\).*/\1/' | sort -n -u | sed
> 's,^,https://bugs.freedesktop.org/show_bug.cgi?id=,'

Right. I withdraw my rb.

FYI, sed isn't needed, at least on Linux. Linux's 'sort' knows how to
sort on arbitrary fields and separators. This worked for me:

-urls=$(git log $* | grep 'bugs.freedesktop.org/show_bug' | sed -e $trim_before -e $trim_after -e $use_https | sort | uniq)
+urls=$(git log $* | grep 'bugs.freedesktop.org/show_bug' | sed -e $trim_before -e $trim_after -e $use_https | sort -n -u -k2 -t=)

Or, with long options:

-urls=$(git log $* | grep 'bugs.freedesktop.org/show_bug' | sed -e $trim_before -e $trim_after -e $use_https | sort | uniq)
+urls=$(git log $* | grep 'bugs.freedesktop.org/show_bug' | sed -e $trim_before -e $trim_after -e $use_https |
        sort -n --unique --key=2 --field-separator==)


More information about the mesa-stable mailing list