Commit Graph

1207 Commits

Author SHA1 Message Date
Jun Wu
e2e852370f linelogcli: add new command getalllines
Summary:
Since linelog has the new `getalllines` API, add a corresponding command
to support it.

Test Plan:
```
$ make && ./linelogcli /tmp/lll init annotate 0 replacelines 1 0:0 0:3 \
  replacelines 2 1:2 1:3 getalllines 0:0
init: okay
annotate: run annotate for rev 0
annotate: 0 lines, endoffset 1
replacelines: rev 1, lines 0:0 -> 0:3
replacelines: rev 2, lines 1:2 -> 1:3
getalllines: 5 lines
  0: rev 1, line 0, offset 3
  1: rev 2, line 1, offset 8
  2: rev 2, line 2, offset 9
  3: rev 1, line 1, offset 11
  4: rev 1, line 2, offset 5
```

Reviewers: #mercurial, simonfar, ttung

Reviewed By: simonfar

Subscribers: mjpieters

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

Signature: t1:3716453:1471265279:a8f625660ef47ca341ca8f5c4c7370b56277cef8
2016-08-15 12:47:14 +01:00
Jun Wu
d8d7af1727 linelog.pyx: add wrappers for the new API getallines
Summary:
Add `getoffset`, `getallines` to make the new C API `linelog_getalllines`
usable.

Test Plan: This helps the future smartfixup extension to pass its tests

Reviewers: #mercurial, ttung, mitrandir

Reviewed By: mitrandir

Subscribers: mjpieters

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

Signature: t1:3716447:1471262262:2ad8a547bf956c01e39be3383dc1a50751729c85
2016-08-15 12:45:58 +01:00
Jun Wu
b30c3ad0e5 linelog.pyx: fix copyfrom
Summary:
`copyfrom` does not work because `rhs.buf` is invisible to `self`. Adding
a `readonly` keyword fixes it. Also add some sanity checks and remove an
unnecessary `;`.

Test Plan: `make local` and confirm `copyfrom` works.

Reviewers: #mercurial, ttung, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

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

Signature: t1:3716444:1471264420:1e58798222e1515ae6d5328ad6f2727cfe41cdb5
2016-08-15 12:43:44 +01:00
Jun Wu
3258b8586d linelog.pyx: run clear and annotate an empty linelog automatically
Summary:
A newly created empty `linelog` object is not usable (i.e.  calling
`annotate` or `replacelines` will raise an error) until `clear` is called.
And `replacelines` won't work until `annotate` is called. Therefore if we
know it's an empty linelog, just call `clear` and `annotate(0)` in
`__init__` to make it more friendly to use.

Test Plan:
`make local`, and confirm
`__import__('linelog').linelog().replacelines(1, 0, 0, 0, 1)` works.

Reviewers: #mercurial, ttung, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

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

Signature: t1:3716442:1471262694:96370f5d3074bc0941e8ee780181c6b688cff79c
2016-08-15 12:41:13 +01:00
Jun Wu
2c9fffd80e linelog: add a new API getalllines
Summary:
The current linelog APIs are designed purely for the "annotate" operation.
It only supports getting lines from one single revisions, which is what
`annotate` does.

However the data structure is also useful to provide lines from different
revisions. Say if you want to know all lines from all revisions for a given
function. Or if you want to confirm if a chunk is "continuous" - nobody
inserts new lines among them. This diff adds the missing API, `getalllines`.

It returns information about all lines the linelog tracks. The caller could
provide an optional interval to limit the lines returned.

Its parameters use low-level raw offsets instead of line numbers, because it
gives the caller more control. The API don't need to handle open or close
interval issues that line numbers may have (see the previous diff about
deletion blocks).

This makes `lineinfo.offset` no longer internal-only - we have exposed the
offset concept to the API parameters. Therefore the comments are updated.

This also requires a clear way to distinguish unconditional jumps from
conditional one. We use `JGE 0` as unconditional jumps. To ensure this,
make `replacelines` reject 0 revision.

Test Plan: `cd linelog && make`

Reviewers: #mercurial, ttung, simonfar

Reviewed By: simonfar

Subscribers: mjpieters

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

Signature: t1:3716439:1471265245:5a4b2f585284cba71ca3907c8e8826b2b00a4b49
2016-08-15 12:31:29 +01:00
Jun Wu
c5819e914f linelog: extract appendline logic from annotate
Summary:
The `appendline` logic is used twice in `annotate`: inside and outside the
`for` loop. It will be used again in the following changes. Therefore make
it an inline function.

Test Plan: `cd linelog && make`

Reviewers: #mercurial, ttung, simonfar

Reviewed By: simonfar

Subscribers: mjpieters

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

Signature: t1:3716438:1471263197:6add9cfc0a9d712258dd2da332aaf306cb1af71a
2016-08-15 12:14:07 +01:00
Jun Wu
b48ea46da6 linelog: be conservative when deleting a chunk from an old revision
Summary:
This is a subtle change. Consider the following case, where revision 1 has 3
lines and revision 2 has 1 line inserted between the second and the third
lines of revision 1:

  0: +---- INSERTED BY REV 1
     |                          --+             --+
  1: |     LINE REV=1 LINENUM=0   | DEL BLOCK A   | DEL BLOCK B
  2: |     LINE REV=1 LINENUM=1   |               |
     |                          --+               |
  3: | +-- INSERTED BY REV 2                      |
  4: | |   LINE REV=2 LINENUM=2                   |
     | +--                                      --+
  5: |     LINE REV=1 LINENUM=2
     +----

Now what if the user has run `annotate(rev=1)` and wants to delete the first 2
lines, by calling `replacelines(a1=0, a2=2, ...)`?

The current code would use "DEL BLOCK B", which is more efficient because
the block contains more instructions, and more simple because it is just a
JGE to the a2 address.

While that works fine for the "appending" case (always edit new revisions),
it deletes future lines between the second and third line (in this case,
"LINE REV=2 LINENUM=2"). This is undesired by some users, namely smartfixup.

