Commit Graph

1748 Commits

Author SHA1 Message Date
Adam Simpkins
a25e35bc50 [tweakdefaults] fix handling of grep file pattern arguments
Summary:
Previously grep only searched in the current directory, even if you gave it a
pattern like "../".  This fixes the code to correctly honor the arguments, and
to accept mercurial file patterns just like most other mercurial commands.

This does change the file parsing behavior somewhat: previously "hg grep" would
treat all arguments as glob patterns.  Now you explicitly have to say
"glob:<pattern>" to get glob matching.  However, I suspect this won't impact
most users, since they would normally let their shell perform glob expansion
before the arguments are given to mercurial.

Test Plan:
Included new unit tests for grep, and updated the existing tests that were
affected by the change in glob behavior.

Reviewers: #sourcecontrol, durham, carenthomas, ttung, rmcelroy

Reviewed By: rmcelroy

Subscribers: quark, mwilliams, matthieu, meyering, yfeldblum, rmcelroy, net-systems-diffs@, yogeshwer, mjpieters

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

Signature: t1:3376605:1464841648:98bfb47866dec802ca34f55c821796f36532211f
2016-06-21 20:44:06 -07:00
Laurent Charignon
e9b8bf6ba5 fastmanifest: fix sampling
Summary:
This patch fixes various things around the sampling extension to
match what our wrapper expects to see. See detail in the test.

Test Plan:
        lcharignon@XXX fbsource cat ~/.hgrc
        ...
        [extensions]
        sampling=
        [sampling]
        key.fastmanifest-cachehitratio=table_blah
        key.fastmanifest-trigger=table_blah
        filepath=/dev/shm/samppath


        lcharignon@XXX fbsource hhg book foo

        lcharignon@XXX fbsource cat /dev/shm/samppath
        {"category": "table_blah", "data": {"source": "bookmark", "metrics_type":
        "fastmanifest-trigger"}}\0{"category": "table_blah", "data": {"ratio": -1, "metrics_type":
        "fastmanifest-cachehitratio"}}\0

Reviewers: ttung, durham

Differential Revision: https://phabricator.intern.facebook.com/D3466719
2016-06-21 17:07:55 -07:00
Laurent Charignon
3542154d80 fastmanifest: fix logic bug in the cache
Summary:
This patch adds a test that uncovers logic bugs in the cache. It also
adds fixes for these bugs.

Test Plan:
Add a new test and ran existing tests, observed no change for
exisiting test.

Reviewers: durham, ttung

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3450430
2016-06-21 17:07:46 -07:00
Laurent Charignon
a046127556 fbhistedit: add args and kwargs to torule
Summary: This patch fixes the torulemethod of the exec action to match upstream.

Test Plan: Add a test that failed before the codechange

Reviewers: mitrandir

Differential Revision: https://phabricator.intern.facebook.com/D3459588
2016-06-21 14:03:46 -07:00
Martijn Pieters
5b77967854 Backed out changeset 0aa2b8139243
Summary:
The upstream change has now been *properly* landed at
https://selenic.com/repo/hg//rev/6ee50bdeeb32.

Once again, Mea Culpa, yesterday I apparently was in clowntown mode with these
patches.

Test Plan:
Run all affected tests:

  $HGSRC/tests/run-tests.py -l test-pull-createmarkers* test-pushrebase* test-pushvars*

Reviewers: #sourcecontrol, ttung, quark

Reviewed By: quark

Subscribers: mjpieters, durham

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

Signature: t1:3462832:1466513182:58d6187c04e0e567a026aba90bf753c76f4949a7

Blame Revision: D3460645
2016-06-21 13:58:55 +01:00
Durham Goode
ec171a5a29 backout: backout e61bd9d5e8ca about file descriptor cache
Summary:
e61bd9d5e8ca requires a change to core that has been accepted but not yet
pushed. This breaks the build, so let's revert it until upstream pushes the
dependency.

Test Plan: Ran the tests

