Commit Graph

11 Commits

Author SHA1 Message Date
timeless@gmail.com
cd35432d91 spelling: fix numerous spelling errors 2016-04-04 12:48:01 -07:00
Simon Farnsworth
64bdea2f34 Don't crash in phrevset if Conduit fails to return a description
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
2016-02-26 15:09:16 -08:00
Simon Farnsworth
f8b263fdd8 Don't crash in phrevset if Conduit replies before linear search completes
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
2016-01-21 08:11:13 -08:00
Laurent Charignon
a42808982c cleanup: fix the "line too long" warnings
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
2016-01-07 18:30:24 -08:00
Laurent Charignon
53a55a42c1 cleanup: fix legacy exception syntax
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
2016-01-07 18:30:24 -08:00
Laurent Charignon
b36541de7d cleanup: replace all the calls to util.Abort to error.Abort
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
2016-01-07 18:30:24 -08:00
Laurent Charignon
8f0e47e826 phrevset: fix because of changes in core
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
2015-05-12 11:14:44 -07:00
Delyan Kratunov
eea8a70884 [phrevset] Add ability to parse git revisions from Phabricator
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
2014-07-24 20:27:05 -07:00
Delyan Kratunov
c0418e22e8 [phrevset] Fix failing lookup
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
2014-07-24 19:36:09 -07:00
David Soria Parra
790e43474a Use a processgroup to ensure all arc subprocesses are properly killed
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
2013-12-12 14:49:04 -08:00
Delyan Kratunov
95f6d97e12 [hg] Add support for Differential revsets
Summary:
Add the ability to issue commands like

  hg log -r D12345

Supports already shipped commits (by parsing the SVN rev number and delegating to hgsubversion), as well as mercurial commits in various states

Test Plan:
Easier to show than tell:

  [delyank@dev1436 ~/www] arc feature test_diff_revset
  [delyank@dev1436 ~/www] echo "Don't commit me" > dontcommit.test
  [delyank@dev1436 ~/www] hg add dontcommit.test
  [delyank@dev1436 ~/www] hg commit -m "[test] Test commit"
  [delyank@dev1436 ~/www] arc diff
  [...]
  Created a new Differential revision:
          Revision URI: https://phabricator.fb.com/D1055569
  [...]

  [delyank@dev1436 ~/www] hg log --debug -r D1055569
  [diffrev] Getting diff from Conduit..done
  [diffrev] VCS is hg
  changeset:   587735:82d4de66e17bb3b92fe15df4eda8b8420b7ed074
  bookmark:    test_diff_revset
  tag:         tip
  phase:       draft
  [...]
  description:
  [test] Playing with conduit, don't commit
  [...]
  Differential Revision: https://phabricator.fb.com/D1055569

  [delyank@dev1436 ~/www] echo "No, really, don't" >> dontcommit.test
  [delyank@dev1436 ~/www] hg amend # change local hash
  [delyank@dev1436 ~/www] hg log --debug -r D1055569
  [diffrev] Getting diff from Conduit..done
  [diffrev] VCS is hg
  [diffrev] Traversing log for 1055569
  changeset:   587735:48565d21a43f730aa3b9cebccbb47fa406df557b
  bookmark:    test_diff_revset
  tag:         tip
  phase:       draft
  [...]
  description:
  [test] Playing with conduit, don't commit
  [...]
  Differential Revision: https://phabricator.fb.com/D1055569

  [delyank@dev1436 ~/www] hg log --debug -r D1053132 # a diff that's already been shipped
  [diffrev] Getting diff from Conduit..done
  [diffrev] VCS is svn
  changeset:   586857:61a4036e89bafefaba4de2ebe1190db999a8915d
  [...]
  description:
  [hashtagbot] Add the #filetask hashtag to Task Creeper
  [...]
  Differential Revision: https://phabricator.fb.com/D1053132

Reviewers: sid0, davidsp

Reviewed By: davidsp

CC: jhunt, davidsp

Differential Revision: https://phabricator.fb.com/D1055637

Task ID: 3159944
2013-11-15 14:55:42 -08:00