Surely we can add a boolean flag to the `replacelines` API to decide whether
A or B will be used. But that is too low-level and `replacelines` already
has too many parameters. Today we don't see other requirements to choose
between them precisely. Therefore, just change the default behavior, when
deleting chunks from old revisions to "DEL BLOCK A".

Test Plan: This change is needed to help pass the future smartfixup tests

Reviewers: #mercurial, ttung, simonfar

Reviewed By: simonfar

Subscribers: mjpieters

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

Signature: t1:3716435:1471262664:0ae40d95d6389db733a88d9fafe19962d9166e35
2016-08-15 12:08:06 +01:00
Jun Wu
0d3a392454 hgignore: ignore linelog non-source files
Summary: This diff adds an `.hgignore` file for the `linelog` directory.

Test Plan: `make local`, and run `hg status`, make sure no unwanted files are printed.

Reviewers: #mercurial, ttung, akushner

Reviewed By: akushner

Subscribers: mjpieters

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

Signature: t1:3699575:1471151389:7e4de7b75d671d3f0db18337e57c65e9972de059
2016-08-10 22:32:21 +01:00
Mateusz Kwapich
675561c76f sqldirstate: call the registered callbacks on wd parent change
Summary:
This diff together with patches introducing the mentioned callback in upstream
will fix the journal under sqldirstate.

Test Plan: journal tests passed, the rest is currently running - will update the test plan soon

Reviewers: #mercurial, ttung, durham

Reviewed By: durham

Subscribers: durham, mjpieters

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

Signature: t1:3690878:1470800077:3fe48e03bb65eaeed3a7326b6e7d392abe7efd8d
2016-08-15 03:46:52 -07:00
Zach Amsden
f1ecf43a83 Parallel callout to scmquery through conduit
Summary:
Parallel callout to scmquery through conduit
This implements the special case of log on a single directory, preserving
follow behavior.  To do this, we backtrackfrom the current head to find
 all draft revisions along the path, then find the common public ancestor of
those.  Once we find that, we can begin paging in results from the scmquery
service.

Pretty much a working diff at this point.  Limits and boundary conditions
have not been fully tested.  Every once in a while I run into a bum query,
which I suspect to be either a bad proxy or a service router failure; still
debugging that.  Could also be an issue with conduit.  Other than that,
things seem to work.

Test Plan:
Testing log with fastest setting (no revsets), revsets (using -M), and with extension disabled (--sparse):

  [zamsden@devbig192.prn1 ~/local/fbcode] time hg log tao --config extensions.fbconduit=~/local/fb-hgext/hgext3rd/fbconduit.py --config fbconduit.host=our.zamsden.devbig192.prn1.facebook.com --config extensions.fastlog=~/local/fb-hgext/hgext3rd/fastlog.py --pager=off -l 100 -M > a

  real	0m1.895s
  user	0m0.003s
  sys	0m0.004s
  [zamsden@devbig192.prn1 ~/local/fbcode] time hg log tao --config extensions.fbconduit=~/local/fb-hgext/hgext3rd/fbconduit.py --config fbconduit.host=our.zamsden.devbig192.prn1.facebook.com --config extensions.fastlog=~/local/fb-hgext/hgext3rd/fastlog.py --pager=off -l 100 > b

  real	0m1.308s
  user	0m0.005s
  sys	0m0.001s
  [zamsden@devbig192.prn1 ~/local/fbcode] diff a b
  [zamsden@devbig192.prn1 ~/local/fbcode] time hg log tao --config extensions.fbconduit=~/local/fb-hgext/hgext3rd/fbconduit.py --config fbconduit.host=our.zamsden.devbig192.prn1.facebook.com --config extensions.fastlog=~/local/fb-hgext/hgext3rd/fastlog.py --pager=off -l 100 --sparse > c

  real	0m7.320s
  user	0m0.004s
  sys	0m0.003s
  [zamsden@devbig192.prn1 ~/local/fbcode] diff a c




Testing --user option:



  [zamsden@devbig192.prn1 ~/local/fbsource] time hg log fbcode/dragon --config extensions.fbconduit=~/local/fb-hgext/hgext3rd/fbconduit.py --config fbconduit.host=our.zamsden.devbig192.prn1.facebook.com --config extensions.fastlog=~/local/fb-hgext/hgext3rd/fastlog.py --pager=off -l 5 -u dmitri > a

  real	0m2.765s
  user	0m0.002s
  sys	0m0.004s
  [zamsden@devbig192.prn1 ~/local/fbsource] time hg log fbcode/dragon --config extensions.fbconduit=~/local/fb-hgext/hgext3rd/fbconduit.py --config fbconduit.host=our.zamsden.devbig192.prn1.facebook.com --config extensions.fastlog=~/local/fb-hgext/hgext3rd/fastlog.py --pager=off -l 5 -u dmitri --sparse > b

  real	0m23.247s
  user	0m0.005s
  sys	0m0.001s
  [zamsden@devbig192.prn1 ~/local/fbsource] diff a b
  [zamsden@devbig192.prn1 ~/local/fbsource]



Testing same output enabled / disabled for -X option:



  [zamsden@devbig192.prn1 ~/local/fbsource] time hg log fbcode/lithium/ --config extensions.fbconduit=~/local/fb-hgext/hgext3rd/fbconduit.py --config fbconduit.host=our.zamsden.devbig192.prn1.facebook.com --config extensions.fastlog=~/local/fb-hgext/hgext3rd/fastlog.py --pager=off -l 20 -X '**TARGETS' > a

  real	0m1.292s
  user	0m0.002s
  sys	0m0.003s
  [zamsden@devbig192.prn1 ~/local/fbsource] time hg log fbcode/lithium/ --config extensions.fbconduit=~/local/fb-hgext/hgext3rd/fbconduit.py --config fbconduit.host=our.zamsden.devbig192.prn1.facebook.com --config extensions.fastlog=~/local/fb-hgext/hgext3rd/fastlog.py --pager=off -l 20 -X '**TARGETS' --sparse > b

  real	0m2.697s
  user	0m0.002s
  sys	0m0.004s
  [zamsden@devbig192.prn1 ~/local/fbsource] diff a b
  [zamsden@devbig192.prn1 ~/local/fbsource]



