-
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.
Merge branch 'trunk' into fix/float-redundancy
- Loading branch information
Showing
514 changed files
with
28,781 additions
and
10,882 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
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,23 +6,6 @@ on: | |
- "release/*" | ||
|
||
jobs: | ||
release: | ||
name: "release" | ||
runs-on: "ubuntu-latest" | ||
|
||
strategy: | ||
# Run each build to completion, regardless of if any have failed | ||
fail-fast: false | ||
steps: | ||
- name: create-release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
with: | ||
if-no-files-found: error | ||
name: build-linux | ||
path: ucm-linux.tar.gz | ||
|
||
release: | ||
name: "create_release" | ||
runs-on: "ubuntu-latest" | ||
|
@@ -53,3 +36,78 @@ jobs: | |
with: | ||
files: /tmp/ucm/**/*.tar.gz | ||
|
||
build_linux: | ||
|
||
name: "build_linux" | ||
runs-on: ubuntu-18.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: install stack | ||
run: | | ||
curl -L https://github.com/commercialhaskell/stack/releases/download/v2.5.1/stack-2.5.1-linux-x86_64.tar.gz | tar -xz | ||
echo "$HOME/stack-2.5.1-linux-x86_64/" >> $GITHUB_PATH | ||
# One of the transcripts fails if the user's git name hasn't been set. | ||
- name: set git user info | ||
run: | | ||
git config --global user.name "GitHub Actions" | ||
git config --global user.email "[email protected]" | ||
- name: build | ||
run: stack --no-terminal build --flag unison-parser-typechecker:optimized | ||
|
||
- name: fetch latest codebase-ui and package with ucm | ||
run: | | ||
mkdir -p /tmp/ucm/ui | ||
UCM=$(stack path | awk '/local-install-root/{print $2}')/bin/unison | ||
cp $UCM /tmp/ucm/ucm | ||
wget -O/tmp/unisonLocal.zip https://github.com/unisonweb/codebase-ui/releases/download/latest/unisonLocal.zip | ||
unzip -d /tmp/ucm/ui /tmp/unisonLocal.zip | ||
tar -c -z -f ucm-linux.tar.gz -C /tmp/ucm . | ||
- name: Upload linux artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
if-no-files-found: error | ||
name: build-linux | ||
path: ucm-linux.tar.gz | ||
|
||
build_macos: | ||
name: "build_macos" | ||
runs-on: macos-10.15 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: install stack | ||
run: | | ||
curl -L https://github.com/commercialhaskell/stack/releases/download/v2.5.1/stack-2.5.1-osx-x86_64.tar.gz | tar -xz | ||
echo "$HOME/stack-2.5.1-osx-x86_64/" >> $GITHUB_PATH | ||
# One of the transcripts fails if the user's git name hasn't been set. | ||
- name: set git user info | ||
run: | | ||
git config --global user.name "GitHub Actions" | ||
git config --global user.email "[email protected]" | ||
- name: remove ~/.stack/setup-exe-cache on macOS | ||
run: rm -rf ~/.stack/setup-exe-cache | ||
|
||
- name: build | ||
run: stack --no-terminal build --flag unison-parser-typechecker:optimized | ||
|
||
- name: fetch latest codebase-ui and package with ucm | ||
run: | | ||
mkdir -p /tmp/ucm/ui | ||
UCM=$(stack path | awk '/local-install-root/{print $2}')/bin/unison | ||
cp $UCM /tmp/ucm/ucm | ||
wget -O/tmp/unisonLocal.zip https://github.com/unisonweb/codebase-ui/releases/download/latest/unisonLocal.zip | ||
unzip -d /tmp/ucm/ui /tmp/unisonLocal.zip | ||
tar -c -z -f ucm-macos.tar.gz -C /tmp/ucm . | ||
- name: Upload macos artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
if-no-files-found: error | ||
name: build-macos | ||
path: ucm-macos.tar.gz |
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 |
---|---|---|
|
@@ -13,3 +13,4 @@ dist-newstyle | |
|
||
# GHC | ||
*.hie | ||
*.prof |
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
59 changes: 51 additions & 8 deletions
59
codebase2/codebase-sqlite/U/Codebase/Sqlite/Branch/Format.hs
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 |
---|---|---|
@@ -1,25 +1,68 @@ | ||
module U.Codebase.Sqlite.Branch.Format where | ||
{- ORMOLU_DISABLE -} -- Remove this when the file is ready to be auto-formatted | ||
module U.Codebase.Sqlite.Branch.Format | ||
( BranchFormat (..), | ||
BranchLocalIds (..), | ||
SyncBranchFormat (..), | ||
localToDbBranch, | ||
localToDbDiff, | ||
-- dbToLocalDiff, | ||
) where | ||
|
||
import Data.Vector (Vector) | ||
import U.Codebase.Sqlite.Branch.Diff (LocalDiff) | ||
import U.Codebase.Sqlite.Branch.Full (LocalBranch) | ||
import U.Codebase.Sqlite.DbId (CausalHashId, BranchObjectId, ObjectId, PatchObjectId, TextId) | ||
import Data.ByteString (ByteString) | ||
import qualified Data.Vector as Vector | ||
import U.Codebase.Sqlite.Branch.Diff (Diff, LocalDiff) | ||
import qualified U.Codebase.Sqlite.Branch.Diff as Branch.Diff | ||
import U.Codebase.Sqlite.Branch.Full (DbBranch, LocalBranch) | ||
import qualified U.Codebase.Sqlite.Branch.Full as Branch.Full | ||
import U.Codebase.Sqlite.DbId (BranchObjectId, CausalHashId, ObjectId, PatchObjectId, TextId) | ||
import U.Codebase.Sqlite.LocalIds | ||
( LocalBranchChildId (..), | ||
LocalDefnId (..), | ||
LocalPatchObjectId (..), | ||
LocalTextId (..), | ||
) | ||
import Unison.Prelude | ||
|
||
-- |you can use the exact same `BranchLocalIds` when converting between `Full` and `Diff` | ||
-- | A 'BranchFormat' is a deserialized namespace object (@object.bytes@). | ||
-- | ||
-- you can use the exact same `BranchLocalIds` when converting between `Full` and `Diff` | ||
data BranchFormat | ||
= Full BranchLocalIds LocalBranch | ||
| Diff BranchObjectId BranchLocalIds LocalDiff | ||
deriving Show | ||
deriving (Show) | ||
|
||
-- | A 'BranchLocalIds' is a mapping between local ids (local to this object) encoded as offsets, and actual database ids. | ||
-- | ||
-- For example, a @branchTextLookup@ vector of @[50, 74]@ means "local id 0 corresponds to database text id 50, and | ||
-- local id 1 corresponds to database text id 74". | ||
data BranchLocalIds = LocalIds | ||
{ branchTextLookup :: Vector TextId, | ||
branchDefnLookup :: Vector ObjectId, | ||
branchPatchLookup :: Vector PatchObjectId, | ||
branchChildLookup :: Vector (BranchObjectId, CausalHashId) | ||
} | ||
deriving Show | ||
deriving (Show) | ||
|
||
data SyncBranchFormat | ||
= SyncFull BranchLocalIds ByteString | ||
| SyncDiff BranchObjectId BranchLocalIds ByteString | ||
|
||
localToDbBranch :: BranchLocalIds -> LocalBranch -> DbBranch | ||
localToDbBranch li = | ||
Branch.Full.quadmap (lookupBranchLocalText li) (lookupBranchLocalDefn li) (lookupBranchLocalPatch li) (lookupBranchLocalChild li) | ||
|
||
localToDbDiff :: BranchLocalIds -> LocalDiff -> Diff | ||
localToDbDiff li = | ||
Branch.Diff.quadmap (lookupBranchLocalText li) (lookupBranchLocalDefn li) (lookupBranchLocalPatch li) (lookupBranchLocalChild li) | ||
|
||
lookupBranchLocalText :: BranchLocalIds -> LocalTextId -> TextId | ||
lookupBranchLocalText li (LocalTextId w) = branchTextLookup li Vector.! fromIntegral w | ||
|
||
lookupBranchLocalDefn :: BranchLocalIds -> LocalDefnId -> ObjectId | ||
lookupBranchLocalDefn li (LocalDefnId w) = branchDefnLookup li Vector.! fromIntegral w | ||
|
||
lookupBranchLocalPatch :: BranchLocalIds -> LocalPatchObjectId -> PatchObjectId | ||
lookupBranchLocalPatch li (LocalPatchObjectId w) = branchPatchLookup li Vector.! fromIntegral w | ||
|
||
lookupBranchLocalChild :: BranchLocalIds -> LocalBranchChildId -> (BranchObjectId, CausalHashId) | ||
lookupBranchLocalChild li (LocalBranchChildId w) = branchChildLookup li Vector.! fromIntegral w |
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{-# LANGUAGE RecordWildCards #-} | ||
|
||
module U.Codebase.Sqlite.Causal where | ||
|
||
import U.Codebase.Sqlite.DbId (BranchHashId, CausalHashId) | ||
import Unison.Prelude | ||
|
||
data GDbCausal causalHash valueHash = DbCausal | ||
{ selfHash :: causalHash, | ||
valueHash :: valueHash, | ||
parents :: Set causalHash | ||
} | ||
|
||
-- Causal Plan | ||
-- * Load a DbCausal (how do we do this) | ||
-- => new function Queries.localCausalByCausalHashId, can model after loadCausalByCausalHash or factor out of | ||
-- * Add valueHashId as a dependency if unmigrated | ||
-- * Add parent causal hash ids as dependencies if unmigrated | ||
-- => Queries.loadCausalParents | ||
-- * Map over Branch hash IDs | ||
-- * Inside saveDBCausal (new / factored out of original) | ||
-- * Save as a new self-hash | ||
-- ==> Queries.saveCausal | ||
-- * Map over parent causal hash IDs | ||
-- ==> Queries.saveCausalParents | ||
|
||
type DbCausal = GDbCausal CausalHashId BranchHashId | ||
|
||
-- causalHashes_ :: Traversal (GDbCausal ch vh) (GDbCausal ch' vh) ch ch' | ||
-- causalHashes_ f DbCausal {..} = | ||
-- DbCausal <$> f selfHash <*> pure valueHash <*> (fmap Set.fromList . traverse f . Set.toList $ parents) | ||
|
||
-- valueHashes_ :: Lens (GDbCausal ch vh) (GDbCausal ch vh) vh vh' | ||
-- valueHashes_ f DbCausal{..} = | ||
-- (\p vh -> DbCausal selfHash vh p) parents <$> f valueHash | ||
|
||
-- data Causal m hc he e = Causal | ||
-- { causalHash :: hc, | ||
-- valueHash :: he, | ||
-- parents :: Map hc (m (Causal m hc he e)), | ||
-- value :: m e | ||
-- } |
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
Oops, something went wrong.