-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1b5c93d
commit 1f90eb3
Showing
2 changed files
with
4 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ import Data.These (These (..)) | |
import Data.Void (Void) | ||
import EasyTest | ||
import Text.Megaparsec qualified as P | ||
import Unison.Codebase.Editor.RemoteRepo (ReadGitRepo (..), ReadRemoteNamespace (..), ShareCodeserver (..), ShareUserHandle (..), WriteGitRemoteNamespace (..), WriteGitRepo (..), WriteRemoteNamespace (..), WriteShareRemoteNamespace (..), pattern ReadGitRemoteNamespace, pattern ReadShareLooseCode) | ||
import Unison.Codebase.Editor.RemoteRepo (ReadRemoteNamespace (..), ShareCodeserver (..), ShareUserHandle (..), WriteRemoteNamespace (..), WriteShareRemoteNamespace (..), pattern ReadShareLooseCode) | ||
import Unison.Codebase.Editor.UriParser qualified as UriParser | ||
import Unison.Codebase.Path qualified as Path | ||
import Unison.Codebase.ShortCausalHash (ShortCausalHash (..)) | ||
|
@@ -23,22 +23,7 @@ test = | |
[ ("unisonweb.base._releases.M4", looseR "unisonweb" ["base", "_releases", "M4"]), | ||
("project", branchR (This "project")), | ||
("/branch", branchR (That "branch")), | ||
("project/branch", branchR (These "project" "branch")), | ||
("git(/srv/git/project.git)", gitR "/srv/git/project.git" Nothing Nothing []), | ||
("git(/srv/git/project.git:abc)#def.hij.klm", gitR "/srv/git/project.git" (Just "abc") (sch "def") ["hij", "klm"]), | ||
("git(srv/git/project.git)", gitR "srv/git/project.git" Nothing Nothing []), | ||
("git(srv/git/project.git:abc)#def.hij.klm", gitR "srv/git/project.git" (Just "abc") (sch "def") ["hij", "klm"]), | ||
("git(file:///srv/git/project.git)", gitR "file:///srv/git/project.git" Nothing Nothing []), | ||
("git(file:///srv/git/project.git:abc)#def.hij.klm", gitR "file:///srv/git/project.git" (Just "abc") (sch "def") ["hij", "klm"]), | ||
("git(file://srv/git/project.git)", gitR "file://srv/git/project.git" Nothing Nothing []), | ||
("git(file://srv/git/project.git:abc)#def.hij.klm", gitR "file://srv/git/project.git" (Just "abc") (sch "def") ["hij", "klm"]), | ||
("git(https://example.com/git/project.git)", gitR "https://example.com/git/project.git" Nothing Nothing []), | ||
("git(https://[email protected]/git/project.git:abc)#def.hij.klm", gitR "https://[email protected]/git/project.git" (Just "abc") (sch "def") ["hij", "klm"]), | ||
("git(ssh://[email protected]:222/user/project.git)", gitR "ssh://[email protected]:222/user/project.git" Nothing Nothing []), | ||
("git(ssh://[email protected]/user/project.git:abc)#def.hij.klm", gitR "ssh://[email protected]/user/project.git" (Just "abc") (sch "def") ["hij", "klm"]), | ||
("git([email protected]:user/project.git)", gitR "[email protected]:user/project.git" Nothing Nothing []), | ||
("git(github.com:user/project.git)", gitR "github.com:user/project.git" Nothing Nothing []), | ||
("git([email protected]:user/project.git:abc)#def.hij.klm", gitR "[email protected]:user/project.git" (Just "abc") (sch "def") ["hij", "klm"]) | ||
("project/branch", branchR (These "project" "branch")) | ||
] | ||
[".unisonweb.base"], | ||
parserTests | ||
|
@@ -47,33 +32,12 @@ test = | |
[ ("unisonweb.base._releases.M4", looseW "unisonweb" ["base", "_releases", "M4"]), | ||
("project", branchW (This "project")), | ||
("/branch", branchW (That "branch")), | ||
("project/branch", branchW (These "project" "branch")), | ||
("git(/srv/git/project.git)", gitW "/srv/git/project.git" Nothing []), | ||
("git(srv/git/project.git)", gitW "srv/git/project.git" Nothing []), | ||
("git(file:///srv/git/project.git)", gitW "file:///srv/git/project.git" Nothing []), | ||
("git(file://srv/git/project.git)", gitW "file://srv/git/project.git" Nothing []), | ||
("git(https://example.com/git/project.git)", gitW "https://example.com/git/project.git" Nothing []), | ||
("git(ssh://[email protected]:222/user/project.git)", gitW "ssh://[email protected]:222/user/project.git" Nothing []), | ||
("git([email protected]:user/project.git)", gitW "[email protected]:user/project.git" Nothing []), | ||
("git(github.com:user/project.git)", gitW "github.com:user/project.git" Nothing []) | ||
("project/branch", branchW (These "project" "branch")) | ||
] | ||
[ ".unisonweb.base", | ||
"git(/srv/git/project.git:abc)#def.hij.klm", | ||
"git(srv/git/project.git:abc)#def.hij.klm", | ||
"git(file:///srv/git/project.git:abc)#def.hij.klm", | ||
"git(file://srv/git/project.git:abc)#def.hij.klm", | ||
"git(https://[email protected]/git/project.git:abc)#def.hij.klm", | ||
"git(ssh://[email protected]/user/project.git:abc)#def.hij.klm", | ||
"git([email protected]:user/project.git:abc)#def.hij.klm" | ||
[ ".unisonweb.base" | ||
] | ||
] | ||
|
||
gitR :: Text -> Maybe Text -> Maybe ShortCausalHash -> [NameSegment] -> ReadRemoteNamespace void | ||
gitR url ref sch path = ReadRemoteNamespaceGit (ReadGitRemoteNamespace (ReadGitRepo url ref) sch (Path.fromList path)) | ||
|
||
gitW :: Text -> Maybe Text -> [NameSegment] -> WriteRemoteNamespace void | ||
gitW url branch path = WriteRemoteNamespaceGit (WriteGitRemoteNamespace (WriteGitRepo url branch) (Path.fromList path)) | ||
|
||
looseR :: Text -> [NameSegment] -> ReadRemoteNamespace void | ||
looseR user path = | ||
ReadShare'LooseCode (ReadShareLooseCode DefaultCodeserver (ShareUserHandle user) (Path.fromList path)) | ||
|