Testing -k option:



  [zamsden@devbig192.prn1 ~/local/fbsource] time hg log fbcode/lithium/ --config extensions.fbconduit=~/local/fb-hgext/hgext3rd/fbconduit.py --config fbconduit.host=our.zamsden.devbig192.prn1.facebook.com --config extensions.fastlog=~/local/fb-hgext/hgext3rd/fastlog.py --pager=off -k 'e' -X '**TARGETS' -l 10 > a

  real	0m1.174s
  user	0m0.003s
  sys	0m0.003s
  [zamsden@devbig192.prn1 ~/local/fbsource] time hg log fbcode/lithium/ --config extensions.fbconduit=~/local/fb-hgext/hgext3rd/fbconduit.py --config fbconduit.host=our.zamsden.devbig192.prn1.facebook.com --config extensions.fastlog=~/local/fb-hgext/hgext3rd/fastlog.py --pager=off -k 'e' -X '**TARGETS' -l 10 --sparse > b

  real	0m1.259s
  user	0m0.004s
  sys	0m0.002s
  [zamsden@devbig192.prn1 ~/local/fbsource] diff a b
  [zamsden@devbig192.prn1 ~/local/fbsource]



Testing -I option:



  [zamsden@devbig192.prn1 ~/local/fbsource] time hg log fbcode/scm/ --config extensions.fbconduit=~/local/fb-hgext/hgext3rd/fbconduit.py --config fbconduit.host=our.zamsden.devbig192.prn1.facebook.com --config extensions.fastlog=~/local/fb-hgext/hgext3rd/fastlog.py --pager=off -l 20 -I '**.py' > a

  real	0m1.473s
  user	0m0.005s
  sys	0m0.003s
  [zamsden@devbig192.prn1 ~/local/fbsource] time hg log fbcode/scm/ --config extensions.fbconduit=~/local/fb-hgext/hgext3rd/fbconduit.py --config fbconduit.host=our.zamsden.devbig192.prn1.facebook.com --config extensions.fastlog=~/local/fb-hgext/hgext3rd/fastlog.py --pager=off -l 20 -I '**.py' --sparse > b

  real	0m2.911s
  user	0m0.003s
  sys	0m0.002s
  [zamsden@devbig192.prn1 ~/local/fbsource] diff a b
  [zamsden@devbig192.prn1 ~/local/fbsource]




Testing multiple directory output in all three modes - revset, fast filtered, and forcing original fallback with --sparse



  [zamsden@devbig192.prn1 ~/local/fbsource] time hg log fbcode/hphp/hhvm fbcode/hphp/runtime/ --config extensions.fbconduit=~/local/fb-hgext/hgext3rd/fbconduit.py --config fbconduit.host=our.zamsden.devbig192.prn1.facebook.com --config extensions.fastlog=~/local/fb-hgext/hgext3rd/fastlog.py --pager=off -l 100 -M > a

  real	0m2.892s
  user	0m0.003s
  sys	0m0.006s
  [zamsden@devbig192.prn1 ~/local/fbsource] time hg log fbcode/hphp/hhvm fbcode/hphp/runtime/ --config extensions.fbconduit=~/local/fb-hgext/hgext3rd/fbconduit.py --config fbconduit.host=our.zamsden.devbig192.prn1.facebook.com --config extensions.fastlog=~/local/fb-hgext/hgext3rd/fastlog.py --pager=off -l 100 > b

  real	0m2.575s
  user	0m0.697s
  sys	0m0.077s
  [zamsden@devbig192.prn1 ~/local/fbsource] time hg log fbcode/hphp/hhvm fbcode/hphp/runtime/ --config extensions.fbconduit=~/local/fb-hgext/hgext3rd/fbconduit.py --config fbconduit.host=our.zamsden.devbig192.prn1.facebook.com --config extensions.fastlog=~/local/fb-hgext/hgext3rd/fastlog.py --pager=off -l 100 --sparse > c

  real	0m7.339s
  user	0m0.003s
  sys	0m0.004s
  [zamsden@devbig192.prn1 ~/local/fbsource] diff a b
  [zamsden@devbig192.prn1 ~/local/fbsource] diff a c
  [zamsden@devbig192.prn1 ~/local/fbsource]

Reviewers: rmcelroy, #scmquery, #mercurial, ttung, lcharignon, durham, stash

Reviewed By: stash

Subscribers: cdykes, lcharignon, quark, stash, mjpieters, jeroenv

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

Tasks: 12341014

Signature: t1:3634075:1471039212:0989839636847a8e5da6a0ef9150035fcf5bb797
2016-08-12 15:52:50 -07:00
Jun Wu
8813967d50 linelog: add a test editing lines randomly
Summary:
The test will call "replacelines" with random arguments, keeps track of the
content of "lines" on its own. Then it compares its own "lines" with linelog's
annotateresult - should be the same. After that, it verifies the content of
old revisions can be retrieved by using "annotate" correctly.

Test Plan: Run this test

Reviewers: #mercurial, ttung, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

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

Signature: t1:3709431:1471012434:68ca06c0b3b2705740375c32acac8012ded404a5
2016-08-12 15:22:16 +01:00
Jun Wu
5b0b861096 sshaskpass: make the prompt similar to systemd
Summary:
This diff makes the prompt similar to what systemd does. See the screenshot:

{F62774663}

It solves an issue that with echo disabled, the user won't know whether they
have pressed ENTER or not - the cursor won't move. Now it explicitly prints
"AUTHENTICATION COMPLETE".


Test Plan: As the screenshot, and also run the sshaskpass test.

Reviewers: #mercurial, ttung, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

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

