mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 16:57:49 +03:00
306fb6b692
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
71 lines
1.9 KiB
C++
71 lines
1.9 KiB
C++
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This software may be used and distributed according to the terms of the
|
|
* GNU General Public License version 2.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <folly/Range.h>
|
|
|
|
namespace apache {
|
|
namespace thrift {
|
|
class ResponseChannelRequest;
|
|
}
|
|
} // namespace apache
|
|
|
|
namespace facebook {
|
|
namespace eden {
|
|
|
|
class DiffCallback;
|
|
class GitIgnoreStack;
|
|
class ObjectStore;
|
|
class UserInfo;
|
|
class TopLevelIgnores;
|
|
|
|
/**
|
|
* A helper class to store parameters for a TreeInode::diff() operation.
|
|
*
|
|
* These parameters remain fixed across all subdirectories being diffed.
|
|
* Primarily intent is to compound related diff attributes.
|
|
*
|
|
* The DiffContext must be alive for the duration of the async operation it is
|
|
* used in.
|
|
*/
|
|
class DiffContext {
|
|
public:
|
|
DiffContext(
|
|
DiffCallback* cb,
|
|
bool listIgnored,
|
|
const ObjectStore* os,
|
|
std::unique_ptr<TopLevelIgnores> topLevelIgnores,
|
|
apache::thrift::ResponseChannelRequest* FOLLY_NULLABLE request = nullptr);
|
|
DiffContext(DiffCallback* cb, const ObjectStore* os);
|
|
|
|
DiffContext(const DiffContext&) = delete;
|
|
DiffContext& operator=(const DiffContext&) = delete;
|
|
DiffContext(DiffContext&&) = delete;
|
|
DiffContext& operator=(DiffContext&&) = delete;
|
|
~DiffContext();
|
|
|
|
DiffCallback* const callback;
|
|
const ObjectStore* const store;
|
|
/**
|
|
* If listIgnored is true information about ignored files will be reported.
|
|
* If listIgnored is false then ignoredFile() will never be called on the
|
|
* callback. The diff operation may be faster with listIgnored=false, since
|
|
* it can completely omit processing ignored subdirectories.
|
|
*/
|
|
bool const listIgnored;
|
|
|
|
const GitIgnoreStack* getToplevelIgnore() const;
|
|
bool isCancelled() const;
|
|
|
|
private:
|
|
std::unique_ptr<TopLevelIgnores> topLevelIgnores_;
|
|
apache::thrift::ResponseChannelRequest* const FOLLY_NULLABLE request_;
|
|
};
|
|
} // namespace eden
|
|
} // namespace facebook
|