Reviewers: ttung, mjpieters, #sourcecontrol, mitrandir

Reviewed By: mitrandir

Subscribers: mjpieters

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

Signature: t1:3460645:1466465904:cd521a989e475f9987237307a7d4d672d58ba615
2016-06-20 16:38:48 -07:00
Laurent Charignon
af2ffcc620 check-code: add test-bad-config to check code blacklist 2016-06-20 16:29:52 -07:00
Laurent Charignon
9a1fb623cc shallowutil: add missing import
Summary:
Before this patch, we were not importing mercurial.error, this was
causing a crash when calling error.Abort. This patch adds the missing import.

Test Plan: Tests pass, and add a new test

Reviewers: durham

Differential Revision: https://phabricator.intern.facebook.com/D3457086
2016-06-20 15:18:14 -07:00
Jun Wu
f29efc11b8 setup: build patchpython extension
Summary: We need to add `patchpython` to `setup.py` so it can get built.

Test Plan: `make local`

Reviewers: #sourcecontrol, ttung

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3456715
2016-06-20 14:06:37 +01:00
Martijn Pieters
d5cd8b6937 Add missing imports, fix line lengths
Summary:
This file clearly predates linting, if `hookargs` is ever set to `None` a
`NameError` would be triggered here.

Test Plan:
Run all affected tests:

  $HGSRC/tests/run-tests.py -l test-pull-createmarkers* test-pushrebase* test-pushvars*

Reviewers: #sourcecontrol, ttung

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3456417
2016-06-20 12:12:32 +01:00
Martijn Pieters
08afaea81e Get rid of getfilecache now that it is no longer needed
Summary:
Now that my upstream patch for filedescriptor class access has landed the helper function to bypass the descriptor protocol can go altogether.

Depends on D3454878

Test Plan:
Run affected extension tests:

  $HGSRC/tests/run-tests.py -l test-sqldirstate-* test-reflog* test-sparse*

Reviewers: #sourcecontrol, ttung

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3456368
2016-06-20 12:12:32 +01:00
Martijn Pieters
9b160b48c6 Use one function to access the filecache descriptor, and wrapfunction to patch
Summary:
There were 3 clowntowny versions of the wrapfiledescriptor function, 2 being
dangerously wrong about how they scan the class hierarchy. All because
`classobj.descriptorname` invokes the descriptor protocol and the filecache
descriptor is not set up for that access.

Instead of one function to do it all, use one utility function to retrieve
the descriptor object from the class __dict__ to avoid the descriptor protocol
kicking in, and use mercurial.extensions.wrapfunction to do the actual
wrapping.

I've sent a patch upstream to fix accessing the filecache descriptor on the
class; if accepted we can drop the getfilecache utility function altogether,
leaving only the wrapfunction calls.

Test Plan:
Run affected extension tests:

   $HGSRC/tests/run-tests.py -l test-sqldirstate-* test-reflog* test-sparse*

Reviewers: #sourcecontrol, ttung

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3454878
2016-06-20 12:12:32 +01:00
Durham Goode
b78655b899 tests: attempt to fix more test flakiness
In this race condition test, occasionally the second invocation would actually
obtain the lock before the first. This meant that the first repack would fail
with an error message while the second would exit with 0, resulting in the test
output changing slightly. Let's introduce a slight delay before the second
invocation to prevent this from happening.
2016-06-19 19:05:55 -07:00
Durham Goode
972e35e2ba tests: fix source of flakey tests
These should've been globs to begin with.
2016-06-19 18:40:46 -07:00
Durham Goode
fb442c3ae1 tests: fix lint error 2016-06-17 14:54:22 -07:00
Laurent Charignon
314c1245bf fastmanifest: refactor of the fastmanifest cache
Summary:
This diff refactors the fastmanifest cache. Main differences introduced:
- We use python magic methods to access the cache (__getitem__, __contains__, ...)
- The cache is separated in two classes: ondiskcache and fastmanifestcache, the
  former handles all the I/O, the latter handles the cache hierarchy and logic.
  This allows to better group I/O related operations and make it easier to reason
  about the code.
