Commit Graph

104 Commits

Author SHA1 Message Date
Puneet Kaushik
86f5c839d1 Add EdenMount diff to generate the ScmStatus
Summary: This implements diff() inside EdenMount which uses GenerateStatus to compute the ScmStatus.

Reviewed By: simpkins

Differential Revision: D18195574

fbshipit-source-id: 16cfbda35796d1cfd4e13e6566b7ac222163aea4
2019-12-10 14:07:24 -08:00
Chad Austin
f930a40434 make PathComponentPiece and RelativePathPiece constexpr
Summary: Allow creation of PathComponentPiece and RelativePathPiece values at compile-time.

Reviewed By: wez

Differential Revision: D18642594

fbshipit-source-id: 209e5c27e8fab1e877ccee8558fa757b68078e66
2019-12-04 13:30:18 -08:00
Chad Austin
7ef7154001 improve error message when invalid hashes are given
Summary:
Looking at a log, it wasn't immediately obvious what might have passed
an invalid hash into the Hash constructor. Improve the error message
to make the cause clearer.

Reviewed By: genevievehelsel

Differential Revision: D18380916

fbshipit-source-id: 620b8fa902a87496b87a5aa0ff304e6991585864
2019-11-07 17:26:09 -08:00
Chad Austin
8cac2bfe6a Remove dead includes in eden
Reviewed By: wez

Differential Revision: D17877514

fbshipit-source-id: e7f8ed8364bdb7a77f293cbdf4b48e8f15e64c30
2019-10-11 16:45:01 -07:00
Genevieve Helsel
306fb6b692 pass DiffContext through TreeDiffer code path
Summary: Removes `TreeDiffer` class and passes `DiffContext` through standalone `TreeDiffer` functions as first argument as per comment on D17400466 for setup for processing gitignores in the `TreeDiffer` codepath. (also this allows for easy implementation of short circut of `future_getScmStatusBetweenRevisions` similar to D17531102)

Reviewed By: chadaustin

Differential Revision: D17717977

fbshipit-source-id: d480d212474bd80aeac9cd9bb901f97562b62b13
2019-10-11 10:46:20 -07:00
Andres Suarez
fbdb46f5cb Tidy up license headers
Reviewed By: chadaustin

Differential Revision: D17872966

fbshipit-source-id: cd60a364a2146f0dadbeca693b1d4a5d7c97ff63
2019-10-11 05:28:23 -07:00
Adam Simpkins
4bc8682391 update license headers in CMake files
Summary:
Update the copyright & license headers in CMake files to reflect the
relicensing to GPLv2

Reviewed By: wez

Differential Revision: D15487079

fbshipit-source-id: 715e559464c19a0070d6e55a095b3fc7d61ad2f8
2019-06-19 17:02:46 -07:00
Adam Simpkins
aa5e6c7295 update license headers in C++ files
Summary:
Update the copyright & license headers in C++ files to reflect the
relicensing to GPLv2

Reviewed By: wez

Differential Revision: D15487078

fbshipit-source-id: 19f24c933a64ecad0d3a692d0f8d2a38b4194b1d
2019-06-19 17:02:45 -07:00
Puneet Kaushik
d97ca252b6 Make Tree::getEntryPtr() do a case insensitive lookup on Windows
Summary: getEntryPtr() does a case sensitive lookup because of which few Ovrsource builds were failing. Ovrsource code is including header files with the wrong case.

Reviewed By: strager

Differential Revision: D15344850

fbshipit-source-id: 3d5d658a49cdafc07dc9a18a2f3d2073306e8f40
2019-05-17 11:48:37 -07:00
Puneet Kaushik
9e24d970a8 Replace EDEN_WIN with _WIN32 for Windows only code
Reviewed By: chadaustin

Differential Revision: D15228464

