sapling/eden/fs/model/TestOps.cpp
Chad Austin c46461bbfb support efficient object equality checks across ID schemes
Summary:
The hg backing store supports three object ID schemes: proxy hashes,
revhash+path, and revhash alone. When migrating between two schemes,
it looks to EdenFS as if the entire working copy has changed, and
EdenFS will then fetch and compare every tree.

To avoid this traversal, add an areObjectsKnownIdentical function to
BackingStore which the hg backing store can use to short-circuit
recursion, if two different ObjectIds point to the same object.

Reviewed By: xavierd

Differential Revision: D37904727

fbshipit-source-id: 4d0b7c528b5b96bfe7cb4e8ca76d0e432e003249
2022-07-26 17:32:23 -07:00

31 lines
781 B
C++

/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
#include "eden/fs/model/TestOps.h"
namespace facebook::eden {
bool operator==(const TreeEntry& entry1, const TreeEntry& entry2) {
return (entry1.getHash() == entry2.getHash()) &&
(entry1.getType() == entry2.getType());
}
bool operator!=(const TreeEntry& entry1, const TreeEntry& entry2) {
return !(entry1 == entry2);
}
bool operator==(const Tree& tree1, const Tree& tree2) {
return (tree1.getHash() == tree2.getHash()) &&
(tree1.entries_ == tree2.entries_);
}
bool operator!=(const Tree& tree1, const Tree& tree2) {
return !(tree1 == tree2);
}
} // namespace facebook::eden