- By default we use systemawarecachelimit when creating a cache instead of no
  limit before.
- The code is simpler to understand, the interface is cleaner: we only use
  manifest nodes not a mix of filepath, manifestnodes and cachekeys.

Test Plan: test output does not change

Reviewers: ttung

Differential Revision: https://phabricator.intern.facebook.com/D3427797
2016-06-17 09:35:39 -07:00
Laurent Charignon
dcc7566c33 fastmanifest: allow creating a systemawarecachelimit without a reference to repo
Summary: This will be useful to refactor the cache

Test Plan:
We change the python test to give a vfs that makes sense, it will
be useful in the next patch when we refactor the cache. Indeed, with the new
cache we use systemawarecachelimit by default instead of no limit

Reviewers: ttung

Differential Revision: https://phabricator.intern.facebook.com/D3427796
2016-06-17 09:35:39 -07:00
Laurent Charignon
ef584cd5fe fastmanifest: change entry removal order
Summary:
Before this patch, if we decided to remove entries A,B,C where A is
more recent than B, which in turn is more recent than C. We were removing
in order A,B and C. This patch changes the order to C,B and A and will make
the next patches simpler.

Test Plan: Tests are updated accordingly

Reviewers: ttung

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3427795
2016-06-17 09:35:39 -07:00
Laurent Charignon
f1ab577b18 fastmanifest: add a debug line when refreshing cache entry
Summary:
When refreshing cache entries, it is useful to know what delay we
introduce. This patch adds a debug line showing that information.

Test Plan: tests are updated accordingly

Reviewers: ttung

Differential Revision: https://phabricator.intern.facebook.com/D3427794
2016-06-17 09:35:39 -07:00
Laurent Charignon
21923d4d76 fastmanifest: better --list debug output
Summary:
Before this patch, it wasn't clear from hg debugcachemanifest --list
which manifest were older and newer or what rev were actually cached. This
patch improves the output of hg debugcachemanifest --list --debug to show
this information.

Test Plan: add debug output to the test

Reviewers: ttung

Differential Revision: https://phabricator.intern.facebook.com/D3427791
2016-06-17 09:35:39 -07:00
Laurent Charignon
5835cbc55c fastmanifest: make __iter__ return the cache entries in a sound order
Summary:
Before this patch we were returning the cache entries alphabetically.
This patch changes the behavior to return the entries sorted by date and
alphabetically. This will be used to simplify the code for pruning entries
in furter patches.

Test Plan: test output changes

Reviewers: ttung

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3427789
2016-06-17 09:35:39 -07:00
Kostia Balytskyi
1d18a2690a fbamend: abort if preamend bookmark points to the current commit
Differential Revision: https://phabricator.intern.facebook.com/D3436696
2016-06-17 05:25:32 -07:00
Durham Goode
f7d38f2065 fb-hgext: disable system watchman config in tests
The system watchman config can interfere with test runs, so let's disable it via
the environment variable.
2016-06-16 18:56:37 -07:00
Durham Goode
d7722fcc7c stores: reverse order of cache and local stores
In the old days we would check the cache first, then the local store. This was
important because the cache is more likely to contain correct data (since it
comes from the final pushed version of commits), versus local data which may
contain information about stripped commits.

As part of the big store refactor, this order got switched unintentionally. So
let's switch it back.
2016-06-16 10:22:31 -07:00
Jeroen Vaelen
07efaadb9d [remotefilelog] use hashlib to compute sha1 hashes
Summary:
hg-crew's c27dc3c3122 and c27dc3c3122^ were breaking our extensions:

```
$ hg log -r c27dc3c3122^
changeset:   9010734b79911d2d2e7405d91a4df479b35b3841
user:        Augie Fackler <raf@durin42.com>
date:        Thu, 09 Jun 2016 21:12:33 -0700
s.ummary:     cleanup: replace uses of util.(md5|sha1|sha256|sha512) with hashlib.\1
```

