Summary:
We expected Phab to give us a description. It doesn't if the commit isn't yet landed; fix the bad assumption.
Fixes T10202515
Test Plan:
Run
```
: /data/users/simonfar/fbsource (hg) [remote/fbcode/stable]
: simonfar@devvm631 $ hg --config extensions.phrevset=~/fb-hgext/phrevset.py show D2677961
Commit not found - doing a linear search
```
Because this isn't a landed commit, it won't find it - but it will no longer crash.
Reviewers: rmcelroy
Reviewed By: rmcelroy
Subscribers: mjpieters, #sourcecontrol
Differential Revision: https://phabricator.fb.com/D2983019
Tasks: 10202515
Signature: t1:2983019:1456519582:07c44ec9c3794259d290210cfa730107b9a5cd11
Summary:
When converting a Diff number to a revset, phrevset would do a linear scan of the repo history for the most recent appearance of that Diff number (slow if it's an older commit or not present in this repo) and in parallel, query Phabricator Conduit to try and shortcut the process.
Unfortunately, if Conduit was quicker than the linear scan, we would crash because we can't handle a Conduit response for hg commits made when a Diff lands, or for any repo that doesn't have a callsign in hgrc.
Fix the crashes; don't bother calling Conduit if we can't handle any reasonable answer, and teach the hg branch to handle all reasonable answers.
Test Plan:
Check that the new extension does linear search unconditionally when it lacks a callsign:
```
: /data/users/simonfar/fbsource (hg) [90234606e65a2a04d042caba7cf5ee85a7a5466e]
: simonfar@devvm631 $ hg --config extensions.phrevset=/data/users/simonfar/fb-hgext/phrevset.py log -r D2750128
phrevset.callsign is not set - doing a linear search
changeset: 3c0e6756bed4d7330391719bcde52e7490499e53 D2750128
user: Yuhan Guo <yhguo@fb.com>
date: Thu, 07 Jan 2016 00:19:23 -0800
```
Check that it doesn't do a linear search in a repo with a callsign:
```
: /data/users/simonfar/www-hg (hg) [webacademy-graphql]
: simonfar@devvm631 $ echo -e '[phrevset]\ncallsign=E' >> .hg/hgrc
: /data/users/simonfar/www-hg (hg) [webacademy-graphql]
: simonfar@devvm631 $ hg --config extensions.phrevset=/data/users/simonfar/fb-hgext/phrevset.py log -r D2704940
changeset: 4b24ee6737b7e36523eb24c6406d689cc54aadf9 D2704940
user: xifanyan@2c7ba8d8-a2f7-0310-a573-de162e16dcc7
date: Mon, 30 Nov 2015 23:38:18 -0800
```
Check that it aborts cleanly if you give it a Diff from a different repo in a repo with a known callsign:
```
: /data/users/simonfar/www-hg (hg) [webacademy-graphql]
: simonfar@devvm631 $ hg --config extensions.phrevset=/data/users/simonfar/fb-hgext/phrevset.py log -r D2750128
abort: Diff callsign 'FBS' is different from repo callsign 'E'
```
Check that linear scan eventually aborts cleanly if you give it a Diff from a different repo (note: this step is slow - over a minute on my devvm):
```
: /data/users/simonfar/fbsource (hg) [90234606e65a2a04d042caba7cf5ee85a7a5466e]
: simonfar@devvm631 $ hg --config extensions.phrevset=/data/users/simonfar/fb-hgext/phrevset.py log -r D2704940
phrevset.callsign is not set - doing a linear search
abort: Could not find diff D2704940 in changelog
```
Reviewers: #sourcecontrol, rmcelroy, ttung, lcharignon
Reviewed By: lcharignon
Subscribers: lcharignon, kanishkparihar
Differential Revision: https://phabricator.fb.com/D2844832
Tasks: 9723813, 9714886
Signature: t1:2844832:1453321767:f445447d8187b4be22db3065ba316e6aa461f757
Summary: This diff is part of a series to cleanup fb-hgext and make it pass check-code.
Test Plan: all tests pass
Reviewers: #sourcecontrol, ttung
Differential Revision: https://phabricator.fb.com/D2811926
Summary: This diff is part of a series to cleanup fb-hgext and make it pass check-code.
Test Plan: all tests pass
Reviewers: #sourcecontrol, ttung
Differential Revision: https://phabricator.fb.com/D2811871
Summary: This diff is part of a series to cleanup fb-hgext and make it pass check-code.
Test Plan: all tests pass like before
Reviewers: #sourcecontrol, ttung
Differential Revision: https://phabricator.fb.com/D2811837
Summary:
phrevset: fix because of changes in core
Core changed the definition of stringset, it broke git and phabricator revset
that we define in fb-hgext. This is the same fix than the one we did for
the git revset.
Test Plan: N/A
Reviewers: durham, mitrandir
Differential Revision: https://phabricator.fb.com/D2065005
Summary:
We couldn't handle the git case (fbandroid-hg) at all. This fixes that.
I changed my .hg/hgrc to have
```[phrevset]
callsign = FA```
but I've no idea how to do that globally.
Test Plan:
```
[diffrev] Starting Conduit call
[diffrev] echo '{"revision_id": "1153911"}' | arc call-conduit differential.getdiff
[diffrev] Starting log walk
[diffrev] Traversing log for 1153911
[diffrev] Conduit call returned 0
[diffrev] VCS is git
[diffrev] GIT rev is 34838a7f1d68531f385e471bf76f89c6620ea563
Path: ssh://hg.vip.facebook.com//data/scm/fbandroid opts: {}
running ssh hg.vip.facebook.com 'hg -R /data/scm/fbandroid serve --stdio'
sending hello command
sending between command
remote: 199
remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch stream-preferred streamreqs=lz4revlog,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 remotefilelog
remote: 1
sending lookup command
[diffrev] HG rev is e67eac10eef35a21a3b61f8aa8caa330884d48d4
...
```
Reviewers: sid0, davidsp
Reviewed By: davidsp
Differential Revision: https://phabricator.fb.com/D1458491
Summary: phrevset was completely broken, even for the case where it does a linear search.
Test Plan:
Tested before and after in fbandroid-hg. It was finding the revision but
`hg log -r 'DXX'` wasn't printing anything.
Reviewers: sid0, davidsp
Reviewed By: davidsp
Differential Revision: https://phabricator.fb.com/D1458472
Summary:
phrevset can hang when the revwalk already returns a rev but
the parallel arc call didn't finish with arc having subprocesses running.
This will result in hg log showing output but hanging for a quiet a bit.
We have to use a processgroup and make arc the leader of it to kill
all it's subprocesses properly. Note this will make it incompatible
with windows.
Test Plan:
Tested locally and ensured that a differential revision is
found and we abort nicely.
Reviewers: durham
Reviewed By: durham
Differential Revision: https://phabricator.fb.com/D1096568