sapling/cstore/match.h
Durham Goode 84a862e6f3 treemanifest: support matcher in diff
Summary:
Upstream has added a matcher argument to the diff API which allows diff to avoid
traversing certain parts of the tree. This adds support for that to our native
treemanifest implementation.

Test Plan: Added tests for diff with matches

Reviewers: #mercurial, stash

Reviewed By: stash

Subscribers: stash, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4677023

Signature: t1:4677023:1489076627:dbcea209d300a68fa050f68c52b4fd9949b85302
2017-03-12 12:49:18 -07:00

31 lines
859 B
C++

// match.h - c++ declarations for a data store
//
// Copyright 2017 Facebook, Inc.
//
// This software may be used and distributed according to the terms of the
// GNU General Public License version 2 or any later version.
//
// no-check-code
//
#ifndef MATCH_H
#define MATCH_H
class Matcher {
public:
virtual ~Matcher() {}
virtual bool matches(const std::string &path) = 0;
virtual bool matches(const char *path, const size_t pathlen) = 0;
virtual bool visitdir(const std::string &path) = 0;
};
class AlwaysMatcher : public Matcher {
public:
AlwaysMatcher() {}
virtual ~AlwaysMatcher() {}
virtual bool matches(const std::string &path) { return true; }
virtual bool matches(const char *path, const size_t pathlen) { return true; }
virtual bool visitdir(const std::string &path) { return true; }
};
#endif // MATCH_H