Commit Graph

5 Commits

Author SHA1 Message Date
Tony Tung
98a893f27f [fastmanifest] include the '/' in path nodes
Summary:
This solves two problems we're seeing with our current approach.

1) If we have a file `f` in directory `t` (thus `t/f`) and a file called `t.txt`, we'll order the nodes as `t/f`, then `t.txt`.  This is not the order lazymanifest expects, as `t.txt` *precedes* `t/f` in lexicographical order.  This is because we order `t` before `t.txt`.  However, if we have `t/` vs `t.txt`, `t.txt` will come first.

2) We eliminate the issue where mercurial sometimes adds a file with the same name as a directory.  This will no longer happen because the directory will have the trailing slash.

Test Plan: pass all existing fastmanifest unit tests

Reviewers: lcharignon, wez

Reviewed By: wez

Subscribers: mitrandir, mjpieters

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

Tasks: 11234430

Signature: t1:3297330:1463163665:41ba1b3389d35fd9417f378940e59e38e2edbc85
2016-05-16 16:20:57 -07:00
Tony Tung
9067c86850 [fastmanifest] reduce the warning spew from mercurial build
Summary:
`setup.py` turns on a couple extra warnings, so add them to our list and resolve them.  Most of them are 64->32 bit conversions.  In most cases, we test and abort if we're outside the 32-bit range.

I also removed const from `contains_path` because enforcing it means code duplicating, which is never a great thing.

Test Plan: pass unit tests

Reviewers: #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: mitrandir, mjpieters

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

Tasks: 10652171

Signature: t1:3194045:1461605953:1a7012fbc75ca8808130c8ad00ed4b2e8fa96f91
2016-04-25 11:58:38 -07:00
Tony Tung
4294090e19 [fastmanifest] initialize flags to 0 for directory nodes
Summary: They are never read normally, except for checksum calculation.  However, we cannot let them be free-floating values because they'll affect the checksums and give us incorrect results.

Test Plan: passed a test (in a later diff) without triggering valgrind

Reviewers: #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: mitrandir, mjpieters

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

Tasks: 10644245

Signature: t1:3155436:1460106747:9b6281490d8fe8cfeeeac8036ca7ca8e68f256d8
2016-04-18 11:40:46 -07:00
Tony Tung
305e73449d [fastmanifest] eliminate the alloc-realloc cycle from immediate node expansion
Summary: When we create new intermediate nodes as part of add_or_update_path, we add them with max_children=0.  However, the next action we do is to add a child, which immediately forces us to expand the node we just created.  This is wasteful.  We will now hint how many children the node is likely to have.  0 if it's a leaf node, or 1 if it's an intermediate node.

Test Plan: passed unit tests

Reviewers: lcharignon, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mitrandir, mjpieters, #sourcecontrol

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

Signature: t1:3155429:1460120985:eb7ba4a3731c717fa6a9c61597a0fc980caa7589
2016-04-18 11:40:15 -07:00
Tony Tung
a23d34c3e4 [fastmanifest] extract tree path traversal code to tree_path.[ch]
Summary: I'm planning on building a find_path traversal that exposes directories, and make it available for tests.

Test Plan: pass unit tests.

Reviewers: #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mitrandir, mjpieters

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

Signature: t1:3138945:1460071138:3eb43a1742c8b0d856f0b97421eb499d9e328310
2016-04-08 22:34:43 -07:00