Summary:
This fixes some (but not all) of the fastmanifest errors. The remaining ones are
from an import * and one that will require slightly more refactoring to fix.
Test Plan: Ran the tests
Reviewers: #mercurial, quark
Reviewed By: quark
Subscribers: mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D4055633
Signature: t1:4055633:1477050763:09e758b1bd72b18799cdabf510eb0b2332077833
Summary:
We want to be able to dump debugging output for the workers.
Depends on D3468818
Test Plan: used in later diffs.
Reviewers: durham, lcharignon
Reviewed By: lcharignon
Subscribers: mitrandir, mjpieters, #mercurial
Differential Revision: https://phabricator.intern.facebook.com/D3468827
Tasks: 11683504
Signature: t1:3468827:1466695135:bb930ac6e34f3654a7006634c22dc99b3d2e75bf
Summary:
I ran flake8 and saw a bunch of things that we could fix to make the
code more succint and legible.
Test Plan: all tests pass
Reviewers: ttung
Differential Revision: https://phabricator.intern.facebook.com/D3398906
Summary: Noticed this while trying to debug something that since we call `_exit()`, we don't have the luxury of the standard flushing of output streams. If we have a silent worker that doesn't output enough to trigger an automatic flush, we might leave things in the buffer.
Test Plan:
pass unit tests.
output something small after the fork via ui.log, and it is now flushed to console.
```
diff --git a/fastmanifest/cachemanager.py b/fastmanifest/cachemanager.py
--- a/fastmanifest/cachemanager.py
+++ b/fastmanifest/cachemanager.py
@@ -175,6 +175,9 @@
return
cache = fastmanifestcache.getinstance(repo.store.opener, ui)
+ if background:
+ ui.debug("hi")
+
computedrevs = scmutil.revrange(repo, revset)
sortedrevs = sorted(computedrevs, key=lambda x:-x)
if ui.configbool("fastmanifest", "randomorder", True):
diff --git a/tests/test-fastmanifest.t b/tests/test-fastmanifest.t
--- a/tests/test-fastmanifest.t
+++ b/tests/test-fastmanifest.t
@@ -24,6 +24,7 @@
> [fastmanifest]
> cachecutoffdays=-1
> randomorder=False
+ > silentworker=False
> EOF
$ mkcommit a
@@ -52,7 +53,7 @@
$ sleep 1
$ hg debugcachemanifest -a --background
$ hg debugcachemanifest -a --background
- $ hg debugcachemanifest -a --background
+ $ hg debugcachemanifest -a --background --debug
$ sleep 1
$ hg debugcachemanifest --list
fast7ab5760d084a24168f7595c38c00f4bbc2e308d9 (size 328 bytes)
```
With this change, we see the "hi". Without this change, we do not see the "hi"
Reviewers: lcharignon
Reviewed By: lcharignon
Subscribers: mitrandir, mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3387112
Signature: t1:3387112:1464987504:dc44129afb36e27c84dd6d6e52db8d82533b4341
Summary: We don't want users to see scary exceptions or errors from worker processes. They are unexpected and hard to deal with.
Test Plan: introduce syntax errors into the code. run hg boo -d abc in repo with fastmanifest enabled. saw no errors. then ran the same command with --config=fastmanifest.silentworker=False and saw the error.
Reviewers: lcharignon
Reviewed By: lcharignon
Subscribers: mitrandir, mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3357657
Signature: t1:3357657:1464365560:0cb101ab8a886f8e586a275bd91090331ad20982
Summary: I think it makes sense.
Test Plan: run unit tests
Reviewers: lcharignon
Reviewed By: lcharignon
Subscribers: mitrandir, mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3355211
Signature: t1:3355211:1464304354:fb04fcd1ed496da3a7f0a176c4bc04f4fc3711b3
Summary: We want to wrap the fastmanifest cache priming code in a lock, but we want it to be easily stealable. If the lock is more than X seconds in age, we just assume it's stale and steal it. We remember that we stole it so we don't blow away the lock, but we do update the time of the lock so another process doesn't try to steal the lock.
Test Plan: write test to cover basic functionality (mutual exclusivity). write test to cover stealing, and that only one thief is permitted at a time (subject to race conditions).
Reviewers: durham, lcharignon
Reviewed By: lcharignon
Subscribers: mitrandir, mjpieters, #mercurial
Differential Revision: https://phabricator.intern.facebook.com/D3343478
Tasks: 11385124
Signature: t1:3343478:1464304447:18658ebea60f98bfda0f034414991ffd6c334ca7