```
$ hg log -r c27dc3c3122
changeset:   0d55a7b8d07bf948c935822e6eea85b044383f00
user:        Augie Fackler <raf@durin42.com>
date:        Thu, 09 Jun 2016 21:13:23 -0700
s.ummary:     util: drop local aliases for md5, sha1, sha256, and sha512
```

I did a grep over facebook-hg-rpms to see what was affected:
```
$ grep "util\.\(md5\|sha1\|sha256\|sha512\)" -r ~/facebook-hg-rpms
/home/jeroenv/facebook-hg-rpms/remotefilelog/remotefilelog/basestore.py:            sha = util.sha1(filename).digest()
/home/jeroenv/facebook-hg-rpms/remotefilelog/remotefilelog/basestore.py:                sha = util.sha1(filename).digest()
/home/jeroenv/facebook-hg-rpms/remotefilelog/remotefilelog/shallowutil.py:    pathhash = util.sha1(file).hexdigest()
/home/jeroenv/facebook-hg-rpms/remotefilelog/remotefilelog/shallowutil.py:    pathhash = util.sha1(file).hexdigest()
/home/jeroenv/facebook-hg-rpms/remotefilelog/remotefilelog/debugcommands.py:    filekey = util.sha1(file).hexdigest()
/home/jeroenv/facebook-hg-rpms/remotefilelog/remotefilelog/historypack.py:        namehash = util.sha1(name).digest()
/home/jeroenv/facebook-hg-rpms/remotefilelog/remotefilelog/historypack.py:        node = util.sha1(filename).digest()
/home/jeroenv/facebook-hg-rpms/remotefilelog/remotefilelog/historypack.py:        files = ((util.sha1(filename).digest(), offset, size)
/home/jeroenv/facebook-hg-rpms/remotefilelog/remotefilelog/fileserverclient.py:    pathhash = util.sha1(file).hexdigest()
/home/jeroenv/facebook-hg-rpms/remotefilelog/remotefilelog/fileserverclient.py:    pathhash = util.sha1(file).hexdigest()
/home/jeroenv/facebook-hg-rpms/remotefilelog/remotefilelog/basepack.py:        self.sha = util.sha1()
/home/jeroenv/facebook-hg-rpms/remotefilelog/tests/test-datapack.py:        return util.sha1(content).digest()
/home/jeroenv/facebook-hg-rpms/remotefilelog/tests/test-histpack.py:        return util.sha1(content).digest()
Binary file /home/jeroenv/facebook-hg-rpms/hg-crew/.hg/store/data/mercurial/revlog.py.i matches
/home/jeroenv/facebook-hg-rpms/fb-hgext/sparse.py:            return util.sha1(fh.read()).hexdigest()
/home/jeroenv/facebook-hg-rpms/fb-hgext/sparse.py:        sha1 = util.sha1()
/home/jeroenv/facebook-hg-rpms/fb-hgext/sparse.py:        sha1 = util.sha1()
/home/jeroenv/facebook-hg-rpms/fb-hgext/sparse.py:        sha1 = util.sha1()
/home/jeroenv/facebook-hg-rpms/fb-hgext/sparse.py:    sha1 = util.sha1()
/home/jeroenv/facebook-hg-rpms/mutable-history/hgext/simple4server.py:        sha = util.sha1()
/home/jeroenv/facebook-hg-rpms/mutable-history/hgext/evolve.py:        sha = util.sha1()
```
This diff is part of the fix.

Test Plan:
Ran the tests.
```
$MERCURIALRUNTEST -S -j 48 --with-hg ~/local/facebook-hg-rpms/hg-crew/hg
```

Reviewers: #sourcecontrol, ttung

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

Tasks: 11762191
2016-06-15 15:48:16 -07:00
Jeroen Vaelen
f10fd61efd [fb-hgext] use hashlib to compute sha1 hashes
Summary:
hg-crew's c27dc3c3122 and c27dc3c3122^ were breaking our extensions:

