Skip to content

Commit

Permalink
Merge pull request #43 from SwiftGit2/antitypical-result
Browse files Browse the repository at this point in the history
Switch from LlamaKit to antitypical/Result
  • Loading branch information
mdiep committed Apr 21, 2015
2 parents e550eea + 37bdb9e commit f6b8483
Show file tree
Hide file tree
Showing 18 changed files with 52 additions and 52 deletions.
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
[submodule "Carthage/Checkouts/Guanaco"]
path = Carthage/Checkouts/Guanaco
url = https://github.com/modocache/Guanaco.git
[submodule "Carthage/Checkouts/LlamaKit"]
path = Carthage/Checkouts/LlamaKit
url = https://github.com/LlamaKit/LlamaKit.git
[submodule "Carthage/Checkouts/Nimble"]
path = Carthage/Checkouts/Nimble
url = https://github.com/Quick/Nimble.git
Expand All @@ -16,3 +13,6 @@
[submodule "Carthage/Checkouts/xcconfigs"]
path = Carthage/Checkouts/xcconfigs
url = https://github.com/jspahrsummers/xcconfigs.git
[submodule "Carthage/Checkouts/Result"]
path = Carthage/Checkouts/Result
url = https://github.com/antitypical/Result.git
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "LlamaKit/LlamaKit" ~> 0.6
github "antitypical/Result"
2 changes: 1 addition & 1 deletion Cartfile.private
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github "jspahrsummers/xcconfigs" >= 0.7.2
github "Quick/Quick" "155f858bce082373fc60d0c0a63415bf336c676b"
github "Quick/Nimble" ~> 0.4.1
github "modocache/Guanaco" "18126c0c8ba9a7cb3cc5d43aec83c81047410ab6"
github "modocache/Guanaco" "26b6ceff4b8912abd0dfc3a9eed0a46527e040e3"
8 changes: 4 additions & 4 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github "modocache/Guanaco" "18126c0c8ba9a7cb3cc5d43aec83c81047410ab6"
github "LlamaKit/LlamaKit" "v0.6.0"
github "Quick/Nimble" "v0.4.1"
github "modocache/Guanaco" "26b6ceff4b8912abd0dfc3a9eed0a46527e040e3"
github "Quick/Nimble" "v0.4.2"
github "Quick/Quick" "155f858bce082373fc60d0c0a63415bf336c676b"
github "jspahrsummers/xcconfigs" "0.7.2"
github "antitypical/Result" "0.3"
github "jspahrsummers/xcconfigs" "0.8"
1 change: 0 additions & 1 deletion Carthage/Checkouts/LlamaKit
Submodule LlamaKit deleted from e28d7f
2 changes: 1 addition & 1 deletion Carthage/Checkouts/Nimble
1 change: 1 addition & 0 deletions Carthage/Checkouts/Result
Submodule Result added at 1756b7
2 changes: 1 addition & 1 deletion Carthage/Checkouts/xcconfigs
8 changes: 4 additions & 4 deletions SwiftGit2.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
/* Begin PBXBuildFile section */
BE0991F71A578FB1007D4E6A /* Mantle.zip in Resources */ = {isa = PBXBuildFile; fileRef = BE0991F61A578FB1007D4E6A /* Mantle.zip */; };
BE0B1C5D1A9978890004726D /* detached-head.zip in Resources */ = {isa = PBXBuildFile; fileRef = BE0B1C5C1A9978890004726D /* detached-head.zip */; };
BE14AA321A15AA510015B439 /* LlamaKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE14AA311A15AA510015B439 /* LlamaKit.framework */; };
BE14AA501A1974010015B439 /* SwiftGit2.m in Sources */ = {isa = PBXBuildFile; fileRef = BE14AA4F1A1974010015B439 /* SwiftGit2.m */; };
BE14AA551A1984550015B439 /* Fixtures.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE14AA541A1984550015B439 /* Fixtures.swift */; };
BE14AA571A198C6E0015B439 /* simple-repository.zip in Resources */ = {isa = PBXBuildFile; fileRef = BE14AA561A198C6E0015B439 /* simple-repository.zip */; };
Expand Down Expand Up @@ -90,6 +89,7 @@
BECB5F6C1A56F1B400999413 /* ReferencesSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = BECB5F6B1A56F1B400999413 /* ReferencesSpec.swift */; };
BECB5F6E1A57284700999413 /* Remotes.swift in Sources */ = {isa = PBXBuildFile; fileRef = BECB5F6D1A57284700999413 /* Remotes.swift */; };
BECB5F701A57286200999413 /* RemotesSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = BECB5F6F1A57286200999413 /* RemotesSpec.swift */; };
BEE591C71ADF470500534F14 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BEE591C61ADF470500534F14 /* Result.framework */; };
DA5023A01A969F1A004175D7 /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA50239F1A969F1A004175D7 /* Nimble.framework */; };
DA59146D1A94549A00AED74C /* Guanaco.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA59146C1A94549A00AED74C /* Guanaco.framework */; };
DA5914761A94579000AED74C /* Errors.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA5914751A94579000AED74C /* Errors.swift */; };
Expand Down Expand Up @@ -187,7 +187,6 @@
/* Begin PBXFileReference section */
BE0991F61A578FB1007D4E6A /* Mantle.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = Mantle.zip; sourceTree = "<group>"; };
BE0B1C5C1A9978890004726D /* detached-head.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = "detached-head.zip"; sourceTree = "<group>"; };
BE14AA311A15AA510015B439 /* LlamaKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = LlamaKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
BE14AA4F1A1974010015B439 /* SwiftGit2.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SwiftGit2.m; sourceTree = "<group>"; };
BE14AA541A1984550015B439 /* Fixtures.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Fixtures.swift; sourceTree = "<group>"; };
BE14AA561A198C6E0015B439 /* simple-repository.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = "simple-repository.zip"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -291,6 +290,7 @@
BECB5F6B1A56F1B400999413 /* ReferencesSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReferencesSpec.swift; sourceTree = "<group>"; };
BECB5F6D1A57284700999413 /* Remotes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Remotes.swift; sourceTree = "<group>"; };
BECB5F6F1A57286200999413 /* RemotesSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RemotesSpec.swift; sourceTree = "<group>"; };
BEE591C61ADF470500534F14 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Result.framework; path = "../../Library/Developer/Xcode/DerivedData/SwiftGit2-cdzquzvlxdewyddxgdgxjagqvjba/Build/Products/Debug/Result.framework"; sourceTree = "<group>"; };
DA50239F1A969F1A004175D7 /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Nimble.framework; sourceTree = BUILT_PRODUCTS_DIR; };
DA59146C1A94549A00AED74C /* Guanaco.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Guanaco.framework; sourceTree = BUILT_PRODUCTS_DIR; };
DA5914751A94579000AED74C /* Errors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Errors.swift; sourceTree = "<group>"; };
Expand All @@ -302,7 +302,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
BE14AA321A15AA510015B439 /* LlamaKit.framework in Frameworks */,
BEE591C71ADF470500534F14 /* Result.framework in Frameworks */,
BEB31FA01A0E595600F525B9 /* libz.dylib in Frameworks */,
BEB31F9E1A0E595100F525B9 /* libiconv.dylib in Frameworks */,
);
Expand Down Expand Up @@ -554,9 +554,9 @@
BEB31FA11A0E63C100F525B9 /* Libraries */ = {
isa = PBXGroup;
children = (
BEE591C61ADF470500534F14 /* Result.framework */,
BEB31F9D1A0E595100F525B9 /* libiconv.dylib */,
BEB31F9F1A0E595600F525B9 /* libz.dylib */,
BE14AA311A15AA510015B439 /* LlamaKit.framework */,
);
name = Libraries;
sourceTree = "<group>";
Expand Down
2 changes: 1 addition & 1 deletion SwiftGit2.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion SwiftGit2/OID.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

import Foundation
import LlamaKit
import Result

/// An identifier for a Git object.
public struct OID {
Expand Down
56 changes: 28 additions & 28 deletions SwiftGit2/Repository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

import Foundation
import LlamaKit
import Result

public typealias CheckoutProgressBlock = SG2CheckoutProgressBlock

Expand All @@ -26,11 +26,11 @@ final public class Repository {
let result = git_repository_open(&pointer, URL.fileSystemRepresentation)

if result != GIT_OK.value {
return failure(libGit2Error(result, libGit2PointOfFailure: "git_repository_open"))
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_repository_open"))
}

let repository = Repository(pointer)
return success(repository)
return Result.success(repository)
}

// MARK: - Initializers
Expand Down Expand Up @@ -75,7 +75,7 @@ final public class Repository {
let result = git_object_lookup(&pointer, self.pointer, &oid, type)

if result != GIT_OK.value {
return failure(libGit2Error(result, libGit2PointOfFailure: "git_object_lookup"))
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_object_lookup"))
}

let value = transform(pointer)
Expand All @@ -84,7 +84,7 @@ final public class Repository {
}

func withLibgit2Object<T>(oid: OID, type: git_otype, transform: COpaquePointer -> T) -> Result<T, NSError> {
return withLibgit2Object(oid, type: type) { success(transform($0)) }
return withLibgit2Object(oid, type: type) { Result.success(transform($0)) }
}

/// Loads the object with the given OID.
Expand All @@ -96,13 +96,13 @@ final public class Repository {
return withLibgit2Object(oid, type: GIT_OBJ_ANY) { object in
let type = git_object_type(object)
if type == Blob.type {
return success(Blob(object))
return Result.success(Blob(object))
} else if type == Commit.type {
return success(Commit(object))
return Result.success(Commit(object))
} else if type == Tag.type {
return success(Tag(object))
return Result.success(Tag(object))
} else if type == Tree.type {
return success(Tree(object))
return Result.success(Tree(object))
}

let error = NSError(
Expand All @@ -112,7 +112,7 @@ final public class Repository {
NSLocalizedDescriptionKey: "Unrecognized git_otype '\(type)' for oid '\(oid)'."
]
)
return failure(error)
return Result.failure(error)
}
}

Expand Down Expand Up @@ -190,7 +190,7 @@ final public class Repository {

if result != GIT_OK.value {
pointer.dealloc(1)
return failure(libGit2Error(result, libGit2PointOfFailure: "git_remote_list"))
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_remote_list"))
}

let strarray = pointer.memory
Expand All @@ -202,9 +202,9 @@ final public class Repository {

let error = remotes.reduce(nil) { $0 == nil ? $0 : $1.error }
if let error = error {
return failure(error)
return Result.failure(error)
}
return success(remotes.map { $0.value! })
return Result.success(remotes.map { $0.value! })
}

/// Load a remote from the repository.
Expand All @@ -217,12 +217,12 @@ final public class Repository {
let result = git_remote_lookup(&pointer, self.pointer, name)

if result != GIT_OK.value {
return failure(libGit2Error(result, libGit2PointOfFailure: "git_remote_lookup"))
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_remote_lookup"))
}

let value = Remote(pointer)
git_remote_free(pointer)
return success(value)
return Result.success(value)
}

// MARK: - Reference Lookups
Expand All @@ -234,7 +234,7 @@ final public class Repository {

if result != GIT_OK.value {
pointer.dealloc(1)
return failure(libGit2Error(result, libGit2PointOfFailure: "git_reference_list"))
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_reference_list"))
}

let strarray = pointer.memory
Expand All @@ -250,9 +250,9 @@ final public class Repository {

let error = references.reduce(nil) { $0 == nil ? $0 : $1.error }
if let error = error {
return failure(error)
return Result.failure(error)
}
return success(references.map { $0.value! })
return Result.success(references.map { $0.value! })
}

/// Load the reference with the given long name (e.g. "refs/heads/master")
Expand All @@ -265,12 +265,12 @@ final public class Repository {
let result = git_reference_lookup(&pointer, self.pointer, name)

if result != GIT_OK.value {
return failure(libGit2Error(result, libGit2PointOfFailure: "git_reference_lookup"))
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_reference_lookup"))
}

let value = referenceWithLibGit2Reference(pointer)
git_reference_free(pointer)
return success(value)
return Result.success(value)
}

/// Load and return a list of all local branches.
Expand Down Expand Up @@ -321,11 +321,11 @@ final public class Repository {
var pointer: COpaquePointer = nil
let result = git_repository_head(&pointer, self.pointer)
if result != GIT_OK.value {
return failure(libGit2Error(result, libGit2PointOfFailure: "git_repository_head"))
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_repository_head"))
}
let value = referenceWithLibGit2Reference(pointer)
git_reference_free(pointer)
return success(value)
return Result.success(value)
}

/// Set HEAD to the given oid (detached).
Expand All @@ -336,9 +336,9 @@ final public class Repository {
var oid = oid.oid
let result = git_repository_set_head_detached(self.pointer, &oid);
if result != GIT_OK.value {
return failure(libGit2Error(result, libGit2PointOfFailure: "git_repository_set_head"))
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_repository_set_head"))
}
return success()
return Result.success()
}

/// Set HEAD to the given reference.
Expand All @@ -348,9 +348,9 @@ final public class Repository {
public func setHEAD(reference: ReferenceType) -> Result<(), NSError> {
let result = git_repository_set_head(self.pointer, reference.longName);
if result != GIT_OK.value {
return failure(libGit2Error(result, libGit2PointOfFailure: "git_repository_set_head"))
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_repository_set_head"))
}
return success()
return Result.success()
}

/// Check out HEAD.
Expand All @@ -364,10 +364,10 @@ final public class Repository {

let result = git_checkout_head(self.pointer, &options)
if result != GIT_OK.value {
return failure(libGit2Error(result, libGit2PointOfFailure: "git_checkout_head"))
return Result.failure(libGit2Error(result, libGit2PointOfFailure: "git_checkout_head"))
}

return success()
return Result.success()
}

/// Check out the given OID.
Expand Down
2 changes: 1 addition & 1 deletion SwiftGit2Tests/OIDSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
//

import LlamaKit
import Result
import SwiftGit2
import Nimble
import Quick
Expand Down
2 changes: 1 addition & 1 deletion SwiftGit2Tests/ObjectsSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
//

import LlamaKit
import Result
import SwiftGit2
import Nimble
import Quick
Expand Down
2 changes: 1 addition & 1 deletion SwiftGit2Tests/ReferencesSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright (c) 2015 GitHub, Inc. All rights reserved.
//

import LlamaKit
import Result
import SwiftGit2
import Nimble
import Quick
Expand Down
2 changes: 1 addition & 1 deletion SwiftGit2Tests/RemotesSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright (c) 2015 GitHub, Inc. All rights reserved.
//

import LlamaKit
import Result
import SwiftGit2
import Nimble
import Quick
Expand Down
2 changes: 1 addition & 1 deletion SwiftGit2Tests/RepositorySpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
//

import LlamaKit
import Result
import SwiftGit2
import Nimble
import Quick
Expand Down

0 comments on commit f6b8483

Please sign in to comment.