Signature: t1:3705703:1471008095:863ff9820b87ea3f4631295b10472802fb5e459f
2016-08-11 21:56:31 +01:00
Jun Wu
d4366acbd5 sshaskpass: use a standalone script
Summary:
Before this patch, sshaskpass will set SSH_ASKPASS to itself, aka. `__file__`.
This won't work if sshaskpass.py gets installed by setup.py because setup.py
will remove its `+x` bit.

Test Plan:
Run `chg push -r . ssh://root@localhost//tmp/foo -f --allow-ano` and make
sure ssh password prompt works.

Reviewers: #mercurial, ttung, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

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

Signature: t1:3705657:1471008122:9cfa3adf078e4bbe8f6b6ba05d1fb6be513d3e71
2016-08-11 21:42:54 +01:00
Jun Wu
6015a95c00 tweakdefaults: make "bookmarks" use the unfiltered repo
Summary:
We are seeing perf issues with hidden/obsolete handling.
`hg bookmark` is a frequently used command and by making it use the unfiltered
repo, it could be 200ms-300ms faster.

Test Plan: Added a new test

Reviewers: #mercurial, mitrandir, ikostia, ttung

Reviewed By: mitrandir, ikostia

Subscribers: mitrandir, rmcelroy, akushner, mjpieters

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

Signature: t1:3692968:1470777864:72ad5d0ffb52ecfcaaa607082693b88319d778fd
2016-08-11 18:43:06 +01:00
Ryan McElroy
2a07de293c tests: import simplecache from correct place 2016-08-11 06:33:47 -07:00
Ryan McElroy
3682450721 tests: update pushrebase test with new string 2016-08-11 06:33:47 -07:00
Jun Wu
5cd2c64da0 setup: build linelog
Summary:
This diff builds linelog. It brings Cython as a build dependency as linelog
CPython wrapper is written in Cython. Alternatively we can check in the
generated, non-human-readable `.c` code if we get feedback that the Cython
dependency is making things hard.

Note that `setuptools` (Python 2.6 version) has issues with Cython therefore
removed.

Test Plan: `make local`, then check `linelog.so` is built and `import linelog` works.

Reviewers: #mercurial, rmcelroy, ttung

Reviewed By: rmcelroy

Subscribers: mjpieters

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

Signature: t1:3669753:1470403459:5bf81861b31deed5076c2322c4015d5dd4b4673e
2016-08-10 22:26:05 +01:00
Jun Wu
cf9686ff3a morestatus: rebase takes precedence over update
Summary:
This happens when pressing Ctrl+C during "hg rebase". We should show
"interrupted rebase" instead of "interrupted update".

Test Plan: Added a new test

Reviewers: ttung, #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

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

Signature: t1:3697984:1470863868:acd67eeb5099c73ea7df174b3e1dbcbf9ac54944
2016-08-10 22:19:30 +01:00
Jun Wu
e4089b5388 linelog: resolve compiler warnings
Summary:
This diff resolves some warnings when building on CentOS 6:

```
linelog/pyext/../linelog.c: In function 'replacelines':
linelog/pyext/../linelog.c:290: warning: unused variable 'result'
....
linelog/pyext/linelog.c: In function '__pyx_f_7linelog_11_filebuffer_resize':
linelog/pyext/linelog.c:3253: warning: ignoring return value of 'ftruncate', declared with attribute warn_unused_result
```

Test Plan:
Run `make local` with the linelog `setup.py` patch applied and make sure
there are no warnings.

Reviewers: #mercurial, rmcelroy, ttung

Reviewed By: rmcelroy

Subscribers: mjpieters

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

Signature: t1:3699378:1470863807:10dc21033ab7301cb3d56e04de1c96f4d0287b6e
2016-08-10 22:18:59 +01:00
Jun Wu
a48ff14ebc Backed out changeset bc26655b5a81
Summary:
D3699216 made linelog compatible with C99. Therefore no longer to check if the
compiler supports `-std=c11` or not.

Test Plan: `make local`

Reviewers: #mercurial, ttung, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

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

Signature: t1:3699242:1470863312:934e1105f2c7959b6c78724bae93da879a897dd1
2016-08-10 22:16:24 +01:00
Jun Wu
47b43030bc linelog: be compatible with gcc 4.4
Summary:
It's "Unnamed unions", a C11 feature.

Although it improves the code readability a bit, gcc 4.4 does not have a
complete for it. Since we have to support gcc 4.4 now, use plain `struct`
instead.

Test Plan: Run `cd linelog && make local` using gcc 4.4

Reviewers: #mercurial, ttung, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

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

Signature: t1:3699216:1470862720:85ee1c4f8c63805aeffca1048ff330b91a096222
2016-08-10 22:02:24 +01:00
Jun Wu
9bc284757e linelog.pyx: implement the main linelog class
Summary:
Finally! This is the linelog class for CPython users. It has all linelog APIs
exposed but hides low-level details about `linelog_buf` and `annotateresult`.

It could use either `_memorybuffer` or `_filebuffer` as the underlying
`linelog_buf`. With `copyfrom`, it has the flexibility to exchange data
between disk and memory.

Test Plan: `cython linelog.pyx`

Reviewers: #mercurial, ttung, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

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

Signature: t1:3662882:1470403425:c17bf2595edc88bc24e328524607f4ede6bbd2a5
2016-08-10 21:17:21 +01:00
Jun Wu
c14c36aa26 linelog.pyx: implement file buffer
Summary: The file buffer uses `mmap` for `linelog_buf::data`.

Test Plan: `cython2 linelog.pyx`

Reviewers: #mercurial, rmcelroy, ttung

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

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

Signature: t1:3662790:1470860125:b68fc5e3ed14d56fbebe8a7de81ad7f67a622875
2016-08-10 21:15:43 +01:00
Jun Wu
97079280bf linelog.pyx: implement memory buffer
Summary:
The memory buffer implements `_buffer.resize` using `realloc`,
making linelog useful for in-memory modifications. For example,
the `smartfixup` extension (D3264203) would use an in-memory
linelog to avoid expensive merge operations and possible merge
conflicts.