```
$ hg log -r c27dc3c3122^
changeset:   9010734b79911d2d2e7405d91a4df479b35b3841
user:        Augie Fackler <raf@durin42.com>
date:        Thu, 09 Jun 2016 21:12:33 -0700
s.ummary:     cleanup: replace uses of util.(md5|sha1|sha256|sha512) with hashlib.\1
```

```
$ hg log -r c27dc3c3122
changeset:   0d55a7b8d07bf948c935822e6eea85b044383f00
user:        Augie Fackler <raf@durin42.com>
date:        Thu, 09 Jun 2016 21:13:23 -0700
s.ummary:     util: drop local aliases for md5, sha1, sha256, and sha512
```

I did a grep over facebook-hg-rpms to see what was affected:
```
$ grep "util.\(md5\|sha1\|sha256\|sha512\)" -r ~/facebook-hg-rpms
/home/jeroenv/facebook-hg-rpms/remotefilelog/remotefilelog/basestore.py:            sha = util.sha1(filename).digest()
/home/jeroenv/facebook-hg-rpms/remotefilelog/remotefilelog/basestore.py:                sha = util.sha1(filename).digest()
/home/jeroenv/facebook-hg-rpms/remotefilelog/remotefilelog/shallowutil.py:    pathhash = util.sha1(file).hexdigest()
/home/jeroenv/facebook-hg-rpms/remotefilelog/remotefilelog/shallowutil.py:    pathhash = util.sha1(file).hexdigest()
/home/jeroenv/facebook-hg-rpms/remotefilelog/remotefilelog/debugcommands.py:    filekey = util.sha1(file).hexdigest()
/home/jeroenv/facebook-hg-rpms/remotefilelog/remotefilelog/historypack.py:        namehash = util.sha1(name).digest()
/home/jeroenv/facebook-hg-rpms/remotefilelog/remotefilelog/historypack.py:        node = util.sha1(filename).digest()
/home/jeroenv/facebook-hg-rpms/remotefilelog/remotefilelog/historypack.py:        files = ((util.sha1(filename).digest(), offset, size)
/home/jeroenv/facebook-hg-rpms/remotefilelog/remotefilelog/fileserverclient.py:    pathhash = util.sha1(file).hexdigest()
/home/jeroenv/facebook-hg-rpms/remotefilelog/remotefilelog/fileserverclient.py:    pathhash = util.sha1(file).hexdigest()
/home/jeroenv/facebook-hg-rpms/remotefilelog/remotefilelog/basepack.py:        self.sha = util.sha1()
/home/jeroenv/facebook-hg-rpms/remotefilelog/tests/test-datapack.py:        return util.sha1(content).digest()
/home/jeroenv/facebook-hg-rpms/remotefilelog/tests/test-histpack.py:        return util.sha1(content).digest()
Binary file /home/jeroenv/facebook-hg-rpms/hg-crew/.hg/store/data/mercurial/revlog.py.i matches
Binary file /home/jeroenv/facebook-hg-rpms/hg-crew/.hg/store/data/contrib/mercurial.spec.i matches
/home/jeroenv/facebook-hg-rpms/hg-crew/contrib/mercurial.spec:%global docutilsmd5 4622263b62c5c771c03502afa3157768
/home/jeroenv/facebook-hg-rpms/hg-crew/contrib/buildrpm:    DOCUTILSMD5=`sed -ne "s/^%global docutilsmd5 //p" $specfile`
/home/jeroenv/facebook-hg-rpms/fb-hgext/sparse.py:            return util.sha1(fh.read()).hexdigest()
/home/jeroenv/facebook-hg-rpms/fb-hgext/sparse.py:        sha1 = util.sha1()
/home/jeroenv/facebook-hg-rpms/fb-hgext/sparse.py:        sha1 = util.sha1()
/home/jeroenv/facebook-hg-rpms/fb-hgext/sparse.py:        sha1 = util.sha1()
/home/jeroenv/facebook-hg-rpms/fb-hgext/sparse.py:    sha1 = util.sha1()
/home/jeroenv/facebook-hg-rpms/mutable-history/hgext/simple4server.py:        sha = util.sha1()
/home/jeroenv/facebook-hg-rpms/mutable-history/hgext/evolve.py:        sha = util.sha1()
```

