Skip to content

Commit e25aa0d

Browse files
authored
Merge pull request #704 from aciidb0mb3r/add-exists-repo
[Repository] Add exists(revision:) method
2 parents 07a1e9a + 62461b7 commit e25aa0d

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

Sources/SourceControl/Repository.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ public protocol Repository {
113113
/// - Throws: If an error occurs while performing the fetch operation.
114114
func fetch() throws
115115

116+
/// Returns true if the given revision exists.
117+
func exists(revision: Revision) -> Bool
118+
116119
/// Open an immutable file system view for a particular revision.
117120
///
118121
/// This view exposes the contents of the repository at the given revision

Tests/PackageGraphTests/RepositoryPackageContainerProviderTests.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ private class MockRepository: Repository {
4848
fatalError("Unexpected API call")
4949
}
5050

51+
func exists(revision: Revision) -> Bool {
52+
fatalError("Unexpected API call")
53+
}
54+
5155
func remove() throws {
5256
fatalError("Unexpected API call")
5357
}

Tests/SourceControlTests/RepositoryManagerTests.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ private class DummyRepository: Repository {
3333
fatalError("unexpected API call")
3434
}
3535

36+
func exists(revision: Revision) -> Bool {
37+
fatalError("unexpected API call")
38+
}
39+
3640
func fetch() throws {
3741
provider.numFetches += 1
3842
}

0 commit comments

Comments
 (0)