Opened 8 years ago

Closed 8 years ago

#15133 closed enhancement (fixed)

post receive hook on git to update commit on trac

Reported by: vbraun Owned by:
Priority: major Milestone: sage-6.2
Component: website/wiki Keywords:
Cc: robertwb, ohanar Merged in:
Authors: Volker Braun Reviewers: Andew Ohana, ​Marc Mezzarobba
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: #15129 Stopgaps:

Status badges

Description (last modified by vbraun)

Here is a post-receive hook that updates the "Commit" field on trac.

Installation instructions:

  • copy the attached post-receive-hook.py to hooks/post-receive
  • Add an action to trac to change the status from positive_review back to needs_review. In trac.ini:
    [ticket-workflow]
    back_to_review = positive_review -> needs_review
    back_to_review.name = resubmit to review
    back_to_review.permissions = TICKET_MODIFY
    
  • Add a trac user that makes the changes, e.g. username = git. Put the username/password in the post-receive script in TRAC_URL_LOGIN.

Attachments (1)

post-receive-hook.py (3.8 KB) - added by vbraun 8 years ago.
Updated

Download all attachments as: .zip

Change History (12)

comment:1 Changed 8 years ago by vbraun

  • Dependencies set to #15129
  • Description modified (diff)

Changed 8 years ago by vbraun

Updated

comment:2 Changed 8 years ago by vbraun

  • Cc robertwb ohanar added
  • Status changed from new to needs_review

comment:3 Changed 8 years ago by ohanar

Ok, it is now enabled (although I haven't had the chance to test it). I've put up a repository with all the server-side hooks at http://github.com/sagemath/trac-githooks.

comment:4 Changed 8 years ago by ohanar

  • Status changed from needs_review to needs_work

The plugin is complaining about authentication, so I've disabled it for the moment(because it displays the git user's password when it errors out).

comment:5 Changed 8 years ago by ohanar

  • Status changed from needs_work to needs_review

Ok, fixed this by basing it off of the development scripts authentication. Please review: https://github.com/sagemath/trac-githooks/commit/730231a1ec874d68e3afdd56523c71a6ac2ce4ed

comment:6 Changed 8 years ago by ohanar

Ok, I edited this a bit: sha1s in the log table now link to the appropriate changeset, and the table for non-forced pushes only show the new changesets. I still think we need something when the branch field is changed to automate populating the commit field (and ideally have a table of new/recent commits).

comment:7 Changed 8 years ago by vbraun

Changes look good to me, thanks!

I agree that we ideally would also figure out the commit field automatically if one fills in the "Branch" trac field and the branch already exists. Though that obviously requires another trac plugin. At least for now people just have to first fill in the branch field and then push, so its not terribly urgent.

comment:8 Changed 8 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:9 Changed 8 years ago by mmezzarobba

Why is this ticket still in needs_review state? Is it intentional?

comment:10 Changed 8 years ago by vbraun

  • Reviewers set to Andew Ohana, ​Marc Mezzarobba
  • Status changed from needs_review to positive_review

comment:11 Changed 8 years ago by vbraun

  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.