maildev@lists.thunderbird.net

Thunderbird email developers

View all threads

Uploading patches to Phabricator for mozilla-central

JK
Jörg Knobloch
Sat, Oct 12, 2019 5:33 PM

Hi all,

I've just met Ian Moody [:Kwan] on IRC and he showed me the following:

Download https://hg.sr.ht/~kwan/phabsend-moz/raw/%40/phabricator.py to somewhere on your machine (you'll see below where I have mine):

Add this to your hgrc

[extensions]

older than 4.8

phabricator = c:\mozilla-source\.mozbuild\phabricator.py

[phabricator]
url=https://phabricator.services.mozilla.com/
callsign=HG

4.7 and later

[auth]
hg.schemes = https
hg.prefix = phabricator.services.mozilla.com
hg.phabtoken = api- <-- Your Phab token.

Et voilà:

You can now

hg phabread D12345 > .hg/patches/D12345.patch
or whatever else you desire to do, ...

but much better:

hg phabsend -r a7e1ebc72dc5
nominating a (committed) revision. It even works with an applied but not committed patch using the revision that hg out gives you.

The result is, as an example:

D49063 - created - a7e1ebc72dc5: Bug 1588065 - Fix namespace issues in nsDocShellLoadState.h. r=mattwoodrow

And supposedly Lando will work unlike for patches uploaded via the web UI at https://phabricator.services.mozilla.com/differential/diff/create/ which later can't be committed due to https://bugzilla.mozilla.org/show_bug.cgi?id=1576146

Jörg.

IM
Ian Moody
Sat, Oct 12, 2019 5:53 PM

Hi everyone,

I've just realised I'd failed to spot an error in Jörg's hgrc, you
actually want the callsign to be MOZILLACENTRAL. Fortunately I'll soon
be adding auto callsign selection from the repo's .arcconfig so you
won't need to set it at all, but the hgrc value will be able to
override so make sure you don't have an incorrect one.

The current version doesn't upload images or other binary files (or
non-utf8 text files) successfully due to a bug in phabricator, but I
am working on that by changing to use the same API endpoint as
arcanist does (and if you are adventurous/really need to submit binary
files, the version currently at the beta bookmark
https://hg.sr.ht/~kwan/phabsend-moz/raw/beta/phabricator.py is where
you'll find the code that does that).

I'd also advise using the token starting with cli- found at
https://phabricator.services.mozilla.com/conduit/login/
While api- prefixed tokens will work with the current code, they
won't work with the future (current beta) code.

Ian

Hi everyone, I've just realised I'd failed to spot an error in Jörg's hgrc, you actually want the callsign to be MOZILLACENTRAL. Fortunately I'll soon be adding auto callsign selection from the repo's .arcconfig so you won't need to set it at all, but the hgrc value will be able to override so make sure you don't have an incorrect one. The current version doesn't upload images or other binary files (or non-utf8 text files) successfully due to a bug in phabricator, but I am working on that by changing to use the same API endpoint as arcanist does (and if you are adventurous/really need to submit binary files, the version currently at the beta bookmark https://hg.sr.ht/~kwan/phabsend-moz/raw/beta/phabricator.py is where you'll find the code that does that). I'd also advise using the token starting with `cli-` found at https://phabricator.services.mozilla.com/conduit/login/ While `api-` prefixed tokens will work with the current code, they won't work with the future (current beta) code. Ian
JK
Jörg Knobloch
Sat, Oct 12, 2019 8:06 PM

On 12/10/2019 19:33, Jörg Knobloch wrote:

hg phabsend -r a7e1ebc72dc5
nominating a (committed) revision. It even works with an applied but
not committed patch using the revision that hg out gives you.

OK, don't try that when patches in hg queue are active, it submits the
patch to Phab and then messes up your local repo.

On 12/10/2019 19:33, Jörg Knobloch wrote: > hg phabsend -r a7e1ebc72dc5 > nominating a (committed) revision. It even works with an applied but > not committed patch using the revision that hg out gives you. OK, don't try that when patches in hg queue are active, it submits the patch to Phab and then messes up your local repo.
JK
Jörg Knobloch
Sun, Oct 13, 2019 4:35 PM

On 12/10/2019 19:53, Ian Moody wrote:

I'd also advise using the token starting with cli- found at
https://phabricator.services.mozilla.com/conduit/login/
While api- prefixed tokens will work with the current code, they
won't work with the future (current beta) code.

abort: Conduit Error (ERR-INVALID-AUTH): API token "cli-........" is not
valid.

The api-xxx token worked.

Jörg.

On 12/10/2019 19:53, Ian Moody wrote: > I'd also advise using the token starting with `cli-` found at > https://phabricator.services.mozilla.com/conduit/login/ > While `api-` prefixed tokens will work with the current code, they > won't work with the future (current beta) code. abort: Conduit Error (ERR-INVALID-AUTH): API token "cli-........" is not valid. The api-xxx token worked. Jörg.
IM
Ian Moody
Wed, Oct 16, 2019 7:22 PM

On Sun, 13 Oct 2019 at 17:36, Jörg Knobloch jorgk@jorgk.com wrote:

On 12/10/2019 19:53, Ian Moody wrote:

I'd also advise using the token starting with cli- found at
https://phabricator.services.mozilla.com/conduit/login/
While api- prefixed tokens will work with the current code, they
won't work with the future (current beta) code.

Okay, after some checking I realised I was misremembering and am
completely wrong about that.  api- tokens are and will be fine, even
with the future code.
( I was misremembering from the fact that arcanist complains if you
give it an api- key instead of cli-, but after an extra confirm it's
happy to use them)

abort: Conduit Error (ERR-INVALID-AUTH): API token "cli-........" is not
valid.

The api-xxx token worked.

Jörg.

Jörg kindly checked this for me and it's because you need to use the
cli- soon after issuance from /conduit/login/ to validate it,
otherwise it expires.  Once you've used it once it's saved and will
keep working.

Ian

On Sun, 13 Oct 2019 at 17:36, Jörg Knobloch <jorgk@jorgk.com> wrote: > > On 12/10/2019 19:53, Ian Moody wrote: > > I'd also advise using the token starting with `cli-` found at > > https://phabricator.services.mozilla.com/conduit/login/ > > While `api-` prefixed tokens will work with the current code, they > > won't work with the future (current beta) code. Okay, after some checking I realised I was misremembering and am completely wrong about that. api- tokens are and will be fine, even with the future code. ( I was misremembering from the fact that arcanist complains if you give it an api- key instead of cli-, but after an extra confirm it's happy to use them) > > abort: Conduit Error (ERR-INVALID-AUTH): API token "cli-........" is not > valid. > > The api-xxx token worked. > > Jörg. > Jörg kindly checked this for me and it's because you need to use the cli- soon after issuance from /conduit/login/ to validate it, otherwise it expires. Once you've used it once it's saved and will keep working. Ian