git am
Ondřej Bílka
neleai@seznam.cz
Mon Jun 3 19:07:00 GMT 2013
On Mon, Jun 03, 2013 at 10:30:53AM -0400, Carlos O'Donell wrote:
> On 06/03/2013 07:31 AM, Thomas Schwinge wrote:
> > Hi!
> >
> > On Tue, 28 May 2013 17:27:00 -0400, "Carlos O'Donell" <carlos@redhat.com> wrote:
> >> We need to switch to git-am process workflow for glibc
> >> so I won't make those kinds of mistakes.
> >
> > I'd be very happy to, but it seems difficult to me with all the conflicts
> > it would cause in ChangeLog and NEWS files?
>
> Is there any way a pre/post-commit hook could use metadata in the message
> to update NEWS and ChangeLog?
>
I wrote a script to add bugzilla number from commit message.
Or run it when about to commit where we could open firefox to close bug.
Is there easy way to prefill bugzilla message with:
Fixed by: hexid
For conflicts I typically do
git checkout -f HEAD^ offending file
and run script to regenerate.
-------------- next part --------------
#!/usr/bin/env ruby
def add_to_news(args)
f1=File.open("NEWS")
f2=File.open(".NEWS","w")
s=""
begin
s=f1.gets
s=s.chomp if s
f2.puts s
end while s!="* The following bugs are resolved with this release:"
s=f1.gets
s=s.chomp if s
f2.puts s
ary=[]
begin
s=f1.gets
s=s.chomp if s
ary+=s.split(",").map{|x|x.to_i}
end while s!=""
ary += args
ary = ary.sort.uniq
first=false
r=""
rf=nil
ary.size.times{|i|
r2=r+", "+ary[i].to_s
if r2.size>=75
r[0,1]=" "
first = true
rf=r
r=" "+ary[i].to_s
else
if first
f2.puts rf+","
first=false
end
r = r2
end
}
r[0,1]=" "
f2.puts r+"."
f2.puts
begin
s=f1.gets
s=s.chomp if s
f2.puts s if s
end while s
f2.close
puts `cp .NEWS NEWS`
end
msg = `git log -1 HEAD`
args=[]
if msg.index("FIXES:")
s = msg[(msg.index("FIXES:")+6)...-1].split(",").each{|s|
id=s
break if !s || s.to_i == 0
args << s.to_i
}
end
puts "ADDING #{args*","}"
add_to_news(args)
`git add NEWS`
`git commit -C HEAD --amend --no-verify`
args.each {|a|
#`firefox -new-tab http://sourceware.org/bugzilla/show_bug.cgi?id=#{a}`
}
More information about the Libc-alpha
mailing list