Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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))
- expectProjectAndBranchByTheseNames :: These ProjectName ProjectBranchName -> Cli (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
- getMergeBranchParent :: ProjectBranch -> Maybe ProjectBranchId
- getUpgradeBranchParent :: ProjectBranch -> Maybe ProjectBranchId
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
main
if 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
main
if 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 #
expectProjectAndBranchByTheseNames :: These ProjectName ProjectBranchName -> Cli (ProjectAndBranch Project ProjectBranch) Source #
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.
Merge/upgrade branch utils
getMergeBranchParent :: ProjectBranch -> Maybe ProjectBranchId Source #
getMergeBranchParent branch
returns the parent branch of a "merge" branch.
When a merge fails, we put you on a branch called `merge-source-into-target`. That's a "merge" branch. It's not currently distinguished in the database, so we first just switch on whether its name begins with "merge-". If it does, then we get the branch's parent, which should exist, but perhaps wouldn't if the user had manually made a parentless branch called "merge-whatever" for whatever reason.
getUpgradeBranchParent :: ProjectBranch -> Maybe ProjectBranchId Source #
getUpgradeBranchParent branch
returns the parent branch of an "upgrade" branch.
When an upgrade fails, we put you on a branch called `upgrade-old-to-new`. That's an "upgrade" branch. It's not currently distinguished in the database, so we first just switch on whether its name begins with "upgrade-". If it does, then we get the branch's parent, which should exist, but perhaps wouldn't if the user had manually made a parentless branch called "upgrade-whatever" for whatever reason.