This diff is part of the fix.

Test Plan:
Ran the tests.
```
$MERCURIALRUNTEST -S -j 48 --with-hg ~/local/facebook-hg-rpms/hg-crew/hg
```
There was still one failure, but that's due to the fact that my locally built hg does not have lz4revlog.

Reviewers: #sourcecontrol, durham, ttung

Reviewed By: ttung

Subscribers: mjpieters

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

Tasks: 11762191

Signature: t1:3438597:1466016473:d33de5a2c772d17724429d3607e2400c85618c71
2016-06-15 12:05:38 -07:00
Durham Goode
b9e78ae8c1 statprof: add threading sampler
Summary:
The existing statprof uses signals to perform stack sampling. Those signals can
interfere with system calls though. This patch introduces a way of using python
threads to perform sampling from a background thread.

This also changes the default to be the threaded profiler instead of the
sampling one, since the sampling can crash the proces sometimes.

In some situations this produces a more accurate stack trace.

Test Plan:
```
sudo cp statprof.py /usr/lib64/python2.6/site-packages/statprof.py
hg pull --profile
# Verified I got output and that it was different from the old statprof (it was
# more accurate, as compared with time.time() measurements in the code)
```

Reviewers: #mercurial, ttung, quark

Reviewed By: quark

Subscribers: quark, mjpieters

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

Signature: t1:3402864:1465978363:c8455d119cc03c2c475e190aee28587a9d434c4d
2016-06-15 09:54:18 -07:00
Durham Goode
50238ee029 statprof: make unimportant functions gray
This will help highlight which functions actually had work, and which were just
calling down to another function.
2016-06-14 12:58:27 -07:00
Laurent Charignon
69afc55b3b fastmanifest: fail gracefully when we cannot compute cache limit
Summary:
Before this patch if the path was not accessible we would fail to
compute the limit.

Test Plan:
We should test systematically all these kind of issues, I am doing
a refactoring that will allow us to do that.

Reviewers: ttung

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3424996
2016-06-13 15:26:55 -07:00
Laurent Charignon
1e1c21421b fastmanifest: don't stop when we cannot get the lock
Summary:
Before this patch we were stopping execution when the lock couldn't
be taken. This was problematic when running hg command for someone else's repo
(for example to debug problems). This patch allows us to continue the execution
of the command when that happen, except we won't use fastmanifest.

Test Plan: This is reflected in the test output

Reviewers: ttung

Differential Revision: https://phabricator.intern.facebook.com/D3422458
2016-06-13 15:26:55 -07:00
Laurent Charignon
f6986bb23e fastmanifest: prevent error when renaming cache entry
Summary: This could break people using fastmanifest in someone else's repo

Test Plan: tests pass, not sure how we normally test permission stuff

Reviewers: ttung

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3420870
2016-06-13 15:26:55 -07:00
Laurent Charignon
5987cca652 fastmanifest: prevent error when creating cache folder with missing permissions
Summary:
Before this patch we would have error using fastmanifest on repos you
didn't own.

Test Plan: tests pass

Reviewers: ttung

Differential Revision: https://phabricator.intern.facebook.com/D3420863
2016-06-13 15:26:55 -07:00
Laurent Charignon
cf676f04b4 fastmanifest: remove unused, duplicated line
Summary: This line shouldn't be there

Test Plan: tests pass

Reviewers: ttung

