| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Unison.Cli.ProjectUtils
Description
Project-related utilities.
Synopsis
- expectProjectBranchByName :: Project -> ProjectBranchName -> Cli ProjectBranch
- resolveBranchRelativePath :: BranchRelativePath -> Cli ProjectPath
- resolveProjectBranch :: ProjectAndBranch (Maybe ProjectName) (Maybe ProjectBranchName) -> Cli (ProjectAndBranch Project ProjectBranch)
- resolveProjectBranchInProject :: Project -> ProjectAndBranch (Maybe ProjectName) (Maybe ProjectBranchName) -> Cli (ProjectAndBranch Project ProjectBranch)
- hydrateNames :: These ProjectName ProjectBranchName -> Cli (ProjectAndBranch ProjectName ProjectBranchName)
- expectProjectAndBranchByIds :: ProjectAndBranch ProjectId ProjectBranchId -> Transaction (ProjectAndBranch Project ProjectBranch)
- getProjectAndBranchByTheseNames :: These ProjectName ProjectBranchName -> Cli (Maybe (ProjectAndBranch Project ProjectBranch))
- getProjectAndBranchByNames :: ProjectAndBranch ProjectName ProjectBranchName -> Transaction (Maybe (ProjectAndBranch Project ProjectBranch))
- getProjectByName :: ProjectName -> Cli (Maybe Project)
- expectProjectAndBranchByTheseNames :: These ProjectName ProjectBranchName -> Cli (ProjectAndBranch Project ProjectBranch)
- expectProjectAndBranchByTheseNamesTx :: (forall void. Output -> Transaction void) -> Project -> These ProjectName ProjectBranchName -> Transaction (ProjectAndBranch Project ProjectBranch)
- getProjectBranchCausalHash :: ProjectBranch -> Transaction CausalHash
- expectRemoteProjectById :: RemoteProjectId -> ProjectName -> Cli RemoteProject
- expectRemoteProjectByName :: ProjectName -> Cli RemoteProject
- expectRemoteProjectBranchById :: IncludeSquashedHead -> ProjectAndBranch (RemoteProjectId, ProjectName) (RemoteProjectBranchId, ProjectBranchName) -> Cli RemoteProjectBranch
- loadRemoteProjectBranchByName :: IncludeSquashedHead -> ProjectAndBranch RemoteProjectId ProjectBranchName -> Cli (Maybe RemoteProjectBranch)
- expectRemoteProjectBranchByName :: IncludeSquashedHead -> ProjectAndBranch (RemoteProjectId, ProjectName) ProjectBranchName -> Cli RemoteProjectBranch
- loadRemoteProjectBranchByNames :: IncludeSquashedHead -> ProjectAndBranch ProjectName ProjectBranchName -> Cli (Maybe RemoteProjectBranch)
- expectRemoteProjectBranchByNames :: IncludeSquashedHead -> ProjectAndBranch ProjectName ProjectBranchName -> Cli RemoteProjectBranch
- expectRemoteProjectBranchByTheseNames :: IncludeSquashedHead -> These ProjectName ProjectBranchName -> Cli RemoteProjectBranch
- justTheIds :: ProjectAndBranch Project ProjectBranch -> ProjectAndBranch ProjectId ProjectBranchId
- justTheIds' :: ProjectBranch -> ProjectAndBranch ProjectId ProjectBranchId
- justTheNames :: ProjectAndBranch Project ProjectBranch -> ProjectAndBranch ProjectName ProjectBranchName
- findTemporaryBranchName :: ProjectId -> ProjectBranchName -> Transaction ProjectBranchName
- expectLatestReleaseBranchName :: RemoteProject -> Cli ProjectBranchName
- data ProjectBranch = ProjectBranch {
- projectId :: !ProjectId
- branchId :: !ProjectBranchId
- name :: !ProjectBranchName
- parentBranchId :: !(Maybe ProjectBranchId)
- isMerge :: !Bool
- isUpdate :: !Bool
- isUpgrade :: !Bool
- data Project = Project {
- projectId :: !ProjectId
- name :: !ProjectName
Project/path helpers
resolveProjectBranch :: ProjectAndBranch (Maybe ProjectName) (Maybe ProjectBranchName) -> Cli (ProjectAndBranch Project ProjectBranch) Source #
Expect/resolve branch reference with the following rules:
- If the project is missing, use the current project.
- If we have an unambiguous `branch` or `projectbranch`, resolve it using the current
project, defaulting to
mainif branch is unspecified.
resolveProjectBranchInProject :: Project -> ProjectAndBranch (Maybe ProjectName) (Maybe ProjectBranchName) -> Cli (ProjectAndBranch Project ProjectBranch) Source #
Expect/resolve branch reference with the following rules:
- If the project is missing, use the provided project.
- If we have an unambiguous `branch` or `projectbranch`, resolve it using the provided
project, defaulting to
mainif branch is unspecified.
Name hydration
hydrateNames :: These ProjectName ProjectBranchName -> Cli (ProjectAndBranch ProjectName ProjectBranchName) Source #
Loading local project info
expectProjectAndBranchByIds :: ProjectAndBranch ProjectId ProjectBranchId -> Transaction (ProjectAndBranch Project ProjectBranch) Source #
getProjectAndBranchByTheseNames :: These ProjectName ProjectBranchName -> Cli (Maybe (ProjectAndBranch Project ProjectBranch)) Source #
getProjectAndBranchByNames :: ProjectAndBranch ProjectName ProjectBranchName -> Transaction (Maybe (ProjectAndBranch Project ProjectBranch)) Source #
getProjectByName :: ProjectName -> Cli (Maybe Project) Source #
expectProjectAndBranchByTheseNames :: These ProjectName ProjectBranchName -> Cli (ProjectAndBranch Project ProjectBranch) Source #
expectProjectAndBranchByTheseNamesTx :: (forall void. Output -> Transaction void) -> Project -> These ProjectName ProjectBranchName -> Transaction (ProjectAndBranch Project ProjectBranch) Source #
Like expectProjectAndBranchByTheseNames, but in Transaction, and takes the current project and a rollback
function as arguments.
getProjectBranchCausalHash :: ProjectBranch -> Transaction CausalHash Source #
Get the causal hash of a project branch.
Loading remote project info
expectRemoteProjectById :: RemoteProjectId -> ProjectName -> Cli RemoteProject Source #
Expect a remote project by id. Its latest-known name is also provided, for error messages.
expectRemoteProjectBranchById :: IncludeSquashedHead -> ProjectAndBranch (RemoteProjectId, ProjectName) (RemoteProjectBranchId, ProjectBranchName) -> Cli RemoteProjectBranch Source #
loadRemoteProjectBranchByName :: IncludeSquashedHead -> ProjectAndBranch RemoteProjectId ProjectBranchName -> Cli (Maybe RemoteProjectBranch) Source #
expectRemoteProjectBranchByName :: IncludeSquashedHead -> ProjectAndBranch (RemoteProjectId, ProjectName) ProjectBranchName -> Cli RemoteProjectBranch Source #
loadRemoteProjectBranchByNames :: IncludeSquashedHead -> ProjectAndBranch ProjectName ProjectBranchName -> Cli (Maybe RemoteProjectBranch) Source #
expectRemoteProjectBranchByNames :: IncludeSquashedHead -> ProjectAndBranch ProjectName ProjectBranchName -> Cli RemoteProjectBranch Source #
expectRemoteProjectBranchByTheseNames :: IncludeSquashedHead -> These ProjectName ProjectBranchName -> Cli RemoteProjectBranch Source #
Projecting out common things
justTheIds :: ProjectAndBranch Project ProjectBranch -> ProjectAndBranch ProjectId ProjectBranchId Source #
justTheNames :: ProjectAndBranch Project ProjectBranch -> ProjectAndBranch ProjectName ProjectBranchName Source #
Other helpers
expectLatestReleaseBranchName :: RemoteProject -> Cli ProjectBranchName Source #
Expect the given remote project to have a latest release, and return it as a valid branch name.
Export fields so we can use dot-notation
data ProjectBranch #
A project branch.
Constructors
| ProjectBranch | |
Fields
| |
Instances
A project.
Constructors
| Project | |
Fields
| |
Instances
| Generic Project | |||||
Defined in U.Codebase.Sqlite.Project Associated Types
| |||||
| Show Project | |||||
| Eq Project | |||||
| FromRow Project | |||||
Defined in U.Codebase.Sqlite.Project | |||||
| ToRow Project | |||||
Defined in U.Codebase.Sqlite.Project | |||||
| Pathy ProjectPath | |||||
Defined in Unison.Codebase.ProjectPath Methods ascend :: ProjectPath -> Maybe ProjectPath # descend :: ProjectPath -> NameSegment -> ProjectPath # prefix :: ProjectPath -> Path -> ProjectPath # split :: ProjectPath -> Maybe (Split ProjectPath) # unsplit :: Split ProjectPath -> ProjectPath # toText :: ProjectPath -> Text # | |||||
| From ProjectPath Text | |||||
Defined in Unison.Codebase.ProjectPath Methods from :: ProjectPath -> Text # | |||||
| type Rep Project | |||||
Defined in U.Codebase.Sqlite.Project type Rep Project = D1 ('MetaData "Project" "U.Codebase.Sqlite.Project" "unison-codebase-sqlite-0.0.0-8z668DVoopd5Hd4AwRCMd4" 'False) (C1 ('MetaCons "Project" 'PrefixI 'True) (S1 ('MetaSel ('Just "projectId") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ProjectId) :*: S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ProjectName))) | |||||