Test Plan: `cython2 linelog.pyx`

Reviewers: #mercurial, ttung, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

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

Tasks: 11291522

Signature: t1:3655491:1470402602:891fade362c8e0f6a3af64f1fbdfa0fbf556e68b
2016-08-10 18:54:55 +01:00
Tony Tung
eb4da8bafd [cfastmanifest] add PyObject_Del to dealloc method
Summary: It's actually desirable!  Removed the suspicious comment.

Test Plan: make local

Reviewers: #fastmanifest, lcharignon

Reviewed By: lcharignon

Subscribers: mitrandir, mjpieters

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

Signature: t1:3689658:1470765228:dc1af38e4b7931802e1adfea31486860d81dbed9
2016-08-09 13:47:49 -07:00
Jun Wu
ceeb7ccfb8 linelogcli: add code for fuzz testing
Summary:
This diff adds a check: after `linelog_updatelines`, `annotateresult *ar`
should be updated as if we have called a separate `linelog_annotate`.

Test Plan:
Run `afl` for a while and make sure it does not find any crashes:

```
mkdir ./testdir
CC=afl-gcc make
./linelogcli ./testdir/readme init annotate 0 replacelines 10 0:0 0:3 replacelines 20 2:2 1:3 replacelines 30 1:3 1000:1000
afl-fuzz -i testdir -o findingdir ./linelogcli @@ dump annotate 10 replacelines 10 0:0 0:3 replacelines 20 2:2 1:3 replacelines 30 1:3 1000:1000
```

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: mjpieters

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

Signature: t1:3650197:1470336333:2f5e6d2e914917b33bddc595344d2a0b98067606
2016-07-30 12:59:48 +01:00
Jun Wu
be85f6a51b linelog: add a boundary check about annotateresult
Summary:
Previously, `replacelines` assume the `annotateresult` user passed has the
property: `linecount < maxlinecount`. But that's not true after
`linelog_annotateresult_clear`, where `linecount = maxlinecount = 0` and
that leads to `SIGSEGV` if both `a1` and `a2` passed to `replacelines` are `0`.

This issue was found by the following `afl` testcase:

  ./linelogcli ./testdir/readme init annotate 0 replacelines 10 0:0 0:3 replacelines 20 2:2 1:3 replacelines 30 1:3 1000:1000
  afl-fuzz -i testdir -o findingdir ./linelogcli @@ dump annotate 10 replacelines 10 0:0 0:3 replacelines 20 2:2 1:3 replacelines 30 1:3 1000:1000

Test Plan:
Run the above `afl` test. Make sure it won't report a crash in a couple
of minutes.

Reviewers: #mercurial, ttung, simonfar

Reviewed By: simonfar

Subscribers: mjpieters

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

Signature: t1:3676049:1470661720:e5c4d6f45ac51d58fae856b08f79982bec44b535
2016-08-05 17:55:46 +01:00
Tony Tung
568dc0d745 [fastmanifest] inline a bunch of ifastmanifest* methods
Summary: Most of them are pretty simple and don't need to be standalone functions.

Test Plan:
```
[andromeda]:~/work/mercurial/facebook-hg-rpms/fb-hgext:ae2ccaa> make local
<snipped>
[andromeda]:~/work/mercurial/facebook-hg-rpms/fb-hgext:ae2ccaa> cd tests/
[andromeda]:~/work/mercurial/facebook-hg-rpms/fb-hgext/tests:ae2ccaa> PYTHONPATH=~/work/mercurial/facebook-hg-rpms/remotenames/:~/work/mercurial/facebook-hg-rpms/mutable-history/hgext  python ~/work/mercurial/facebook-hg-rpms/hg-crew/tests/run-tests.py -j32 test-fastmanifest*.{py,t}
.........
# Ran 9 tests, 0 skipped, 0 warned, 0 failed.
[andromeda]:~/work/mercurial/facebook-hg-rpms/fb-hgext/tests:ae2ccaa>
```

Reviewers: #fastmanifest, durham

Reviewed By: durham

Subscribers: durham, mjpieters, mitrandir

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

Signature: t1:3659242:1470340089:e1a569ce05bc3d40af043369b7bc4c76616f5b88
2016-08-08 23:28:18 -07:00
Oguz Ulgen
585ede8a25 Add sync status and change the conduit call to differential.querydiffhashes
Summary:
1) Add sync status
2) Combine sync status and phab status to use one unified conduit call,
i.e. differential.querydiffhashes

Test Plan:
cd hg-crew
make local
cd ../fb-hgext
make local
cd tests
../../hg-crew/tests/run-tests.py test-phabstatus.t
../../hg-crew/tests/run-tests.py test-syncstatus.t

Reviewers: wqfish, lcharignon, #sourcecontrol, wez, ttung, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

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

Tasks: 10100400

Signature: t1:3651915:1470340328:bf003006f6afe9b86a40f204e150e0d12350c21d
2016-08-05 11:33:36 -07:00
Jun Wu
4f1d1c3291 rage: filter "FM:" from blackbox.log
Summary:
Fastmanifest debug logs in blackbox.log are less interesting in a rage report,
but they take a lot of lines. This diff uses `grep` to filter them out from rage report.

Test Plan: `hg rage --preview`

Reviewers: #mercurial, ttung

Reviewed By: ttung

Subscribers: mjpieters

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

Signature: t1:3676751:1470421349:3b5e0cb4118473f5550e83bf9c5e7ac27a59bcb0
2016-08-05 19:17:45 +01:00
Jun Wu
a4dd17d71c linelog.pyx: add a thin wrapper around linelog_buf
Summary:
The thin wrapper defines common APIs like `resize` `flush`, `close`, and
`copyfrom`. Some of them are used in sub-classes. It also handles
`LINELOG_RESULT_ENEEDRESIZE` and raise `LinelogError` for other errors.

Test Plan: `cython2 linelog.pyx`

Reviewers: #mercurial, ttung, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

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

Tasks: 11291522