fbshipit-source-id: 08b30f535fa17a5bcda906e640cc036cd0d59d02
2019-05-09 16:33:08 -07:00
Adam Simpkins
cedc6820f7 fix a size_t format specifier to snprintf()
Summary:
D8559702 changed `folly::IOBuf::computeChainDataLength()` to return a `size_t`
Update our format specifier to match to avoid compiler warnings on Mac.

Reviewed By: chadaustin

Differential Revision: D14878220

fbshipit-source-id: 19e96bea07c57bb542a848b3688d65143db51d13
2019-04-10 15:41:35 -07:00
Wez Furlong
0f376fc904 eden: workaround constexpr throw problem with gcc
Summary:
The issue is that the compiler needs an `else` to see
that we can only reach the throw if none of the other paths are
taken; with that satisfied it believes that we are legitimately
constexpr.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67371

Reviewed By: chadaustin

Differential Revision: D14638234

fbshipit-source-id: f9524d2816580f41842a40e30118b03998c3660a
2019-03-27 12:47:46 -07:00
Yedidya Feldblum
e245072bf7 Add assorted missing includes
Summary: [Eden] Add assorted missing `#include`s.

Reviewed By: swolchok

Differential Revision: D14293384

fbshipit-source-id: ccd61dde41a978bd3f82eb11cbe401cd51e7e056
2019-03-07 00:13:47 -08:00
Rick Ratmansky
593f2f29ca Revert D14114164: [Folly] Remove include of glog from Range.h
Differential Revision:
D14114164

Original commit changeset: e227609e9214

fbshipit-source-id: 99d0fde58e512224915d7a00893ddf15c547dfba
2019-03-01 06:51:52 -08:00
Yedidya Feldblum
851e90c055 Remove include of glog from Range.h
Summary: [Folly] Remove include of `glog` from `Range.h`.

Reviewed By: lbrandy, Orvid

Differential Revision: D14114164

fbshipit-source-id: e227609e9214ab39ff272e44519d34f3047fe025
2019-03-01 01:43:08 -08:00
Puneet Kaushik
c066cb60d6 Removing dtype from Windows
Reviewed By: wez

Differential Revision: D14141032

fbshipit-source-id: 6a8c71fe77310f83df075e4bab9e44707dec4d91
2019-02-19 15:43:20 -08:00
Wez Furlong
8847a7a061 add dtype as an optional return value from glob
Summary:
This diff adds the dtype field to the glob results;
this will help to reduce the cost of some watchman queries by avoiding a
getFileInformation call that instantiates inodes.

As part of this, I added a bunch of unit test coverage.

Reviewed By: strager

Differential Revision: D8779149

fbshipit-source-id: 3064a3e42be55ec576fed9e0f7112edef426f32d
2019-02-19 11:26:26 -08:00
Adam Simpkins
736ce0715c make the Hash constructors constexpr
Summary:
Update the Hash constructors that accept a `ByteRange` and a `StringPiece` to
be `constexpr` so that all Hash constructors are now `constexpr`.

This probably shouldn't really make a big difference in practice.  I added
this since I wanted to define some static `Hash` constants in some tests, and
didn't want to worry about SIOF issues.

Reviewed By: chadaustin

Differential Revision: D13475781

fbshipit-source-id: fc1ce91c998f1badadbd6becd525458c25dd30de
2018-12-17 19:15:36 -08:00
Chad Austin
fe557ace7c only evict when interest handle is dropped if blob wasn't reloaded
Summary:
There was a bug in BlobCache where, if you had an interest handle to a
blob, but that blob was evicted anyway and then something else caused
it to be reloaded, dropping your interest handle would cause the blob
to be incorrectly evicted since the reference counts were no longer
compatible. Add a version to cache items and only decrement the
reference count on an item if the interest handle and item agree.

Reviewed By: strager

Differential Revision: D13405144

fbshipit-source-id: aee052bf777e7225551c3ae2b8b69a99f4f77691
2018-12-10 19:30:28 -08:00
Chad Austin
9bf83c0742 add kEmptySha1 hash constant
Summary:
A later diff needed a constant for the SHA-1 of an empty buffer. While
I'm at it, I made Hash a little bit nicer to use.

