Skip to content

Commit 63a2714

Browse files
committed
Handle "Working copy" progress lines
1 parent 90cbd37 commit 63a2714

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

Sources/ReleaseNotesCore/Parser.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ import Darwin
66
enum Parser {
77

88
static let progress = Skip(
9-
"Updating".orElse("Updated").orElse("Computing").orElse("Computed")
9+
"Updating"
10+
.orElse("Updated")
11+
.orElse("Computing")
12+
.orElse("Computed")
13+
.orElse("Creating working copy")
14+
.orElse("Working copy of")
1015
)
1116
.skip(Prefix { $0 != "\n"})
1217

Sources/ReleaseNotesCore/ReleaseNotes.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ struct ReleaseNotes: AsyncParsableCommand {
2222
}
2323

2424
guard let updates = Parser.packageUpdate.parse(output) else {
25-
print("Failed to parse results from package update:\n")
26-
print(output)
25+
print("Failed to parse results from package update.\n")
26+
print("Please file an issue with the the output above.")
2727
return
2828
}
2929

Tests/ReleaseNotesCoreTests/ParserCoreTests.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@ final class ParserCoreTests: XCTestCase {
2525
XCTAssertNotNil(Parser.progress.parse(&input))
2626
XCTAssertEqual(input, "")
2727
}
28+
do {
29+
var input = "Creating working copy for https://github.com/JohnSundell/Plot.git"[...]
30+
XCTAssertNotNil(Parser.progress.parse(&input))
31+
XCTAssertEqual(input, "")
32+
}
33+
do {
34+
var input = "Working copy of https://github.com/JohnSundell/Plot.git resolved at 0.10.0"[...]
35+
XCTAssertNotNil(Parser.progress.parse(&input))
36+
XCTAssertEqual(input, "")
37+
}
2838
}
2939

3040
func test_anyProgress() throws {
@@ -41,6 +51,8 @@ final class ParserCoreTests: XCTestCase {
4151
Computed https://github.com/SwiftPackageIndex/SemanticVersion at 0.3.1 (0.01s)
4252
Computing version for https://github.com/apple/swift-argument-parser
4353
Computed https://github.com/apple/swift-argument-parser at 1.0.2 (0.01s)
54+
Creating working copy for https://github.com/JohnSundell/Plot.git
55+
Working copy of https://github.com/JohnSundell/Plot.git resolved at 0.10.0
4456
"""[...]
4557
XCTAssertNotNil(Parser.anyProgress.parse(&input))
4658
XCTAssertEqual(input, "")

0 commit comments

Comments
 (0)