Signature: t1:3655463:1470402560:75e552ed3d6205ae45812d1cdfe7bc14cfb1eec3
2016-08-02 13:40:27 +01:00
Jun Wu
ce97ea9aaf linelog.pyx: declare linelog functions
Summary:
`linelog.pyx` is meant to be the CPython wrapper for linelog.

This diff declares types and functions in `linelog.h`.

According to http://docs.cython.org/en/latest/src/userguide/external_C_code.html,
we have to duplicate them as Cython cannot parse `.h` files.

Test Plan: `cython2 linelog.pyx`

Reviewers: #mercurial, ttung, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

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

Tasks: 11291522

Signature: t1:3655437:1470336663:802ede2b82790a6c901ba0cc76c4f39fcac1e6ac
2016-08-02 13:21:08 +01:00
Jun Wu
c1e8b25355 linelogcli: a simple CLI tool for linelog
Summary:
The `linelogcli` tool exposes linelog APIs to command line:

  - `linelogcli file init`: create a linelog file
  - `linelogcli file annotate rev`: run annotate
  - `linelogcli file replacelines rev a1:a2 b1:b2`: replace lines
  - `linelogcli file info`: show maxrev and buffer size
  - `linelogcli file dump`: dump human-readable instructions

It's designed for (fuzz) testing, memory leak checking. It's also
a basic tool for developers to investigate a linelog file.

It's not designed for end users and we will have a separate Python wrapper
implemented in Cython for mercurial integration. Therefore reviewers are
recommended to be less strict for this implementation.

Test Plan:
`make` and test some basic operations:

```
$ ./linelogcli /tmp/foo init annotate 0 replacelines 1 0:0 0:4 annotate - replacelines 2 1:2 10:13 annotate - replacelines 3 2:6 20:22 annotate - replacelines 4 0:4 30:31 annotate - annotate 2 info dump
init: okay
annotate: run annotate for rev 0
annotate: 0 lines, endoffset 1
replacelines: rev 1, lines 0:0 -> 0:4
annotate: 4 lines, endoffset 7
  0: rev 1, ln 0, offset 3
  1: rev 1, ln 1, offset 4
  2: rev 1, ln 2, offset 5
  3: rev 1, ln 3, offset 6
replacelines: rev 2, lines 1:2 -> 10:13
annotate: 6 lines, endoffset 7
  0: rev 1, ln 0, offset 3
  1: rev 2, ln 10, offset 9
  2: rev 2, ln 11, offset 10
  3: rev 2, ln 12, offset 11
  4: rev 1, ln 2, offset 5
  5: rev 1, ln 3, offset 6
replacelines: rev 3, lines 2:6 -> 20:22
annotate: 4 lines, endoffset 7
  0: rev 1, ln 0, offset 3
  1: rev 2, ln 10, offset 9
  2: rev 3, ln 20, offset 16
  3: rev 3, ln 21, offset 17
replacelines: rev 4, lines 0:4 -> 30:31
annotate: 1 lines, endoffset 7
  0: rev 4, ln 30, offset 22
annotate: run annotate for rev 2
annotate: 6 lines, endoffset 7
  0: rev 1, ln 0, offset 24
  1: rev 2, ln 10, offset 9
  2: rev 2, ln 11, offset 19
  3: rev 2, ln 12, offset 11
  4: rev 1, ln 2, offset 5
  5: rev 1, ln 3, offset 6
info: maxrev = 4, size = 208
dump:
       1: J          2
       2: JL       1 7
       3: J          21
       4: J          8
       5: LINE     1 2
       6: LINE     1 3
       7: END
       8: JL       2 12
       9: LINE     2 10
      10: J          15
      11: LINE     2 12
      12: JGE      2 5
      13: LINE     1 1
      14: J          5
      15: JL       3 18
      16: LINE     3 20
      17: LINE     3 21
      18: JGE      3 7
      19: LINE     2 11
      20: J          11
      21: JL       4 23
      22: LINE     4 30
      23: JGE      4 7
      24: LINE     1 0
      25: J          4
```

Also run with `valgrind  --tool=memcheck --leak-check=yes` to make sure there is no memory leak.

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

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

Signature: t1:3645102:1470335856:860a7dbb1781f6fe1e11e235ad163e2fbb6d45b2
2016-07-30 12:59:17 +01:00
Durham Goode
710b823419 statprof: prevent divide by zero error if there are no samples 2016-08-05 10:05:13 -07:00
Jun Wu
6ec93f77f1 linelog: implement linelog_replacelines
Summary: This is the core API to do writes.

Test Plan: `gcc -Wall -Wextra -Wconversion -c linelog.c`

Reviewers: #mercurial, ttung, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

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

Tasks: 12416202

Signature: t1:3641637:1470335236:758df55835ac6c42212783d4cc12302588ce2216
2016-07-29 13:43:55 +01:00
Mateusz Kwapich
c46b67bc21 sqldirstate: maintain cache on resetnow
Summary:
properly updates the lookupcache and cached nonnormalset
on resetnow operation. This fixes test failures observed by durham

Test Plan:
    $ ./run-sqlitedirstate-test.py --hg ~/facebook-hg-rpms/hg-crew/ test-import-eol.t   test-commit-multiple.t test-commit-interactive-curses.t
    ...
    # Ran 3 tests, 0 skipped, 0 warned, 0 failed.

Reviewers: durham

Subscribers: mjpieters, #mercurial

Differential Revision: https://phabricator.intern.facebook.com/D3669783
2016-08-04 11:33:23 -07:00
Durham Goode
16dcd18231 sqldirstate: add cache
Summary: Maintains the lookupcache across edit operations and builds the cache fully after 10,000 reads. This helps cap the overhead of doing sqlreads.

Test Plan:
Ran a large hg update followed by hg status and verified that the status call took 10 seconds instead of 60 seconds.