Reviewed By: strager

Differential Revision: D13224195

fbshipit-source-id: b2fb1437be042215b5b398a8c7fc9fc5dd115e9e
2018-11-28 16:16:16 -08:00
Chad Austin
a51606565b add a BlobCache
Summary: Add a BlobCache with a maximum cache size and a minimum entry count and interest-based eviction.

Reviewed By: strager

Differential Revision: D12972062

fbshipit-source-id: 1958f7f500c051a5bc0b39b5b89a6f0fc1774b0f
2018-11-21 19:43:45 -08:00
Chad Austin
60dccd2e38 standardize some of the benchmark infrastructure
Summary:
As we start to build out both FUSE and Thrift benchmarks, we'll want a
standard library. Introduce a benchharness and have both the thrift
sha-1 and parallel_open_close benchmarks use it.

(Note: this ignores all push blocking failures!)

Differential Revision: D12969306

fbshipit-source-id: 89c8bbcc37d53560decffb9281af4aba20345787
2018-11-13 15:27:50 -08:00
Wez Furlong
7d10cfea88 add optional size and contentSha1 fields to TreeEntry
Summary:
We'll start populating these in the mononoke client.
They are currently unused.

Reviewed By: chadaustin

Differential Revision: D12814791

fbshipit-source-id: f5407de5cdb9f1f3ad6ee2befed50e2a7562ec97
2018-10-31 11:50:39 -07:00
Chad Austin
2a6dd2879d folly::Optional -> std::optional
Summary: Eden's on C++17 so fully cross the rubicon!

Reviewed By: strager

Differential Revision: D10498200

fbshipit-source-id: 4e2af5a8d5cef9a106e8c05e6f93ea9e5b8e696e
2018-10-23 18:51:59 -07:00
Chad Austin
cfbc0ad221 folly::Optional -> std::optional
Summary: Eden's on C++17 so fully cross the rubicon!

Reviewed By: strager

Differential Revision: D10496534

fbshipit-source-id: ab082e3413ac031f22612cbaf3f7c13221f9ebd7
2018-10-23 17:05:11 -07:00
Puneet Kaushik
1e94122c0b Win: Porting eden/service to Windows with fb-thrift
Reviewed By: strager

Differential Revision: D10225935

fbshipit-source-id: 5c571229e243b8fcabb9db8a6e15e1c66423edaf
2018-10-22 20:27:26 -07:00
Chad Austin
e03b717a45 make std::hash<Hash> noexcept
Summary:
In D10384953 I learned that std::unordered_map<Hash, V> V for any V
would waste storage by storing the hash result in each hash node. This
is especially silly because the hash function of std::Hash is as
simple as loading the first word from memory.

Marking the hash function as noexcept reduces the node size for
std::unordered_map<Hash, BlobMetadata> from 72 to 64, making it fit
cleanly in one of jemalloc's slabs.

Reviewed By: strager

Differential Revision: D10385972

fbshipit-source-id: 7a3da5d09be0650ad43849e6d82334b44f3582a3
2018-10-22 20:27:24 -07:00
Chad Austin
5986e9f639 compute Blob size upon construction
Summary:
Add a direct getSize() accessor to Blob. The thinking here is that all
of this information is known and in cache when the Blob is
constructed, so there's no need to walk a list later on.

Reviewed By: simpkins

Differential Revision: D10245695

fbshipit-source-id: f6d5abbae75d468085dcc02bbbac8aa6239a7c70
2018-10-09 10:53:45 -07:00
Puneet Kaushik
eeaf1c0025 Started Eden for Windows and integrated hg store with it.
Summary:
This diff is first in the series to make Eden work on Windows. It includes:

1. HG backing store and Object store, which provides the capability to talk to mercurial and fetch the file and folder contents on Windows.
2. Subprocess and Pipe definition for Windows.
3. The Visual studio solution and projects files to compile Eden and scm datapack.

