Summary:
We're experiencing cases where users are pulling down far more trees
than they need. Let's enable the ability to download a certain depth of trees.
In this diff we just implement the actual iteration limiting in native code. In
a future diff we'll make the appropriate python changes and add a test.
Reviewed By: quark-zju
Differential Revision: D8523215
fbshipit-source-id: ccfeadee1525b86b1a5578631dbafe666de41f4c
Summary:
Add a new function to `cstore.treemanifest` to list the contents of a directory
in the tree manifest.
Reviewed By: ryanmce
Differential Revision: D8332425
fbshipit-source-id: db74f11a691cd6b8ac7d51aec6b7da8149c22027
Summary:
They're actively fighting against the clang-format config
and don't have an auto-fix.
Reviewed By: quark-zju
Differential Revision: D8283622
fbshipit-source-id: 2de45f50e6370a5ed14915c6ff23dc843ff14e8a
Summary:
In a future diff we'll be adding the ability to iterate over just a
subsection of a tree. In order for the resulting paths to be correct, we need to
be able to prime the start path. To do so, let's add a path argument to the
SubTreeIterator, and set it to empty string everywhere it's currently used.
Reviewed By: quark-zju
Differential Revision: D8216727
fbshipit-source-id: 1969f380f7ad13f54a7dbcd2283b0428c4480ab4
Summary:
Now that markPermanent no longer requires a ManifestEntry to update the
node, the resultEntry field on all the iterators is unused. Let's delete it.
Reviewed By: quark-zju
Differential Revision: D8156808
fbshipit-source-id: 21aeb050c91552c7e8973a33dd7e347457125a64
Summary:
Now that the node field is accessed via a getter that can lazily
compute it, let's get rid of the logic that proactively sets it. This will make
it easier to refactor the subtree iterator in a later diff.
Reviewed By: quark-zju
Differential Revision: D8156809
fbshipit-source-id: aabc3f68cc41baea0c166b9a2bd68bea6b1a6a03
Summary:
Previously the ManifestEntry node field was public and consumers could
read it directly. This required that the node field be updated manually, which
added complications to other code paths. In a future diff we'll be simplifying
the SubTreeIterator code to not require setting node, and to do so we make node
calculated in this accessor.
Reviewed By: quark-zju
Differential Revision: D8156807
fbshipit-source-id: e1908b2149bc0ec8fb1279e37b8a66988ff125c6
Summary:
This switches the treemanifest native iterators to use the ManifestPtr
class instead of Manifest*. ManifestPtr does ref counting, and in a future diff
we'll use this ability to have the subtree iterator iterate over a portion of a
larger tree so we can serve just parts of trees to gettreepack requests.
Reviewed By: quark-zju
Differential Revision: D8156806
fbshipit-source-id: 4dbb60d008ac8d0c789c3f2db8f7e567c5869539
Summary:
The memcmp contract is that the result is >0, 0, or <0. If <0 it's not
guaranteed to be -1, so let's broaden the check a bit.
Reviewed By: phillco
Differential Revision: D8190843
fbshipit-source-id: 78b864a639851a041c1a393f21a979d13eaa2e9c
Summary:
The changes in this diff changes string comparisons using the compare method to
using equality operators.
Motivation:
- readability, simplifies code
- compare method is intended for sorting functions
This is clang check used: [Link Here](https://clang.llvm.org/extra/clang-tidy/checks/readability-string-compare.html)
Reviewed By: yfeldblum
Differential Revision: D7674416
fbshipit-source-id: dce375fb4b401f0e012ad4fc99b5dc4babe07f89
Summary:
memcpy() must not be called with a null source pointer, even when the length
argument is 0:
https://www.imperialviolet.org/2016/06/26/nonnull.html
The current behavior causes `hg commit` to crash when compiled with UBSAN
enabled.
Reviewed By: chadaustin, wez
Differential Revision: D7055450
fbshipit-source-id: 40afb40cb346d608fa0e59012bc329b5702ec651
Summary:
This assert appears to have always been wrong, but only respected when
built by clang. The SubtreeIterator class is created with an empty string in the
path member, and the only entry to the class is the next function which
immediately asserts that path is not empty. Since the only place path is set is
later in the function, there's no way it could start off as anything other than
empty.
Reviewed By: quark-zju
Differential Revision: D6891356
fbshipit-source-id: c55e616461d4a29308ca6e22be51ea02962d9df3
Summary:
Moves ctreemanifest into hgext/extlib/. It will be built in a later
step when we add cstore to the build.
Test Plan: make local && cd tests && ./run-tests.py
Reviewers: #mercurial
Differential Revision: https://phabricator.intern.facebook.com/D6678844