Commit Graph

13 Commits

Author SHA1 Message Date
Andrey Chursin
ae684f3993 explicit Hash20 instead of Hash [proxy hash removal 2/n]
Summary:
This is fairly mechanical diff that finalizes split of Hash into ObjectId and Hash20.

More specifically this diff does two things:
* Replaces `Hash` with `Hash20`
* Removes alias `using Hash = Hash20`

Reviewed By: chadaustin

Differential Revision: D31324202

fbshipit-source-id: 780b6d2a422ddf6d0f3cfc91e3e70ad10ebaa8b4
2021-10-01 12:43:26 -07:00
Andrey Chursin
0af2511a3f separate out ObjectId [proxy hash removal 1/n]
Summary:
The goal of this stack is to remove Proxy Hash type, but to achieve that we need first to address some tech debt in Eden codebase.

For the long time EdenFs had single Hash type that was used for many different use cases.

One of major uses for Hash type is identifies internal EdenFs objects such as blobs, trees, and others.

We seem to reach agreement that we need a different type for those identifiers, so we introduce separate ObjectId type in this diff to denote new identifier type and replace _some_ usage of Hash with ObjectId.

We still retain original Hash type for other use cases.

Roughly speaking, this is how this diff separates between Hash and ObjectId:

**ObjectId**:
* Everything that is stored in local store(blobs, trees, commits)

**Hash20**:
* Explicit hashes(Sha1 of the blob)
* Hg identifiers: manifest id and blob hg ig

For now, in this diff ObjectId has exactly same content as Hash, but this will change in the future diffs. Doing this way allows to keep diff size manageable, while migrating to new ObjectId right away would produce insanely large diff that would be both hard to make and review.

There are few more things that needs to be done before we can get to the meat of removing proxy hashes:

1) Replace include Hash.h with ObjectId.h where needed
2) Remove Hash type, explicitly rename rest of Hash usages to Hash20
3) Modify content of ObjectId to support new use cases
4) Modify serialized metadata and possibly other places that assume ObjectId size is fixed and equal to Hash20 size

Reviewed By: chadaustin

Differential Revision: D31316477

fbshipit-source-id: 0d5e4460a461bcaac6b9fd884517e129aeaf4baf
2021-10-01 10:25:46 -07:00
Chad Austin
a4ba22dc48 rename Hash to Hash20
Summary:
In preparation for expanding to variable-width hashes, rename the
existing hash type to Hash20.

Reviewed By: genevievehelsel

Differential Revision: D28967365

fbshipit-source-id: 8ca8c39bf03bd97475628545c74cebf0deb8e62f
2021-09-08 16:27:10 -07:00
Chad Austin
49385c8a07 store: namespace facebook::eden
Summary: C++17

Reviewed By: fanzeyi

Differential Revision: D28966939

fbshipit-source-id: c8c9d49bc02557263a6acf9357c90b50e04fbdb9
2021-06-08 19:29:37 -07:00
Chad Austin
bb1cccac89 introduce a variable-width RootId type that identifies the root of an EdenFS checkout's contents
Summary:
Backing stores differentiate between individual tree objects and the
root of a checkout. For example, Git and Mercurial roots are commit
hashes. Allow EdenFS to track variable-width roots to better support
arbitrary backing stores.

Reviewed By: genevievehelsel

Differential Revision: D28619584

fbshipit-source-id: d94f1ecd21a0c416c1b4933341c70deabf386496
2021-06-07 17:25:31 -07:00
Chad Austin
fc07c3b6e6 add an ObjectFetchContext interface
Summary:
Add a fetch context interface to ObjectStore that allows tracing cache
hits, backing store fetches, and fetch durations in the context of a
diff or checkout operation.

Reviewed By: simpkins

Differential Revision: D19135625

fbshipit-source-id: d0d8f134b1c89f7ba4971a404a46a69a1704ba5c
2020-02-05 13:15:01 -08:00
Genevieve Helsel
4dc48ec7fa use gitignore in tree differ
Summary: Pass a GitIgnoreStack* and isIgnored flag through the diff operation. It is used later in the stack when we go down this code path in the TreeInode diffing code. When context->loadFileContentsFromPath() is null, the gitignore loading code will be ignored, used when we do not want to honor a gitignore file. For example, during `getScmStatusBetweenRevisions()`.

Reviewed By: chadaustin

Differential Revision: D18647089

fbshipit-source-id: 20d2abd2ef61669465e134165da5a0ac5e987cca
2020-01-29 11:17:55 -08:00
Genevieve Helsel
ff441bf0a6 clean up DiffTrees code
Summary: There are a couple of functions in `store/Diff.h` which are not used elsewhere except for testing. These functions are tested by `diffCommitsForStatus()` anyways so these standalone functions are not needed.

Reviewed By: chadaustin

Differential Revision: D18690006

fbshipit-source-id: f2b24575c17403d7241896f35f4e0e16bb03b7ce
2019-12-04 16:01:48 -08: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
Genevieve Helsel
6a036808cc use callbacks in source control tree comparisons
Summary: Use callback to save ScmStatus instead of storing status inside a `TreeDiffer` object. Involes a bit of restructuring of some code to avoid circular dependencies and library creation. Mostly renames and file moves, some funtion moves as well.

Reviewed By: simpkins

Differential Revision: D17400466

fbshipit-source-id: fcd194a4c20204dffd3d11cd4a083564dc0ea938
2019-09-23 15:22:30 -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
Adam Simpkins
65a682a1ff add a function for diffing source control commits
Summary:
Add a function for diffing two source control commits without needing to
instantiate TreeInode objects.

Reviewed By: wez

Differential Revision: D7341604

fbshipit-source-id: 557eef87faa2785ab96d51b09569a46f892a71f6
2018-03-20 16:47:12 -07:00