Few Important points:

1. Most of the changes to existing code is done under a macro EDEN_WIN so that it doesn't impact on other platform.
2. Sqlite is used for caching the fetched contents. We are not using Rocksdb on Windows.
3. The main function only calls some test code and exit after printing the output.
4. The initializeMononoke code is disabled for Windows because it needs Proxygen to talk HTTP. Will enable this once I get Proxygen and other dependencies working.
5. HgImporter pass Windows handles to hg_import_helper as command line args. The code to convert these handles into fds is in a separate diff.

Reviewed By: wez

Differential Revision: D8653992

fbshipit-source-id: 52a3c3750425fb92c2a7158c2c214a9372661e13
2018-08-21 17:53:38 -07:00
Eamonn Kent
4620a3af43 Added class CachedParsedFileMonitor and tests
Summary:
CachedParsedFileMonitor provides cached access to an object created by parsing
a data file. The object can be accessed through "getFileContents().
"getFileContents()" will check if the file has changed and reload/parse if
necessary. A throttle is applied to limit change checks to at most to 1
per throttleMilliSeconds.

Reviewed By: simpkins

Differential Revision: D8903257

fbshipit-source-id: 7ed28610a3e9b40b98b0a9ffaff7b307bbcd32a8
2018-07-25 20:07:23 -07:00
Eamonn Kent
00ad72e97c GitIgnore/GitIgnoreStack add copy constructors and assignment operators
Summary: GitIgnore and GitIgnoreStack encapsulate details of ignore files. Further changes (as part of this commit stack) require copy constructors and assignment operators. Also, compiler wants destructors in .cpp file (since otherwise, it cannot tell the object size).Keeping this as a separate commit to simplify review process.

Reviewed By: simpkins

Differential Revision: D8730299

fbshipit-source-id: 7cb443906143c80209278b85fc5ad4dc5ea0bf56
2018-07-17 17:22:10 -07:00
Chad Austin
74de9c13a8 recover from a commit2tree entry existing without the corresponding tree
Summary:
When testing D8108649 I accidentally deleted all of my trees
but didn't delete my commit2tree mapping. This diff allows Eden to
recover from that situation.

Reviewed By: wez

Differential Revision: D8108728

fbshipit-source-id: 94a9393294ca259303026c297683dac4b3ecfac4
2018-06-06 14:36:32 -07:00
Sergey Zhupanov
419a57b1bc Enabled additional compiler warnings in Eden.
Summary:
1. Enabled a number of additional C++ compiler warnings in Eden.
2. Fixed warnings-turned-errors that resulted from this change.

Reviewed By: simpkins

Differential Revision: D8132543

fbshipit-source-id: 2290ffaaab55024d582e29201a1bcaa1152e6b3e
2018-06-01 11:39:01 -07:00
Chad Austin
72be488e3d add convenient operator literals for the various path piece types
Summary:
I got tired of typing PathComponentPiece{"..."} in tests so here are
some operator literals.

Reviewed By: simpkins

Differential Revision: D7956732

fbshipit-source-id: 85d9f3fd725853a54da9e70fc659bd7eb9e0862c
2018-05-11 14:52:07 -07:00
Michael Bolin
5e5ee6c32d Extend GlobMatcher to support an IGNORE_DOTFILES option.
Summary:
When `GlobMatcher` is used to implement `glob()` for Eden, `**` should not
include dotfiles by default (at least when it is used to implement `glob()` in Buck),
so we need to make this configurable. To this end, this adds a `GlobOptions`
parameter to `GlobMatcher::create()`. The key option this revision introduces is
`GlobOptions::IGNORE_DOTFILES`.

We implement this new functionality by associating a `matchCanStartWithDot`
boolean with the following opcodes in `GlobMatcher`:

* `GLOB_STAR`
* `GLOB_STAR_STAR_END`
* `GLOB_STAR_STAR_SLASH`
* `GLOB_ENDS_WITH`

The value of `matchCanStartWithDot` is largely determined by
`GlobOptions::IGNORE_DOTFILES`, though some extra checking is done
when assigning this for `GLOB_STAR`.

Originally, `GLOB_ENDS_WITH` required some funny business in how it
manipulated the `result` vector. This revision introduces some new funny
business to preserve the desired optimization.

Most of the work in this revision is new logic to ensure `matchCanStartWithDot`
is honored appropriately for each opcode.

Reviewed By: simpkins

Differential Revision: D7787621

fbshipit-source-id: f2c42e0f0948db74d48dc163d40aa3b13bbb4c3d
2018-05-02 12:21:04 -07:00
Adam Simpkins
8e3c09a99a move folly/experimental/logging to folly/logging/
Summary:
Promote the folly logging code out of the experimental subdirectory.
We have been using this for several months in a few projects and are pretty
happy with it so far.

After moving it out of the experimental/ subdirectory I plan to update
folly::Init() to automatically support configuring it via a `--logging` command
line flag (similar to the initialization it already does today for glog).

Reviewed By: yfeldblum, chadaustin

Differential Revision: D7755455

fbshipit-source-id: 052db34c97f7516728f7cbb1a5ad959def2f6efb
2018-04-30 21:29:29 -07:00
Adam Simpkins
dea514bbef add CMake build files
Summary: Add CMakeFiles to build Eden.

Reviewed By: wez

Differential Revision: D7479587

fbshipit-source-id: 7e0b4a756005dadc3af5c13c36ce22d1dcc15071
2018-04-30 14:37:46 -07:00
Adam Simpkins
21d2b6c46d Remove TARGETS files
Summary:
This removes the TARGETS files from the eden github repository.  The
open source buck build has been failing for several months, since buck
removed support for the thrift_library() rule.

I will potentially take a stab at adding CMake build support for Eden
at some point in the future.

Reviewed By: chadaustin

Differential Revision: D6893233

fbshipit-source-id: e6023094a807cf481ac49998c6f21b213be6c288
2018-02-20 19:57:45 -08:00
Sergey Zhupanov
6f40e9a23f replaced std::size_t by size_t in fbcode/eden codebase.
Summary:
Most uses of `size_t` in `eden` are unqualified, but a few are qualified.
As discussed ad nauseum in
  https://stackoverflow.com/questions/5813700/difference-between-size-t-and-stdsize-t
it is totally safe to use unqualified `size_t` with all compilers/platforms.
Since this saves 5 chars per use, and to improve uniformity, I ran:
```
$ find ~/fbsource/fbcode/eden -type f       \
    | egrep '\.(h|cpp)$'                    \
    | xargs sed -i 's/std::size_t/size_t/g'
```

Reviewed By: chadaustin

Differential Revision: D7021980

fbshipit-source-id: da268e62a9a93d2a5168a40b6878795ae7516b7f
2018-02-20 15:30:18 -08:00
Chad Austin
bb302aac4b simplify isSameAs checking of mode bits
Summary: Per code review comments on D6983198, this simplifies the way we check if mode bits have changed in a meaningful-to-source-control way.

Reviewed By: simpkins

Differential Revision: D7015339

fbshipit-source-id: 548ead337fbea1c1dcb72b880921671e9b6188ac
2018-02-20 11:36:11 -08:00
Chad Austin
7d0b2433cf make modeFromTreeEntryType a free function
Summary:
mode_t isn't really part of a TreeEntry and I also wanted to see all
the places where we convert an entry type from source control into
mode bits.

Reviewed By: simpkins

Differential Revision: D6983198

fbshipit-source-id: ce1d0976f5fc5130c34a8c93c07a4e26a7cdaf71
2018-02-16 15:57:39 -08:00
Chad Austin
622a5ecbc2 rename FileType to TreeEntryType
Summary:
This is the type of a tree entry, which may be another tree, so
FileType is not an accurate name.

