2017-03-24 23:42:39 +03:00
|
|
|
/*
|
2019-06-20 02:58:25 +03:00
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
2017-03-24 23:42:39 +03:00
|
|
|
*
|
2019-06-20 02:58:25 +03:00
|
|
|
* This software may be used and distributed according to the terms of the
|
|
|
|
* GNU General Public License version 2.
|
2017-03-24 23:42:39 +03:00
|
|
|
*/
|
2019-10-11 15:26:59 +03:00
|
|
|
|
2017-03-24 23:42:39 +03:00
|
|
|
#pragma once
|
|
|
|
|
2017-12-08 23:36:37 +03:00
|
|
|
#include <folly/Range.h>
|
2017-04-29 05:14:25 +03:00
|
|
|
|
2019-10-01 19:42:10 +03:00
|
|
|
namespace apache {
|
|
|
|
namespace thrift {
|
|
|
|
class ResponseChannelRequest;
|
|
|
|
}
|
|
|
|
} // namespace apache
|
|
|
|
|
2017-03-24 23:42:39 +03:00
|
|
|
namespace facebook {
|
|
|
|
namespace eden {
|
|
|
|
|
2019-09-24 01:19:29 +03:00
|
|
|
class DiffCallback;
|
2018-07-20 03:14:12 +03:00
|
|
|
class GitIgnoreStack;
|
2017-04-29 05:14:25 +03:00
|
|
|
class ObjectStore;
|
2018-02-09 06:31:56 +03:00
|
|
|
class UserInfo;
|
2018-07-20 03:14:12 +03:00
|
|
|
class TopLevelIgnores;
|
2017-04-29 05:14:25 +03:00
|
|
|
|
2017-03-24 23:42:39 +03:00
|
|
|
/**
|
2018-07-20 03:14:12 +03:00
|
|
|
* A helper class to store parameters for a TreeInode::diff() operation.
|
2017-03-24 23:42:39 +03:00
|
|
|
*
|
2018-07-20 03:14:12 +03:00
|
|
|
* These parameters remain fixed across all subdirectories being diffed.
|
|
|
|
* Primarily intent is to compound related diff attributes.
|
2017-03-24 23:42:39 +03:00
|
|
|
*/
|
|
|
|
class DiffContext {
|
|
|
|
public:
|
2018-02-09 06:31:56 +03:00
|
|
|
DiffContext(
|
2019-09-24 01:19:29 +03:00
|
|
|
DiffCallback* cb,
|
2018-02-09 06:31:56 +03:00
|
|
|
bool listIgnored,
|
|
|
|
const ObjectStore* os,
|
2019-10-01 19:42:10 +03:00
|
|
|
std::unique_ptr<TopLevelIgnores> topLevelIgnores,
|
|
|
|
apache::thrift::ResponseChannelRequest* FOLLY_NULLABLE request = nullptr);
|
2017-12-08 23:36:37 +03:00
|
|
|
|
2018-07-20 03:14:12 +03:00
|
|
|
DiffContext(const DiffContext&) = delete;
|
|
|
|
DiffContext& operator=(const DiffContext&) = delete;
|
|
|
|
DiffContext(DiffContext&&) = delete;
|
|
|
|
DiffContext& operator=(DiffContext&&) = delete;
|
|
|
|
~DiffContext();
|
2017-03-24 23:42:39 +03:00
|
|
|
|
2019-09-24 01:19:29 +03:00
|
|
|
DiffCallback* const callback;
|
2017-12-08 23:36:37 +03:00
|
|
|
const ObjectStore* const store;
|
2017-03-24 23:42:39 +03:00
|
|
|
/**
|
|
|
|
* 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;
|
2017-04-29 05:14:25 +03:00
|
|
|
|
2018-07-20 03:14:12 +03:00
|
|
|
const GitIgnoreStack* getToplevelIgnore() const;
|
2019-10-01 19:42:10 +03:00
|
|
|
bool isCancelled() const;
|
2017-12-08 23:36:37 +03:00
|
|
|
|
2018-07-20 03:14:12 +03:00
|
|
|
private:
|
|
|
|
std::unique_ptr<TopLevelIgnores> topLevelIgnores_;
|
2019-10-01 19:42:10 +03:00
|
|
|
apache::thrift::ResponseChannelRequest* const FOLLY_NULLABLE request_;
|
2017-03-24 23:42:39 +03:00
|
|
|
};
|
2017-11-04 01:58:04 +03:00
|
|
|
} // namespace eden
|
|
|
|
} // namespace facebook
|