```
~/local/fbsource> time hg.real up master --profile && sleep 60 && sync && time hg.real status --pager=off
62093 files updated, 0 files merged, 6740 files removed, 0 files unresolved

real    2m24.262s
user    0m52.124s
sys     0m13.462s

real    1m2.942s
user    0m48.617s
sys     0m12.631s

~/local/fbsource> time hg.real up master~50000 --profile && sleep 60 && sync && time hg.real status --pager=off --config extensions.sqldirstate=../fb-hg
ext/sqldirstate/
49029 files updated, 0 files merged, 19804 files removed, 0 files unresolved

real    1m29.619s
user    0m47.244s
sys     0m12.264s

real    0m10.269s
user    0m7.964s
sys     0m0.842s
```

Reviewers: mitrandir

Reviewed By: mitrandir

Subscribers: mjpieters

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

Signature: t1:3659071:1470177313:9af93af70fdbd5929b97879b58553a3cea415c19
2016-08-04 11:33:23 -07:00
Jun Wu
bdb47a171c ownercheck: new extension to prevent operations on repos not owned
Summary:
This is mainly to address the same issue as D3609747: prevent issues caused
by running hg as root. The difference is this extension reads owner and uid
dynamically without config when initializing of a localrepo object.

As a side effect it covers more situations like running hg in others' repos, while
being less restrictive for some other commands like `sudo hg version`.

Test Plan: Added a new test

Reviewers: #mercurial, ttung, rmcelroy

Reviewed By: rmcelroy

Subscribers: ikostia, rmcelroy, mjpieters

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

Tasks: 11723374

Signature: t1:3619997:1470176448:beaf53c09fca498206767641ffa4315a744ee07e
2016-07-26 13:10:15 +01:00
Jun Wu
978c03ef18 linelog: implement linelog_annotate
Summary:
Implement `linelog_annotate`, which is the core algorithm for generating
`linelog_annotateresult`. It is basically walking though and executing
the instructions.

Test Plan: `gcc -Wall -Wextra -Wconversion -c linelog.c`

Reviewers: #mercurial, ttung, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

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

Tasks: 12416202

Signature: t1:3629591:1470157936:764bb7c5d1208e73d93d26063a8ad380dbceb495
2016-07-27 19:37:41 +01:00
Jun Wu
28e914db8e linelog: implement trivial APIs
Summary: Implement the trivial APIs declared in D3628681.

Test Plan:
`gcc -Wall -Wextra -Wconversion -c linelog.c` and it only reports
"defined but not used" warnings.

Reviewers: #mercurial, ttung, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

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

Tasks: 12416202

Signature: t1:3629389:1470087604:5b5a536630a6866df52d51fd163ed8f5301c734b
2016-07-27 19:25:31 +01:00
Jun Wu
a84fdfb62a linelog: add a helper function to resize linelog_annotateresult.lines
Summary:
As mentioned in D3628571, the `.c` code manages the memory of
`linelog_annotateresult.lines`. We need a resize function for it.

Test Plan:
`gcc -Wall -Wextra -Wconversion -c linelog.c` and it only reports
"defined but not used" warnings.

Reviewers: #mercurial, ttung, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

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

Tasks: 12416202

Signature: t1:3629350:1470055356:01993a6df2ccd849ed01961eb996c86bb0a17c78
2016-07-27 19:16:03 +01:00
Jun Wu
ac5824243b linelog: add types and helpers for internal linelog instruction structure
Summary:
As described in the README (D3628440), the linelog buffer is an array of
instructions. The `.h` file only declares the plain buffer but not the
internal representation of the instruction. They are intended to be
invisible to users.

This diff declares the instruction structure, related types and helpers in
`linelog.c`. `decode` and `encode` translate between the internal (`.c`,
structured `linelog_inst`) and the external (`.h`, plain `linelog_buf`)
representation. Other macros are to help making code shorter and easier to
understand.

Test Plan: `gcc -Wall -Wextra -Wconversion -c linelog.c`

Reviewers: #mercurial, ttung, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

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

Signature: t1:3629132:1470157631:4523c53a3af28061828980845d3acfbd82c58361
2016-07-27 19:31:59 +01:00
Jun Wu
f918aa6566 linelog: declare core APIs
Summary:
Declare core APIs for linelog:
- `annotate`, the "read" part
- `replacelines`, the "write" part

As mentioned in D3334518, this is part of a rewrite of D3334518.
These 2 APIs are the only ones involving core logic of the linelog structure.

Test Plan: `gcc -Wall -Wextra -Wconversion linelog.h`

Reviewers: #mercurial, zamsden, ttung, simonfar

Reviewed By: simonfar

Subscribers: akushner, zamsden, simonfar, mjpieters

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

Tasks: 12416202

Signature: t1:3628848:1470080022:1f434d998c0bf63a494f70d47bc6a6fc05954446
2016-07-29 00:49:38 +01:00
Jun Wu
d268bb5675 linelog: declare trivial APIs
Summary:
Declare some trivial APIs, which either clear the memory or return a value
without much calculation.

Test Plan: `gcc -Wall -Wextra linelog.h`

Reviewers: #mercurial, simonfar, ttung

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

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

Tasks: 12416202

Signature: t1:3628681:1469647679:437db1610dec8a21a71b2d94c64d6d085321e1cd
2016-07-27 17:54:07 +01:00
Jun Wu
4f76b602eb linelog: declare data structures
Summary:
Add essential data structures for upcoming APIs.

This is part of a rewrite of D3334518. The new API removes everything about
I/O (aka. `stdio.h`) and makes it the caller's responsibility to prepare
(`malloc` or `mmap`) and resize the memory buffer.

This makes it possible to have a much shorter (thus easier to review) code
more dedicated to core algorithm, as the following are no longer necessary:

- I/O related APIs: `open`, `close`, `flush`, `saveas`
- I/O error handling

The error handling part is also changed that we now can use integer error
numbers instead of a boolean value + an error string.

Test Plan: `gcc -Wall -Wextra linelog.h`

Reviewers: #mercurial, ttung, simonfar

Reviewed By: simonfar

Subscribers: durham, simonfar, mjpieters

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

Tasks: 12416202

