Commit Graph

12 Commits

Author SHA1 Message Date
Bennett Magy
e31dcc3efe Updated parsing logic for .arcrc
Summary:
For some arcrc formats, hg commands prefer a deprecated blob in the .arcrc file which does not contain an oauth token, and only contains a phabricator cert (which is deprecated in favor of oauth)

This updates the logic to look for the phabricator.intern.facebook.com blob in the .arcrc to get an oauth token.

Reviewed By: mitrandir77

Differential Revision: D9351851

fbshipit-source-id: 11efe30b077480caa7b147c45a8d0eb78189277e
2018-08-16 13:50:53 -07:00
Shish Girling
1137cc5743 display 'Landing' status in hg ssl output
Summary:
It's super-useful to know the difference between "Accepted (You need to go and click the land button)" and "Accepted (We're just waiting for the land system to do its thing, no work for you right now)"

Alternative approach in D8074898

Reviewed By: mitrandir77

Differential Revision: D8074794

fbshipit-source-id: fdfda64e3a542518b8609e3a415d8cb3156373cf
2018-05-22 02:51:56 -07:00
Mateusz Moneta
4cfb665650 Update markers during hg pullbackup
Summary:
Before this change `hg pullbackup` did not set correct markers on commits.

This change make possible to see what changes already landed even when we are restoring repository from backup.
Before the change `fbclone` + `hg pullbackup` of repo with `C1` commit landed would result in:
```
o  o C2
|    |
o  o C1
|  /
|
o
```
after:
```
o  o C2
|    |
o  x C1
|  /
|
o
```

Reviewed By: StanislavGlebik

Differential Revision: D7032572

fbshipit-source-id: ffee3c7cc23c24a3df9a89c999c9dd2de226dbff
2018-04-13 21:51:23 -07:00
Ryan McElroy
297c6ce041 phabstatus: remove O(n^2) double loop
Summary:
This was unneeded. We can just populate the dict directly.
Note that now we catch any errors in the expected data format gracefully
and no longer stack trace with bad inputs.

Reviewed By: DurhamG

Differential Revision: D6826455

fbshipit-source-id: adc9cc1fc4895f3c67b112d914f566601336ce3b
2018-04-13 21:51:07 -07:00
Ryan McElroy
57daa71514 phabstatus: remove bad early exit
Summary:
This would cause us to return data outside of our contract, which
crashes in a worse, less useful way that if we catch things ourselves and
print useful debug information.

Reviewed By: quark-zju

Differential Revision: D6826454

fbshipit-source-id: 9cdb2987f762c98c6167ffcea03545bc46eb2119
2018-04-13 21:51:07 -07:00
Ryan McElroy
8cb6affc20 phabstatus: add two more tests showing unhandled errors
Summary: These cause tracebacks; grepped out for readability.

Reviewed By: DurhamG

Differential Revision: D6826450

fbshipit-source-id: 4ea27f0f30cd9ab97710a234f5a451912ccc55c1
2018-04-13 21:51:07 -07:00
Ryan McElroy
389ac72c31 phabstatus: mock full graphql response
Summary:
This will allow us to expose bugs in the graphql client code and
write tests to prevent future regressions. Note that this exposes a KeyError
bug when the response is malformed.

Having finally, we have arrived at full graphql responses both from the real
system and from mocking. We can now write tests more confidently.

Reviewed By: DurhamG

Differential Revision: D6826452

fbshipit-source-id: 4fd246fbafb353ce0138289262cbdfd0e9e35229
2018-04-13 21:51:07 -07:00
Ryan McElroy
83dd5f6841 phabstatus: no longer mock unused fields
Summary:
I do not know why all of these fields that we never checked were
mocked in the fist place.

Reviewed By: DurhamG

Differential Revision: D6826457

fbshipit-source-id: 78d336940b6146b61684c7789172298497c0b57f
2018-04-13 21:51:07 -07:00
Ryan McElroy
3fe4fbbda9 phabstatus: expand test to cover more code
Summary:
Previously, we mocked returns from the code that processed the
graphql data, but that code has some bugs that were therefore not testable.
Here we move the tests to return mock graphql data, so we can also test the
processing functions. In future commits, we will fix some of the possible
issues.

Reviewed By: DurhamG

Differential Revision: D6826453

fbshipit-source-id: 5a390723e48ccf2477295602dd85bd065c072bd3
2018-04-13 21:51:07 -07:00
Jun Wu
1cde63d99c codemod: drop hacks changing PYTHONPATH in tests
Summary:
Now they are unnecessary since `run-tests.py` will set up `PYTONPATH`
correctly.

Differential Revision: D6865042

fbshipit-source-id: ca95314f725968e14349a9d916434aa832c596f9
2018-04-13 21:51:00 -07:00
Francisco Massa
8efc997f51 phabricator-graphql: nice error message if ~/.arcrc is bad
Summary: When running hg ssl, if the .arcrc file is not proper JSON
(e.g., has a trailing comma), json.loads raises an exception that
was not being caught and lead to a stacktrace.

Test Plan: Locally run hg ssl with a bag .arcrc and the stack trace was gone.
Also write a test in test-fb-hgext-phabstatus.t

Reviewers: simonfar

Subscribers: luizmramos

Tasks: T24993088

Tags:
2018-01-12 10:46:25 +00:00
Phil Cohen
82285d3577 phabricator: move to extlib
Summary: Update import statements and code to match core linters.

Test Plan:
`run-tests.py -j8`

Source these versions of phabdiff.py, arcdiff.py, and phabstatus.py in my hgrc. Run hg st, diff, ssl and observe no crashes.

Reviewers: durham, rmcelroy, phillco, #mercurial

Reviewed By: rmcelroy

Subscribers: rmcelroy, quark, awestern

Differential Revision: https://phabricator.intern.facebook.com/D6680961

Signature: 6680961:1515578477:ea5f1591e390f6ca8a94f652daeb1db9de819fea
2018-01-10 08:39:19 -08:00