Reviewed By: simpkins

Differential Revision: D6981168

fbshipit-source-id: 997eb8a27f599310ed678ce221c8083722db8bff
2018-02-16 15:57:39 -08:00
Chad Austin
8c44274053 replace TreeEntryType with TreeEntry::isTree
Summary:
I want to rename FileType to TreeEntryType so I removed this one first
and replaced all of its uses with an isTree() method.

Reviewed By: simpkins

Differential Revision: D6980501

fbshipit-source-id: 105b8c599585e63efd44043e761db40e2824e77e
2018-02-15 14:46:33 -08:00
Chad Austin
895a0196d9 compute permission bits based on FileType in TreeEntry
Summary:
Our Model TreeEntry code was a bit too general - in reality, both git
and hg only support a handful of specific tree entries: regular files,
executable files, symlinks, and trees.  (git also supports
submodules.)  This diff delays the expansion of a TreeEntry's type
into a full mode_t.

Reviewed By: simpkins

Differential Revision: D6980003

fbshipit-source-id: 73729208000668078a180b728d7e0bb9169c6f3c
2018-02-15 14:46:33 -08:00
Chad Austin
697eb8a6fd run clang-format across eden
Summary:
```
find . \( -iname '*.cpp' -o -iname '*.h' \) -exec arc lint --apply-patches {} +
```

Differential Revision: D6820436

fbshipit-source-id: 173c0e3b5c023c1c9276f34e17d732f1dd161892
2018-01-26 11:20:31 -08:00
Philip Jameson
8604b8f5b0 Migrate TARGETS files from @/ to //
Summary:
This is a codemod to change from using @/ to // in basic cases.
- TARGETS files with lines starting with @/ (but excluding @/third-party:
- autodeps lines in source and TARGETS files ( (dep|manual)=@/ ), excluding @/third-party
- Targets in string macros

The only thing left of the old format should be @/third-party:foo:bar

drop-conflicts

Reviewed By: ttsugriy

Differential Revision: D6605465

fbshipit-source-id: ae50de2e1edb3f97c0b839d4021f38d77b7ab64c
2017-12-20 16:57:41 -08:00
Sergey Zhupanov
b6394ac357 Added user and general system level gitignore
Summary:
Added to Eden capability to incorporate default user and general system level gitignore files.
NOTE: Work in progress, sending the review out to calibrate/ensure I am on right track.

Reviewed By: simpkins

Differential Revision: D6482863

fbshipit-source-id: 9834ca1a577a9599a1f8cb2243dca4e714866be8
2017-12-08 12:52:51 -08:00
Chad Austin
8b9261f2a1 run clang-format across all C++ files
Summary:
Per discussion with bolinfest, this brings Eden in line with clang-format.

This diff was generated with `find . \( -iname '*.cpp' -o -iname '*.h' \) -exec bash -c "yes | arc lint {}" \;`

Reviewed By: bolinfest

Differential Revision: D6232695

fbshipit-source-id: d54942bf1c69b5b0dcd4df629f1f2d5538c9e28c
2017-11-03 16:02:03 -07:00
Yedidya Feldblum
b2f5376cea Move folly/Array.h
Summary: [Folly] Move `folly/Array.h` to `folly/container/`.

Reviewed By: luciang

Differential Revision: D6182858

fbshipit-source-id: 59340b96058cc6d0c7a0289e316bbde98c15d724
2017-10-29 03:42:55 -07:00
Adam Simpkins
35c50ea4e3 add more debug logging of checkout operations
Summary:
Add a few extra debug logs to record `processCheckoutEntry()` and
`saveOverlayPostCheckout()` calls.

Reviewed By: bolinfest

Differential Revision: D6151544

fbshipit-source-id: ca6faa8fd1fe53df1e70305f5527360c918841d1
2017-10-25 16:51:56 -07:00