Differential Revision: https://phabricator.intern.facebook.com/D3420857
2016-06-13 15:26:55 -07:00
Kostia Balytskyi
36e90d0fed tweakdefaults: make rebaseskipobsolete behave in a more expected way
Differential Revision: https://phabricator.intern.facebook.com/D3341324
2016-06-11 15:25:13 -07:00
Tony Tung
1cbcba1e73 fix test-fbhistedit-stop.t test
Summary: It can't find those extensions now that we removed the extensions from the system pythonpath.  Therefore, we need to load it from the source directory.

Test Plan: pass 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-fbhistedit-stop.t

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: mitrandir, mjpieters

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

Signature: t1:3419503:1465590764:23e348efee30cabbbff232b7457d5820125bd6ad
2016-06-10 13:37:33 -07:00
Tony Tung
52d9676213 echo -n not platform-agnostic
Summary: printf appears to be more platform agnostic than echo -n, which is not supported on bsd/mac.

Test Plan: run 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-catnotate.t

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mitrandir, mjpieters

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

Signature: t1:3419500:1465590785:a34da9af73c64d9edef66a7b4a6ed3abd885e5c7
2016-06-10 13:37:24 -07:00
Tony Tung
3cb14683b0 [fastmanifest] enforce strict prototypes
Summary: Newer versions of gcc (5.x) turn on `-Wstrict-prototype` by default.  Turn this on in our setup.py file for older compilers, and fix the errors that crop up from this.

Test Plan: make local

Reviewers: tnardone, wez, lcharignon

Reviewed By: lcharignon

Subscribers: mitrandir, mjpieters

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

Signature: t1:3414620:1465514102:d91026062582e2a3ab3fc773bbf17686fa38609f
2016-06-09 22:45:05 -07:00
Durham Goode
60873bc788 setup: add missing comma
The missing comma after 'sampling' caused it to get concatenated with 'show',
meaning neither of them were included in the rpms.
2016-06-09 16:34:04 -07:00
Durham Goode
07665da4da statprof: add an extension for customizing our invocation of statprof
Summary:
This overrides the normal Mercurial statprof logic to allow us to pass custom
configuration to our customized version of statprof. In particular, it allows us
to choose between the thread and the signal profile methods, and between the
hotpath and json output formats.

Test Plan: hg.real log -r tip --config extensions.statprofext=../fb-hgext/statprofext.py --profile --config statprof.format='json' --config profiling.output=woooo.log

Reviewers: #mercurial, ttung, lcharignon

Reviewed By: lcharignon

Subscribers: lcharignon, mjpieters

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

Signature: t1:3408386:1465485488:400da1f8e1787674c9ea3888166767a485f2fbdf
2016-06-09 11:36:07 -07:00
Durham Goode
d860baf210 cachegroup: fix pack path use of cachegroup
Summary:
The pack path logic did not use the correct unix group when
remotefilelog.cachegroup was specified. This fixes that.

Test Plan:
I manually tested it by deleting a pack dir and running repack. This
is hard to create an automated test for since the feature isn't really cross
platform, and we don't have a way to know what groups they have on their
machine.

Reviewers: #sourcecontrol, ttung, rmcelroy

Reviewed By: rmcelroy

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

Tasks: 11584114

Signature: t1:3400756:1465342537:ed023f6dc830117df5e85e294a41486f072714c9
2016-06-08 09:09:06 -07:00
Durham Goode
c2d89eeebc test: add test to cover copyfrom issue
The previous commit fixed a bug where copyfrom data was represented incorrectly
in the local .hg/store/data remotefilelog blobs when the ancestor data was read
from a pack file. This commit adds a test for that situation.
2016-06-06 15:07:27 -07:00
Durham Goode
7cb6908a76 copyfrom: fix copy metadata in local blobs
The new pack stores return None for the copyfrom field, instead of the expected
''. We need the local file blob generator to handle this case, instead of just
putting None in the copyfrom field.
2016-06-06 14:16:06 -07:00
Durham Goode
3d127ad4a3 repack: cleanup empty directories
Summary:
Now that repack can clean up old remotefilelog blobs, let's have it also delete
any empty directories that get left behind.

