-
Notifications
You must be signed in to change notification settings - Fork 271
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/trunk' into series/M3
- Loading branch information
Showing
417 changed files
with
41,287 additions
and
31,158 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* text=auto | ||
*.uc binary |
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 |
---|---|---|
|
@@ -12,6 +12,7 @@ jobs: | |
needs: | ||
- build_linux | ||
- build_macos | ||
- build_windows | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
@@ -48,12 +49,6 @@ jobs: | |
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 | ||
|
||
|
@@ -84,12 +79,6 @@ jobs: | |
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 | ||
|
||
|
@@ -111,3 +100,33 @@ jobs: | |
if-no-files-found: error | ||
name: build-macos | ||
path: ucm-macos.tar.gz | ||
|
||
build_windows: | ||
name: "build_windows" | ||
runs-on: windows-2019 | ||
|
||
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 | ||
- 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-windows.tar.gz -C /tmp/ucm . | ||
- name: Upload windows artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
if-no-files-found: error | ||
name: build-windows | ||
path: ucm-windows.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
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
60 changes: 51 additions & 9 deletions
60
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,26 +1,68 @@ | ||
{- ORMOLU_DISABLE -} -- Remove this when the file is ready to be auto-formatted | ||
module U.Codebase.Sqlite.Branch.Format where | ||
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
Oops, something went wrong.