Skip to content

Commit

Permalink
remove the dead HgProxyHash::sha1
Browse files Browse the repository at this point in the history
Summary: This was a remnant of the old HgProxyHash scheme.

Reviewed By: kmancini

Differential Revision: D49753911

fbshipit-source-id: 9883c2015f0c9d660122ff3bfdf2efff88aa00f3
  • Loading branch information
chadaustin authored and facebook-github-bot committed Oct 3, 2023
1 parent d6a9c0b commit c8718fc
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 26 deletions.
12 changes: 0 additions & 12 deletions eden/fs/store/hg/HgProxyHash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,18 +213,6 @@ Hash20 HgProxyHash::revHash() const noexcept {
return Hash20{byteHash()};
}

ObjectId HgProxyHash::sha1() const noexcept {
if (value_.empty()) {
// The SHA-1 of an empty HgProxyHash, (kZeroHash, "").
// The correctness of this value is asserted in tests.
const ObjectId emptyProxyHash = ObjectId::fromHex(
folly::StringPiece{"d3399b7262fb56cb9ed053d68db9291c410839c4"});
return emptyProxyHash;
} else {
return ObjectId::sha1(value_);
}
}

bool HgProxyHash::operator==(const HgProxyHash& otherHash) const {
return value_ == otherHash.value_;
}
Expand Down
6 changes: 0 additions & 6 deletions eden/fs/store/hg/HgProxyHash.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,6 @@ class HgProxyHash {
*/
Hash20 revHash() const noexcept;

/**
* Returns the SHA-1 of the canonical serialization of this ProxyHash, which
* is used as the object ID throughout EdenFS.
*/
ObjectId sha1() const noexcept;

bool operator==(const HgProxyHash&) const;
bool operator<(const HgProxyHash&) const;

Expand Down
3 changes: 1 addition & 2 deletions eden/fs/store/hg/test/HgImportRequestQueueBenchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ std::shared_ptr<HgImportRequest> makeBlobImportRequest(
ImportPriority priority) {
auto hgRevHash = uniqueHash();
auto proxyHash = HgProxyHash{RelativePath{"some_blob"}, hgRevHash};
auto hash = proxyHash.sha1();
return HgImportRequest::makeBlobImportRequest(
hash,
ObjectId{proxyHash.getValue()},
std::move(proxyHash),
priority,
ObjectFetchContext::Cause::Unknown,
Expand Down
8 changes: 4 additions & 4 deletions eden/fs/store/hg/test/HgImportRequestQueueTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ std::pair<ObjectId, std::shared_ptr<HgImportRequest>> makeBlobImportRequest(
ImportPriority priority) {
auto hgRevHash = uniqueHash();
auto proxyHash = HgProxyHash{RelativePath{"some_blob"}, hgRevHash};
auto hash = proxyHash.sha1();
auto hash = ObjectId{proxyHash.getValue()};
return std::make_pair(
hash,
HgImportRequest::makeBlobImportRequest(
Expand All @@ -65,7 +65,7 @@ std::pair<ObjectId, std::shared_ptr<HgImportRequest>> makeBlobImportRequest(

std::pair<ObjectId, std::shared_ptr<HgImportRequest>>
makeBlobImportRequestWithHash(ImportPriority priority, HgProxyHash proxyHash) {
auto hash = proxyHash.sha1();
auto hash = ObjectId{proxyHash.getValue()};
return std::make_pair(
hash,
HgImportRequest::makeBlobImportRequest(
Expand All @@ -80,7 +80,7 @@ std::pair<ObjectId, std::shared_ptr<HgImportRequest>>
makeBlobMetaImportRequestWithHash(
ImportPriority priority,
HgProxyHash proxyHash) {
auto hash = proxyHash.sha1();
auto hash = ObjectId{proxyHash.getValue()};
return std::make_pair(
hash,
HgImportRequest::makeBlobMetaImportRequest(
Expand All @@ -95,7 +95,7 @@ std::pair<ObjectId, std::shared_ptr<HgImportRequest>> makeTreeImportRequest(
ImportPriority priority) {
auto hgRevHash = uniqueHash();
auto proxyHash = HgProxyHash{RelativePath{"some_tree"}, hgRevHash};
auto hash = proxyHash.sha1();
auto hash = ObjectId{proxyHash.getValue()};
return std::make_pair(
hash,
HgImportRequest::makeTreeImportRequest(
Expand Down
2 changes: 0 additions & 2 deletions eden/fs/store/hg/test/HgProxyHashTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@ TEST(HgProxyHashTest, test_moved_from_and_empty_hash_compare_the_same) {

EXPECT_EQ(HgProxyHash{}.path(), from.path());
EXPECT_EQ(HgProxyHash{}.revHash(), from.revHash());
EXPECT_EQ(HgProxyHash{}.sha1(), from.sha1());

HgProxyHash zero{RelativePathPiece{}, kZeroHash};
EXPECT_EQ(HgProxyHash{}.path(), zero.path());
EXPECT_EQ(HgProxyHash{}.revHash(), zero.revHash());
EXPECT_EQ(HgProxyHash{}.sha1(), zero.sha1());
}

TEST(HgProxyHashTest, round_trip_version_1) {
Expand Down

0 comments on commit c8718fc

Please sign in to comment.