phabricator 如何从 feed.http-hooks 生成 diff url

phabricator how to generate diff url from feed.http-hooks

Phabricator 版本 d2cff6a2cf01396f6337edfadd1f7df7cce1277d(2017 年 11 月 17 日)

我想得到url的微分,比如

http://myphabricator/D4

来自 feed.http-hooks 的请求。

但是feed.http-hooks不像D4那样发送差分号,而是发送storyID之类的。

我应该如何根据 feed.http-hooks 的信息创建差异 Url?
我在下面做了。

客户

$ arc diff
(create comment to D4)

feed.http-hooks.sent

***headers***
Host:localhost:8085
Content-Length:441
Accept:*/*
Content-Type:application/x-www-form-urlencoded

*** bodys ***
b'storyID=94&storyType=PhabricatorApplicationTransactionFeedStory&storyData%5BobjectPHID%5D=PHID-DREV-ms2ge2gojlaqaqt54szv&storyData%5BtransactionPHIDs%5D%5BPHID-XACT-DREV-vng3mngfk7i44er%5D=PHID-XACT-DREV-vng3mngfk7i44er&storyData%5BtransactionPHIDs%5D%5BPHID-XACT-DREV-2jn767qfhgbr2uh%5D=PHID-XACT-DREV-2jn767qfhgbr2uh&storyAuthorPHID=PHID-USER-jm5w6p3zrpns57e35f5d&storyText=my.name+updated+the+diff+for+D14%3A+test.&epoch=1519094890'

*** params ***
storyText:my.name updated the diff for D14: test.
storyData[transactionPHIDs][PHID-XACT-DREV-vng3mngfk7i44er]:PHID-XACT-DREV-vng3mngfk7i44er
storyData[transactionPHIDs][PHID-XACT-DREV-2jn767qfhgbr2uh]:PHID-XACT-DREV-2jn767qfhgbr2uh
storyAuthorPHID:PHID-USER-jm5w6p3zrpns57e35f5d
storyID:94
storyType:PhabricatorApplicationTransactionFeedStory
storyData[objectPHID]:PHID-DREV-ms2ge2gojlaqaqt54szv
epoch:1519094890

您可以解析出对象 PHID(在本例中为 PHID-DREV-ms2ge2gojlaqaqt54szv),并使用 phid.query 管道调用来查找它所指的对象:

echo '{
  "phids": [
    "PHID-DREV-ms2ge2gojlaqaqt54szv"
  ]
}' | arc call-conduit --conduit-uri http://localhost:8085/ --conduit-token $SECRET phid.query

或者使用 curl 而不是 arc call-conduit:

curl http://localhost:8085/api/phid.query \
-d api.token=$SECRET \
-d phids[0]=PHID-DREV-ms2ge2gojlaqaqt54szv