Bug 11987

Summary: Git commits should inject comments into any referenced bugzilla bugs
Product: Infrastructure Reporter: Colin Guthrie <mageia>
Component: BugzillaAssignee: Colin Guthrie <mageia>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: Normal CC: atelier-bugs, sysadmin-bugs
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Source RPM: CVE:
Status comment:
Bug Depends on: 13859    
Bug Blocks:    

Description Colin Guthrie 2013-12-14 19:27:47 CET
If someone makes a commit in git and includes "mga#123" in the commit message, a comment should be added to the bug to reference the commit.

Reproducible: 

Steps to Reproduce:
Comment 1 Mageia Robot 2013-12-14 20:50:10 CET
Testing 123
Comment 2 Mageia Robot 2013-12-14 21:08:09 CET
Testing 456
Comment 3 Mageia Robot 2013-12-14 21:33:23 CET
commit f3a394aa05a757a8fea7852fe787665da0c4712c

Author: Colin Guthrie <colin@mageia.org>

Date:   Sat Dec 14 18:32:22 2013 +0000



    Test bugzilla integration mga#11987

---

 Commit Link:

   http://gitweb.mageia.org/software/test/commit/?id=f3a394aa05a757a8fea7852fe787665da0c4712c



 Bug links:

   Mageia

      https://bugs.mageia.org/show_bug.cgi?id=11987



 README |    1 +

 1 files changed, 1 insertions(+), 0 deletions(-)



diff --git a/README b/README

new file mode 100644

index 0000000..29092d9

--- /dev/null

+++ b/README

@@ -0,0 +1 @@

+This is just a test README file.
Comment 4 Mageia Robot 2013-12-14 21:36:58 CET
commit f3a394aa05a757a8fea7852fe787665da0c4712c
Author: Colin Guthrie <colin@mageia.org>
Date:   Sat Dec 14 18:32:22 2013 +0000

    Test bugzilla integration mga#11987
---
 Commit Link:
   http://gitweb.mageia.org/software/test/commit/?id=f3a394aa05a757a8fea7852fe787665da0c4712c

 Bug links:
   Mageia
      https://bugs.mageia.org/show_bug.cgi?id=11987
Comment 5 Mageia Robot 2013-12-14 21:53:45 CET
commit f3a394aa05a757a8fea7852fe787665da0c4712c
Author: Colin Guthrie <colin@...>
Date:   Sat Dec 14 18:32:22 2013 +0000

    Test bugzilla integration mga#11987
---
 Commit Link:
   http://gitweb.mageia.org/software/test/commit/?id=f3a394aa05a757a8fea7852fe787665da0c4712c

 Bug links:
   Mageia
      https://bugs.mageia.org/show_bug.cgi?id=11987
Comment 6 Mageia Robot 2013-12-14 21:54:57 CET
commit f3a394aa05a757a8fea7852fe787665da0c4712c
Author: Colin Guthrie <colin@...>
Date:   Sat Dec 14 18:32:22 2013 +0000

    Test bugzilla integration mga#11987
---
 Commit Link:
   http://gitweb.mageia.org/software/test/commit/?id=f3a394aa05a757a8fea7852fe787665da0c4712c

 Bug links:
   Mageia
      https://bugs.mageia.org/show_bug.cgi?id=11987
Comment 7 Mageia Robot 2013-12-14 21:55:56 CET
commit f3a394aa05a757a8fea7852fe787665da0c4712c
Author: Colin Guthrie <colin@...>
Date:   Sat Dec 14 18:32:22 2013 +0000

    Test bugzilla integration mga#11987
---
 Commit Link:
   http://gitweb.mageia.org/software/test/commit/?id=f3a394aa05a757a8fea7852fe787665da0c4712c

 Bug links:
   Mageia
      https://bugs.mageia.org/show_bug.cgi?id=11987
Comment 8 Manuel Hiebel 2013-12-14 22:03:25 CET
is this needed ?

(In reply to Mageia Robot from comment #7)
> 
>  Bug links:
>    Mageia
>       https://bugs.mageia.org/show_bug.cgi?id=11987
Comment 9 Colin Guthrie 2013-12-14 22:09:26 CET
(In reply to Manuel Hiebel from comment #8)
> is this needed ?
> 
> (In reply to Mageia Robot from comment #7)
> > 
> >  Bug links:
> >    Mageia
> >       https://bugs.mageia.org/show_bug.cgi?id=11987

Not directly, but in git you can also reference both multiple internal bugs (i.e. mga#123 mga#456) and external bugs (e.g. fdo#123, rhbz#123) in which case I think it's nice to include the full bug links.

I will try and add support to strip this out if only one bug is referenced.
Comment 10 Mageia Robot 2013-12-14 22:15:34 CET
commit 7c03a0f17401edaf41c27dda3bd108b944a027f2
Author: Colin Guthrie <colin@...>
Date:   Sat Dec 14 21:15:27 2013 +0000

    Test bugzilla integration some more again. mga#11987
---
 Commit Link:
   http://gitweb.mageia.org/software/test/commit/?id=7c03a0f17401edaf41c27dda3bd108b944a027f2

 Bug links:
Comment 11 Manuel Hiebel 2013-12-14 22:16:10 CET
oki make sense btw, bugzilla convert bug 123 as an url
Comment 12 Manuel Hiebel 2013-12-14 22:16:30 CET
or bug#123
Comment 13 Colin Guthrie 2013-12-14 22:20:05 CET
There we go! Fixed! (I've fixed the off-by-one error I had in the above test!)

And yeah I'm aware of the magic bug linking in bugzilla, but this is the same code that generates the emails too (it's practically the same message, just truncated) so I'm not going to spend time formatting it specially when the code that generates bug links is generic for all bug trackers we may want to reference, not just our own. A full URL is fine for this IMO
Comment 14 Colin Guthrie 2013-12-14 22:21:14 CET
Seeing as this is now committed to puppet and deployed manually too, this should be implemented now.

Status: NEW => RESOLVED
Resolution: (none) => FIXED

Colin Guthrie 2014-08-04 19:48:22 CEST

Depends on: (none) => 13859