Skip to content

Commit d95114b

Browse files
committed
Sync to/from file
1 parent 4324c53 commit d95114b

File tree

34 files changed

+1533
-28
lines changed

34 files changed

+1533
-28
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ dist-newstyle
2727
*.prof.html
2828
*.hp
2929
*.ps
30+
*.profiterole.*
3031
/.direnv/
3132
/.envrc
3233

codebase2/codebase-sqlite/U/Codebase/Sqlite/Branch/Format.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ data BranchLocalIds' t d p c = LocalIds
101101
branchPatchLookup :: Vector p,
102102
branchChildLookup :: Vector c
103103
}
104-
deriving (Show)
104+
deriving (Show, Eq)
105105

106106
-- | Bytes encoding a LocalBranch
107107
newtype LocalBranchBytes = LocalBranchBytes ByteString
@@ -110,6 +110,7 @@ newtype LocalBranchBytes = LocalBranchBytes ByteString
110110
data SyncBranchFormat' parent text defn patch child
111111
= SyncFull (BranchLocalIds' text defn patch child) LocalBranchBytes
112112
| SyncDiff parent (BranchLocalIds' text defn patch child) LocalBranchBytes
113+
deriving (Eq, Show)
113114

114115
type SyncBranchFormat = SyncBranchFormat' BranchObjectId TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId)
115116

codebase2/codebase-sqlite/U/Codebase/Sqlite/Causal.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ data SyncCausalFormat' causalHash valueHash = SyncCausalFormat
2222
{ valueHash :: valueHash,
2323
parents :: Vector causalHash
2424
}
25+
deriving stock (Eq, Show)
2526

2627
type SyncCausalFormat = SyncCausalFormat' CausalHashId BranchHashId

codebase2/codebase-sqlite/U/Codebase/Sqlite/Decl/Format.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ type SyncDeclFormat =
3636

3737
data SyncDeclFormat' t d
3838
= SyncDecl (SyncLocallyIndexedComponent' t d)
39+
deriving stock (Eq, Show)
3940

4041
newtype SyncLocallyIndexedComponent' t d
4142
= SyncLocallyIndexedComponent (Vector (LocalIds' t d, ByteString))
43+
deriving stock (Eq, Show)
4244

4345
-- [OldDecl] ==map==> [NewDecl] ==number==> [(NewDecl, Int)] ==sort==> [(NewDecl, Int)] ==> permutation is map snd of that
4446

codebase2/codebase-sqlite/U/Codebase/Sqlite/Entity.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ data SyncEntity' text hash defn patch branchh branch causal
2424
| N (Namespace.SyncBranchFormat' branch text defn patch (branch, causal))
2525
| P (Patch.SyncPatchFormat' patch text hash defn)
2626
| C (Causal.SyncCausalFormat' causal branchh)
27+
deriving stock (Eq, Show)
2728

2829
entityType :: SyncEntity' text hash defn patch branchh branch causal -> TempEntityType
2930
entityType = \case

codebase2/codebase-sqlite/U/Codebase/Sqlite/LocalIds.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ data LocalIds' t h = LocalIds
1515
{ textLookup :: Vector t,
1616
defnLookup :: Vector h
1717
}
18-
deriving (Functor, Show)
18+
deriving stock (Functor, Show, Eq)
1919

2020
type LocalIds = LocalIds' TextId ObjectId
2121

codebase2/codebase-sqlite/U/Codebase/Sqlite/Patch/Format.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,15 @@ data PatchLocalIds' t h d = LocalIds
4040
patchHashLookup :: Vector h,
4141
patchDefnLookup :: Vector d
4242
}
43+
deriving stock (Eq, Show)
4344

4445
type SyncPatchFormat = SyncPatchFormat' PatchObjectId TextId HashId ObjectId
4546

4647
data SyncPatchFormat' parent text hash defn
4748
= SyncFull (PatchLocalIds' text hash defn) ByteString
4849
| -- | p is the identity of the thing that the diff is relative to
4950
SyncDiff parent (PatchLocalIds' text hash defn) ByteString
51+
deriving stock (Eq, Show)
5052

5153
-- | Apply a list of patch diffs to a patch, left to right.
5254
applyPatchDiffs :: Patch -> [PatchDiff] -> Patch

codebase2/codebase-sqlite/U/Codebase/Sqlite/Term/Format.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ newtype LocallyIndexedComponent' t d = LocallyIndexedComponent
4949

5050
newtype SyncLocallyIndexedComponent' t d
5151
= SyncLocallyIndexedComponent (Vector (LocalIds' t d, ByteString))
52+
deriving stock (Eq, Show)
5253

5354
{-
5455
message = "hello, world" -> ABT { ... { Term.F.Text "hello, world" } } -> hashes to (#abc, 0)
@@ -127,6 +128,7 @@ data TermFormat' t d = Term (LocallyIndexedComponent' t d)
127128
type SyncTermFormat = SyncTermFormat' TextId ObjectId
128129

129130
data SyncTermFormat' t d = SyncTerm (SyncLocallyIndexedComponent' t d)
131+
deriving stock (Eq, Show)
130132

131133
data WatchResultFormat
132134
= WatchResult WatchLocalIds Term

codebase2/codebase-sqlite/unison-codebase-sqlite.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 1.12
22

3-
-- This file has been generated from package.yaml by hpack version 0.36.0.
3+
-- This file has been generated from package.yaml by hpack version 0.37.0.
44
--
55
-- see: https://github.com/sol/hpack
66

hie.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ cradle:
140140
- path: "unison-share-api/src"
141141
component: "unison-share-api:lib"
142142

143+
- path: "unison-share-api/tests"
144+
component: "unison-share-api:test:unison-share-api-tests"
145+
143146
- path: "unison-share-projects-api/src"
144147
component: "unison-share-projects-api:lib"
145148

0 commit comments

Comments
 (0)