Signature: t1:3628571:1469643667:4fbf4fd7e624820ee6d8409e2067c8bd0e99a829
2016-07-27 17:39:20 +01:00
Jun Wu
68e5a15af7 linelog: add a README explaining the file format
Summary: This should help reviewers.

Test Plan: Run some spell checkers.

Reviewers: #mercurial, simonfar, ttung

Reviewed By: simonfar

Subscribers: mpm, akushner, ikostia, simonfar, mjpieters

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

Tasks: 12416202

Signature: t1:3628440:1469640270:a44f682e22b59615d0d9f12c93417c905b035ab6
2016-07-27 17:12:15 +01:00
Jun Wu
6fa80e5cca linelog: add empty source files
Summary: Add (almost) empty `.c` and `.h` files with uninteresting headers.

Test Plan: Code review

Reviewers: #mercurial, mitrandir, ttung

Reviewed By: mitrandir

Subscribers: mjpieters

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

Tasks: 12416202

Signature: t1:3620623:1469560977:d05a2781499783a2238f602025e6765ad52c6f00
2016-07-26 16:58:19 +01:00
Tony Tung
ac2510f68f [fastmanifest] remove lmiter struct
Summary: It's the same as the fmiter struct.  *clowntown*

Test Plan: `make local && cd tests && PYTHONPATH=~/work/mercurial/facebook-hg-rpms/remotenames/:~/work/mercurial/facebook-hg-rpms/mutable-history/hgext  python ~/work/mercurial/facebook-hg-rpms/hg-crew/tests/run-tests.py -j32 test-fastmanifest*.{py,t}`

Reviewers: #fastmanifest, durham

Reviewed By: durham

Subscribers: mitrandir, mjpieters

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

Signature: t1:3656960:1470175548:b313a8b745113ba4d773acd9e8da4add1f1a2567
2016-08-02 15:36:14 -07:00
Tony Tung
a7555791cd [fastmanifest] fix unhexlify
Summary:
Strictly speaking, it doesn't care if it's the length is SHA1_BYTES * 2.  It just has to be even.

Also, size_t comes from stddef.h.

Test Plan: make local

Reviewers: durham, lcharignon

Subscribers: mitrandir, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3626828
2016-08-02 15:35:49 -07:00
Tony Tung
c0e7082b92 [reporootlog] report the repo root to the scm wrappers
Summary:
The SCM wrappers do not have a reliable and easy way of detecting the repo root.  For instance, if someone does hg log /full/path/to/repo/content, we cannot actually determine that /full/path/to/repo is the repo root.  We have to somehow integrate an overly large portion of mercurial's commmand parsing infrastrastructure to accomplish this.

However, since mercurial knows the repo root, just extract that knowledge and send it down to the client.

Test Plan:
```
[dev8692]:~> USE_DIST_HG= FB_HG_DIAGS= hg log --config 'sampling.key.reporootlog=perfpipe_dev_command_timers' --config 'extensions.reporootlog=work/facebook-hg-rpms/fb-hgext/hgext3rd/reporootlog.py'  work/facebook-hg-rpms/smoketest.sh
chg: enabled by /etc/mercurial/usechg

<snipped for brevity>

internal stats file: /tmp/scm-internal-stats5BoW29
hg profiling mode: LSPROFILER
stats: {
    "int": {
        "builddate": 1469712764,
        "cachehitratio": 50,
        "consumed": 302,
        "diffcachehitratio": -1,
        "elapsed": 130,
        "errorcode": 0,
        "filesnotincachehitratio": -1,
        "time": 1469819716
    },
    "normal": {
        "chg": "true",
        "command": "log",
        "evolution": "createmarkers",
        "evolutionext": "-*- empty -*-",
        "fastmanifest": "-*- empty -*-",
        "filesystem": "",
        "fsmonitor_ext": "-*- not present -*-",
        "fsmonitor_mode": "on",
        "fullcommand": "\/usr\/bin\/hg log --config sampling.key.reporootlog=perfpipe_dev_command_timers --config extensions.reporootlog=work\/facebook-hg-rpms\/fb-hgext\/hgext3rd\/reporootlog.py work\/facebook-hg-rpms\/smoketest.sh",
        "generaldelta": "false",
        "host": "dev8692.prn1",
        "iftype": "disconnected",
        "interactive": "true",
        "kernel": "4.0.9-30_fbk4_2311_gd3e5a5c",
        "metrics_type": "fastmanifest-filesnotincachehitratio",
        "msg": "",
        "parent": "\/bin\/bash",
        "remotefilelog": "false",
        "repo": "work\/facebook-hg-rpms",
        "scm": "hg",
        "sid": "",
        "source": "hg",
        "sqldirstate": "false",
        "sqldirstate_enabled": "-*- not present -*-",
        "sqldirstate_loaded": "-*- empty -*-",
        "sqldirstate_upgrade": "True",
        "sshclient": "localhost",
        "tw_job_cluster": "",
        "tw_job_name": "",
        "tw_job_user": "",
        "tw_oncall_team": "",
        "tw_task_id": "",
        "user": "ttung",
        "version": "3.8.4+443-d0746b"
    }
}
[dev8692]:~>
```

Without this change, the repo would be "unknown-repo":

```
[dev8692]:~> USE_DIST_HG= FB_HG_DIAGS= hg log --config 'sampling.key.reporootlog=perfpipe_dev_command_timers' work/facebook-hg-rpms/smoketest.sh 2>&1 | grep repo
        "fullcommand": "\/usr\/bin\/hg log --config sampling.key.reporootlog=perfpipe_dev_command_timers work\/facebook-hg-rpms\/smoketest.sh",
        "repo": "unknown-repo",
[dev8692]:~>
```

Reviewers: #mercurial, rmcelroy, quark

Reviewed By: quark

Subscribers: quark, mitrandir, mjpieters

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

Tasks: 11194713

Signature: t1:3643342:1470163958:8d56291dad575c7ea7186cf5d00420798c5303ab
2016-08-02 11:59:52 -07:00