Test Plan: Updated an existing test to cover it

Reviewers: mitrandir, lcharignon, #sourcecontrol, ttung, simonfar

Reviewed By: simonfar

Subscribers: simonfar

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

Signature: t1:3385546:1464972782:5ca63cf0a5589bb8a537957f50b4bc5ec4e0f0f5
2016-06-06 10:04:18 -07:00
Durham Goode
cfba85e8f3 Fix missing test glob 2016-06-03 17:32:39 -07:00
Durham Goode
6f3d6c53f5 utils: unify cachepath access through a util function
Summary:
Previously a bunch of different places accessed the cachepath through ui.config
directly. This is a problem because we need to resolve any environment variables
in the path, and some spots didn't do this. So let's unify all accesses through
a helper function that takes care of the environment variables.

Test Plan: Added a test

Reviewers: mitrandir, lcharignon, #sourcecontrol, ttung, simonfar

Reviewed By: simonfar

Subscribers: simonfar

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

Signature: t1:3385583:1464971813:5b9ee5ed3d6ff9f1a78cb9e0269e433844758c9d
2016-06-03 09:45:58 -07:00
Jun Wu
ab49fe9698 patchpython: new extension to patch buggy Python modules
Summary:
As discussed, we want to make sure we have a good SocketServer for Python 2.6,
which is unsupported by PSF but still being widely used by our users.

This diff adds a new extension that tries to fix buggy Python standard modules,
namely the SocketServer. It fixes a critical race condition for Python 2.6
(https://bugs.python.org/issue21491) and the zombie process issue for both
Python 2.6 and 2.7 (https://bugs.python.org/issue11109).

A simple test is added to check zombie processes are no more.

Test Plan:
Run the newly added test, `test-patchpython.py` with both Python 2.6 and 2.7.
Comment out the `import patchpython` line in the test and make sure it fails
on Python 2.6 and 2.7 with `AssertionError: zombie process detected`.

Reviewers: #mercurial, ttung, mjpieters

Reviewed By: mjpieters

Subscribers: simonfar, durham, mjpieters

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

Signature: t1:3384909:1465319491:0ba64b496186712651b7ee6bd502d1e2ccac57d1
2016-06-03 11:11:30 +01:00
Durham Goode
3c61fadca5 statprof: add json output format
Summary:
This adds a json display format that can dump the raw samples to json. This
allows other processes to read the data and log/analyze them.

Test Plan: hg.real log -r tip --config extensions.statprofext=../fb-hgext/statprofext.py --profile --config statprof.format='json' --config profiling.output=woooo.log

Reviewers: #mercurial, ttung, lcharignon

Reviewed By: lcharignon

Subscribers: lcharignon, mjpieters

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

Signature: t1:3408369:1465436261:5fc344effdea46d2cf07c81cb707791ceea98f11
2016-06-08 21:09:39 -07:00
Laurent Charignon
b9ca427342 fastmanifest: add documentation of constants
Summary:
We change pydoc to comment for the lock timeout and document the
remaining constants

Test Plan: documentation change, tests pass

Reviewers: ttung

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3398903
2016-06-08 14:28:14 -07:00
Laurent Charignon
80fba54556 sampling: add extension to setup
Summary: I forgot to add it to setup.py previously

Test Plan: How to test that? Is running the build enough?

Reviewers: ttung, durham

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3399075
2016-06-08 14:28:00 -07:00
Laurent Charignon
6afa8fab4a fastmanifest: add metrics collection
Summary: Add code to log metrics for fastmanifest, also handles aggregate
metrics. We reuse ui.log for logtoprocess. We also refactor diffs and
filesnotin to make it easier to log cache hit and miss ratio.

Test Plan:
Replaced ui.log by ui.status and aggregated the field, check
that I see metrics getting logged.

Reviewers: ttung, durham

Differential Revision: https://phabricator.intern.facebook.com/D3368504
2016-06-08 14:34:26 -07:00