Page MenuHomePhabricator

Replace deprecated phabricator conduit api calls in gerrit's its-phabricator plugin
Closed, ResolvedPublic

Description

This is needed as maniphest.update and maniphest.info is deprecated and can be removed at any time.

We need migrate maniphest.update to maniphest.edit and maniphest.info to maniphest.search + any other calls which i haven't found yet.

We need to also migrate project.query to project.search.

Im setting this as high priority as it is harder to upgrade gerrit then it is phabricator (i would like to get this done before gerrit 2.14 is branched or before we update to it)

Event Timeline

Paladox renamed this task from Migrate gerri's its-phabricator plugin to use maniphest.edit conduit to Migrate gerrit's its-phabricator plugin to use maniphest.edit conduit.Feb 25 2017, 1:44 PM
Paladox triaged this task as High priority.

@mmodell is it easy just to switch to maniphest.edit or does some code need changing to support it?

Benefits of this is we can then add support for removing tags with the api as maniphest.update does not support that.

Heres my starting patch https://gerrit-review.googlesource.com/#/c/98576/ not sure if it is that easy to switch like that.

Paladox renamed this task from Migrate gerrit's its-phabricator plugin to use maniphest.edit conduit to Replace deprecated phabricator conduit api calls in gerrit's its-phabricator plugin.Feb 25 2017, 2:32 PM
Paladox updated the task description. (Show Details)
Paladox updated the task description. (Show Details)

Its not actually that easy to convert it, it seems.

@mmodell would you be able to convert it please?

I've managed to write this in java for maniphest.edit :)

https://gerrit-review.googlesource.com/#/c/98576/

Tested too and works.

I have created this https://gerrit-review.googlesource.com/#/c/98611/ patch for replacing project.query with project.search. I will need help with that one as it seems that the query's have changed a lot in both of those conduit's.

I get this error

[2017-02-26 17:29:46,494] [HTTP-75] WARN com.google.gerrit.server.extensions.events.EventUtil : Error in listener com.google.gerrit.server.events.StreamEventsApiListener for event com.google.gerrit.server.extensions.events.RevisionCreated: Not a JSON Object: [{"id":23,"type":"PROJ","phid":"PHID-PROJ-l6vvzxgrjqq36ss6sjee","fields":{"name":"Patch-For-Review","slug":"patch-for-review","milestone":null,"depth":0,"parent":null,"icon":{"key":"tag","name":"Tag","icon":"fa-tags"},"color":{"key":"pink","name":"Pink"},"dateCreated":1470522110,"dateModified":1482670474,"policy":{"view":"public","edit":"users","join":"users"},"description":null,"startdate":null,"enddate":null,"issprint":false},"attachments":{}}]

when using the above patch.

@Paladox: You posted at 18:24 that you wrote a patch. Two minutes later you posted another comment that the patch has an issue. In general, it is not needed to tell everyone on this task that a developer often needs several iterations until their patch works as expected. It is a rather common situation that does not need to be communicated. Thanks!

My first patch https://gerrit-review.googlesource.com/#/c/98576/ was merged by Luca :)

So one deprecated api replaced now. More to go :)

@Paladox I don't know if your patch already does it, but Phab now allows bots to add a comment and a project/tag at the same time.
@gerritbot does not do this currently, so he sents two notifs/emails whereas he can sends only one.
See: https://phab-01.wmflabs.org/T183
Example in python :

>>> phab.maniphest.edit(objectIdentifier='T183', transactions=[{'type':'comment', 'value':'the text of the comment'}, {'type':'projects.add', 'value':['Patch-For-Review']}])

Tell me if I can help you.

Oh i thought it will send two notifications even if we did it the once?

And nope i wasn't aware until now.

What api do i use for this? Does this use the new maniphest.edit api? (i may have got the wrong name)

I've updated https://gerrit-review.googlesource.com/#/c/98996/ to remove projectInfo as i couldn't get it to work with the new project.search. It works now. Did some cleanup too. :)

that is the final change that will remove all the deprecated api calls :)

Aklapper lowered the priority of this task from High to Low.Jun 29 2018, 10:54 AM

Stalled on Gerrit upstream review, however if upstream Phab removed the calls we could always deploy Paladox' changes locally in Wikimedia's Phab instance

I have now done https://gerrit-review.googlesource.com/c/plugins/its-phabricator/+/197590 (the last patch) that moved the final method over :).

Great work to keep this up to date to use the current API methods and not rely on some deprecated code. Lots of people using this without realizing.