Skip to content
This repository has been archived by the owner on Dec 20, 2022. It is now read-only.

Fix post commit hook when saving trac ticket changes #20

Closed
adiroiban opened this issue Jan 27, 2015 · 12 comments
Closed

Fix post commit hook when saving trac ticket changes #20

adiroiban opened this issue Jan 27, 2015 · 12 comments

Comments

@adiroiban
Copy link
Member

I see this the log

I think that in some cases cnum is int instead of string... will investigate

+ /svn/Twisted/hooks/trac-post-commit-pb-client 43738 adiroiban 'Branching to core-test-names-7666.' twistedmatrix.com 38159
2015-01-24 10:27:36-0700 [-] Log opened.
2015-01-24 10:27:36-0700 [-] Starting factory <twisted.spread.pb.PBClientFactory instance at 0x8ccaf2c>
2015-01-24 10:27:37-0700 [Broker,client] postCommit result Traceback (most recent call last):
2015-01-24 10:27:37-0700 [Broker,client]   File "/srv/trac/config/trac-post-commit-hook", line 188, in __init__
2015-01-24 10:27:37-0700 [Broker,client]     ticket.save_changes(self.author, self.msg, self.now, db, cnum+1)
2015-01-24 10:27:37-0700 [Broker,client]   File "/srv/trac/.local/lib/python2.7/site-packages/trac/ticket/model.py", line 366, in save_changes
2015-01-24 10:27:37-0700 [Broker,client]     return int(cnum.rsplit('.', 1)[-1])
2015-01-24 10:27:37-0700 [Broker,client] AttributeError: 'int' object has no attribute 'rsplit'
2015-01-24 10:27:37-0700 [Broker,client] Unexpected error while processing ticket ID 7666
2015-01-24 10:27:37-0700 [Broker,client] 
2015-01-24 10:27:37-0700 [Broker,client] Stopping factory <twisted.spread.pb.PBClientFactory instance at 0x8ccaf2c>
@adiroiban
Copy link
Member Author

I see that cnum+1 is no longer used in trac 1.0 and from what I see, we use trac 1.0.1

https://github.com/edgewall/trac/blob/trunk/trac/ticket/model.py#L313


so we need to update the trac-post-commit-hook

I think that the latest script is called commit_updated

https://github.com/edgewall/trac/blob/eb4c4b586628b3d1262465cce7474346a213a27a/tracopt/ticket/commit_updater.py

Trac upgrade documentation state

Note that if you were using the `trac-post-commit-hook`, ''you're strongly advised to upgrade it'' to the new hook documented in the above references and [TracWorkflow#Howtocombinethetracopt.ticket.commit_updaterwiththetestingworkflow here], as the old hook will not work with anything else than the default repository and even for this case, it won't trigger the appropriate notifications.

See full doc here https://twistedmatrix.com/trac/wiki/TracUpgrade


So to fix this I think that we should use the new commit hook

What do you think?

@tomprince
Copy link
Contributor

Yes

@adiroiban
Copy link
Member Author

OK. So all steps, beside step 5 were done ? I have no idea what is the progress of trac upgrade and how can I help.

Any tips are much appreciated.

Thanks!

@tomprince
Copy link
Contributor

OK. So all steps, beside step 5 were done ?

Unfortunately, I don't know the answer to that question. I wasn't directly involved in the migration. @glyph or @dreid perhaps know.

@glyph
Copy link
Contributor

glyph commented Jan 31, 2015

@adiroiban as far as I know, all the steps were done.

However, the Subversion repository is on a different host, so if step 5 (copying static website content!?) is what is supposed to update the post-commit hook, perhaps we need to copy it to a different server.

@adiroiban
Copy link
Member Author

On the wiki page linked by Tom Prince, step 5 is

  1. Updates post-commit hook.

From what I can see in this repo and errors on svn.twistedmatrix.com the old hook is still used.. the one using cnum... the old hook is also present in this repo.

It needs to be updated with a newer version like https://github.com/edgewall/trac/blob/eb4c4b586628b3d1262465cce7474346a213a27a/tracopt/ticket/commit_updater.py as documented in Trac Upgrade doc https://twistedmatrix.com/trac/wiki/TracUpgrade


I took a look at this repo but could not find out how the hook is copied and where the hook is copied... there are so many repos in twisted-infa project, that I am lost :(

@tomprince
Copy link
Contributor

I took a look at this repo but could not find out how the hook is copied and where the hook is copied...

The setup of the wolfwood (the vcs server, also known as svn.twistedmatrix.com or code.twistedmatrix.com) was never automated. The svn hooks live here (in bzr still).

The post commit hook calls trac-post-commit-pb-client. That uses PB to talk to a server (started here) that calls trac's post-commit hook. The last is based on the old upstream hook, but customized to add some more fields and recognize the commit format we use.

there are so many repos in twisted-infa project, that I am lost :(

Sorry about that. When I was writing much of the automation, I think most of the documentation end up more as notes to myself, rather than as something that makes it easy for other people to pick-up. 😦 Feel free to ask questions, either here or on #twisted-admin and I'll answer as I can.

@adiroiban
Copy link
Member Author

Thanks for the info. For my point of view I should not about the whole chain based on which trac-post-commit-hook is called. I am happy to know that it is called.

Since this is based on on old version, it needs to be updated.

The git history does not help me https://github.com/twisted-infra/trac-config/commits/master/trac-post-commit-hook

Is there a list with those "more fields" ? Is there any info regarding what is different in Twisted commit format ?

AFAIK twisted uses the standard commit format fixes #1111 / ref #2344 being recognized by the script.

I will try to find the upstream old version and then compare with current one to see what was changed... so that I can apply the same changes on current upstream version.

@tomprince
Copy link
Contributor

The git history does not help me https://github.com/twisted-infra/trac-config/commits/master/trac-post-commit-hook

If the history is not in git, it might be in bzr. Or maybe not. Before braid existed, not all of twisted's infrastructure was version controlled.

Is there a list with those "more fields" ? Is there any info regarding what is different in Twisted commit format ?

There is at least the branch and author handling, for new branches.

@adiroiban
Copy link
Member Author

I got it http://bazaar.launchpad.net/~twisted-dev/twisted-trac-integration/trunk/view/head:/trac-hooks/trac-post-commit-hook ... but it does not have a great history.

I should be able to find the upstream hook and compare the changes.

Will come back with a patch.

Thanks!

@adiroiban
Copy link
Member Author

Made some progress. I think that this is the source... there is also re-open action. https://raw.githubusercontent.com/edgewall/trac/0.11-stable/contrib/trac-post-commit-hook

@adiroiban
Copy link
Member Author

moved to twisted-infra/braid#123

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants