summaryrefslogtreecommitdiff
path: root/Hutch/Extensions/SRHTWebURL.swift
diff options
context:
space:
mode:
Diffstat (limited to 'Hutch/Extensions/SRHTWebURL.swift')
-rw-r--r--Hutch/Extensions/SRHTWebURL.swift14
1 files changed, 14 insertions, 0 deletions
diff --git a/Hutch/Extensions/SRHTWebURL.swift b/Hutch/Extensions/SRHTWebURL.swift
index cd8e8be..bfed48b 100644
--- a/Hutch/Extensions/SRHTWebURL.swift
+++ b/Hutch/Extensions/SRHTWebURL.swift
@@ -12,6 +12,16 @@ enum SRHTWebURL {
)
}
+ static func httpsCloneURL(_ repositorySummary: RepositorySummary) -> String? {
+ repository(repositorySummary)?.absoluteString
+ }
+
+ static func sshCloneURL(_ repositorySummary: RepositorySummary) -> String {
+ let host = "\(repositorySummary.service.rawValue).sr.ht"
+ let user = repositorySummary.service == .hg ? "hg" : "git"
+ return "\(user)@\(host):\(repositorySummary.owner.canonicalName)/\(repositorySummary.name)"
+ }
+
static func commit(repository: RepositorySummary, commitId: String) -> URL? {
userScopedURL(
host: "\(repository.service.rawValue).sr.ht",
@@ -63,6 +73,10 @@ enum SRHTWebURL {
)
}
+ static func tracker(_ trackerSummary: TrackerSummary) -> URL? {
+ tracker(ownerUsername: trackerSummary.owner.canonicalName.srhtUsername, trackerName: trackerSummary.name)
+ }
+
static func projectSource(_ source: Project.SourceRepo) -> URL? {
userScopedURL(
host: "\(source.repoType.service.rawValue).sr.ht",