[darcs-devel] toy patch code (was: Re: [patch1880] decouple RepoPatchV3 impl from NamedPrim)

Ganesh Sittampalam ganesh at earth.li
Sat Aug 31 16:02:10 UTC 2019


Moving this to the devel list.

On 31/08/2019 16:13, Ben Franksen wrote:
> 
> Ben Franksen <ben.franksen at online.de> added the comment:
> 
>>> This could be used for far more than just examining a few concrete
>>> examples we find interesting. For instance, I find it interesting to
>>> investigate which definitions of 'conflicts' / 'dependencies' satisfy
>>> our patch laws. E.g. does permutivity hold for the example type you
>>> defined? How large is the (finite!) set of possible 'dependencies' such
>>> that all your patch laws hold? Can we combine conflicts and dependencies
>>> into a single data structure, something like a matrix?
>>
>> I've been doing more with it off and on to try to get a better handle on
>> some underlying model for conflictors, in particular looking at things
>> like minimal contexts and how those relate to the patches actually
>> mentioned in the conflictor. I'd like to get some higher-level
>> understanding of the rules for commuting conflictors, not just the
>> operational description we have at the moment. I haven't really figured
>> out anything illuminating yet though.
> 
> And ultimately it all comes down to establishing general permutivity
> (for all n>=2 and including consistency of failure). I am convinced it
> should be possible to formally derive the commute rules from that
> requirement.

Plus satisfying the high-level properties we expect about when a patch
is in conflict or not. The thing that makes it quite awkward, at least
each time I think about it, is that you need 2 patches to be a conflict
(and hence have their effects nullified). So there's this weird
discontinuity when a conflicting set changes size from 2 to 1.

> I have also come to see merging as the more fundamental operation
> compared to commuting. The direct definition of cleanMerge is nicely
> symmetric and easy to understand. I really should rebase the patches and
> send them.

But does it really cover the harder cases in commute? As I've been
playing with the examples, my feeling is that what's complicated is not
"do these things merge" (whether cleanly or not), but "can we undo a
merge" that might have happened in the past (or never actually happened,
but could have done).

>>> Furthermore: your ApplyState is trivial, which is okay for the purpose
>>> you had in mind. But I wonder: is it possible to construct, for every
>>> finite PrimCore-like type and each set of conflicts and dependencies
>>> such that the patch laws hold, a suitable "model" of a state, such that
>>> sequences of the corresponding Prim type map to (all) partial bijections
>>> on that state?
>>
>> A state could just be a set recording the PrimCores already applied.
> 
> Yes, I guess this is how one would abstractly construct one concrete
> ApplyState. However, the set (or type) of all ApplyStates has a bit more
> stucture, as not all such sets are valid states. I was curious about a
> more declarative way to characterize the states i.e. the allowed sets.
> 
>> But I'm not sure what use it would be at the moment.
> 
> Just pure fun mathematics :-) It would shed light on the algebraic
> structure of patch algebras. For instance, as these are prim patches, no
> two elements may be in the set that are conflicting. And for each
> element, it must also contain its dependencies. Note how the first
> condition limts what we may add to an existing (valid) set, and how the
> latter limits what we can remove from it.

Yeah, and I think that's really all the structure there is.

But the structure of states for conflictors is much less clear to me.
First I thought that you just need two sets of PrimCores, one that's
active and one that's inactive, and that you could uniquely determine
what should be in the active set and the inactive set just from the full
set of PrimCores - just put all the ones that have a conflict with any
other one in the inactive set, and the rest in the active set.

But then I realised that the contexts are more complicated. Let's make
our notation be

  <active PrimCores|inactive PrimCores>.

If you have S, T and U which all conflict, then you can construct the
state <|S,T,U> simply by constructing three repos each with one of them
in and merging them.

But you can also construct <U|S,T> by first merging S and T and then
recording U as the resolution of S and T.

So the full context in which a patch is recorded matters, not just the
context of active primitives. So then I started playing with the minimal
contexts of each patch in all possible repos. But I haven't learnt
anything interesting. (Latest code attached, anyway, completely
undocumented).
-------------- next part --------------

New patches:

[rewrite Merge FL instance in terms of MergeFn combinators
Ganesh Sittampalam <ganesh at earth.li>**20190815222641
 Ignore-this: 8a4115903f03a37582ce241b04156591
] hunk ./src/Darcs/Patch/CommuteFn.hs 7
+      flipMerger,
hunk ./src/Darcs/Patch/CommuteFn.hs 9
+      mergerFLId,
hunk ./src/Darcs/Patch/CommuteFn.hs 60
+flipMerger :: MergeFn p1 p2 -> MergeFn p2 p1
+flipMerger merger (p :\/: q) =
+  case merger (q :\/: p) of
+    p' :/\: q' -> q' :/\: p'
+
hunk ./src/Darcs/Patch/CommuteFn.hs 73
+mergerFLId :: MergeFn p1 p2 -> MergeFn (FL p1) p2
+mergerFLId merger =
+  -- not written in point-free style because of impredicativity problems
+  flipMerger (mergerIdFL (flipMerger merger))
+
hunk ./src/Darcs/Patch/Merge.hs 19
-import Darcs.Patch.CommuteFn ( MergeFn )
+import Darcs.Patch.CommuteFn ( MergeFn, mergerFLId, mergerIdFL )
hunk ./src/Darcs/Patch/Merge.hs 50
-    merge (NilFL :\/: x) = x :/\: NilFL
-    merge (x :\/: NilFL) = NilFL :/\: x
-    merge ((x:>:xs) :\/: ys) = case mergeFL (x :\/: ys) of
-      ys' :/\: x' -> case merge (ys' :\/: xs) of
-        xs' :/\: ys'' -> ys'' :/\: (x' :>: xs')
-
-mergeFL :: Merge p
-        => (p :\/: FL p) wX wY
-        -> (FL p :/\: p) wX wY
-mergeFL (p :\/: NilFL) = NilFL :/\: p
-mergeFL (p :\/: (x :>: xs)) = case merge (p :\/: x) of
-    x' :/\: p' -> case mergeFL (p' :\/: xs) of
-      xs' :/\: p'' -> (x' :>: xs') :/\: p''
+  merge = mergerFLId (mergerIdFL selfMerger)
hunk ./src/Darcs/Patch/Merge.hs 52
+mergeFL :: Merge p => MergeFn p (FL p)
+mergeFL = mergerIdFL selfMerger
+

[add merge instance for RL
Ganesh Sittampalam <ganesh at earth.li>**20190815223106
 Ignore-this: e26d047d6196eed47ca240a5e636301a
] hunk ./src/Darcs/Patch/CommuteFn.hs 10
+      mergerIdRL,
+      mergerRLId,
hunk ./src/Darcs/Patch/CommuteFn.hs 80
+mergerIdRL :: MergeFn p1 p2 -> MergeFn p1 (RL p2)
+mergerIdRL _ (p :\/: NilRL) = NilRL :/\: p
+mergerIdRL merger (p :\/: (xs :<: x))
+  = case mergerIdRL merger (p :\/: xs) of
+      xs' :/\: p' ->
+        case merger (p' :\/: x) of
+          x' :/\: p'' -> (xs' :<: x') :/\: p''
+
+mergerRLId :: MergeFn p1 p2 -> MergeFn (RL p1) p2
+mergerRLId merger =
+  -- not written in point-free style because of impredicativity problems
+  flipMerger (mergerIdRL (flipMerger merger))
+
hunk ./src/Darcs/Patch/Merge.hs 19
-import Darcs.Patch.CommuteFn ( MergeFn, mergerFLId, mergerIdFL )
+import Darcs.Patch.CommuteFn
+  ( MergeFn
+  , mergerFLId, mergerIdFL
+  , mergerRLId, mergerIdRL
+  )
hunk ./src/Darcs/Patch/Merge.hs 31
+    , RL(..)
hunk ./src/Darcs/Patch/Merge.hs 57
+instance Merge p => Merge (RL p) where
+  merge = mergerRLId (mergerIdRL selfMerger)
+

[decouple RepoPatchV3 impl from WithName
Ganesh Sittampalam <ganesh at earth.li>**20190827120929
 Ignore-this: c5a404d5a485ad8a91144a7ff2b5ab4f
 
 WithName is now abstracted behind a type class,
 PrimContainer. Almost all of the implementation in
 Darcs.Patch.V3.Core now uses this abstraction.
 
 The RepoPatchV3 type we expose from Darcs.Patch.V3
 becomes a type synonym for Core.RepoPatchV3 NamedPrim.
 
] hunk ./darcs.cabal 168
+                      Darcs.Patch.Prim.Container
addfile ./src/Darcs/Patch/Prim/Container.hs
hunk ./src/Darcs/Patch/Prim/Container.hs 1
+module Darcs.Patch.Prim.Container ( PrimContainer(..) ) where
+
+import Darcs.Patch.Apply ( Apply(ApplyState) )
+import Darcs.Patch.Commute ( Commute )
+import Darcs.Patch.CommuteNoConflicts ( CommuteNoConflicts )
+import Darcs.Patch.Prim ( PrimPatch )
+import Darcs.Patch.Format ( PatchListFormat )
+import Darcs.Patch.Read ( ReadPatch )
+import Darcs.Patch.Show ( ShowPatch, ShowContextPatch )
+import Darcs.Patch.Ident ( Ident )
+import Darcs.Patch.Invert ( Invert )
+
+import Darcs.Patch.Witnesses.Eq ( Eq2 )
+
+-- |'PrimContainer' abstracts over the concept of a primitive patch
+-- type with a notion of identity. It can be implemented either using
+-- an explicit wrapper such as 'NamedPrim', or with some type where
+-- 'PrimContents' prim ~ prim.
+class
+  ( PrimPatch (PrimContents prim)
+  , Eq2 prim, Ident prim
+  , Commute prim, CommuteNoConflicts prim
+  , Invert prim, Apply prim, ApplyState (PrimContents prim) ~ ApplyState prim
+  , ShowPatch prim, ShowContextPatch prim, PatchListFormat prim, ReadPatch prim
+  )
+  => PrimContainer prim where
+  type PrimContents prim :: * -> * -> *
+  primContents :: prim wX wY -> PrimContents prim wX wY
hunk ./src/Darcs/Patch/Prim/WithName.hs 17
+import Darcs.Patch.Prim.Container ( PrimContainer(..) )
hunk ./src/Darcs/Patch/Prim/WithName.hs 43
+instance (SignedId name, StorableId name, PrimPatch p)
+ => PrimContainer (PrimWithName name p) where
+
+  type PrimContents (PrimWithName name p) = p
+  primContents = wnPatch
+
hunk ./src/Darcs/Patch/V3.hs 7
-import Darcs.Patch.Prim.Named ( PrimPatchId )
+import Darcs.Patch.Prim.Named ( NamedPrim )
hunk ./src/Darcs/Patch/V3.hs 11
-type RepoPatchV3 = Core.RepoPatchV3 PrimPatchId
+-- |For real use cases, the primitive patch type is always
+-- 'NamedPrim' wrapping a primitive patch type without a notion
+-- of identity. As 'NamedPrim' is tied to 'PatchInfo', the separation
+-- from 'Core.RepoPatchV3' allows for simpler types to be used
+-- for testing and experimentation.
+type RepoPatchV3 prim = Core.RepoPatchV3 (NamedPrim prim)
hunk ./src/Darcs/Patch/V3/Core.hs 39
+import Darcs.Patch.Prim.Container
hunk ./src/Darcs/Patch/V3/Core.hs 41
-import Darcs.Patch.Prim.WithName
hunk ./src/Darcs/Patch/V3/Core.hs 58
-data RepoPatchV3 name prim wX wY where
-  Prim :: PrimWithName name prim wX wY -> RepoPatchV3 name prim wX wY
-  Conflictor :: FL (PrimWithName name prim) wX wY             -- ^ effect
-             -> S.Set (Contexted (PrimWithName name prim) wY) -- ^ conflicts
-             -> Contexted (PrimWithName name prim) wY         -- ^ identity
-             -> RepoPatchV3 name prim wX wY
+-- |V3 patches. The underlying primitive patch type is
+-- required to have some notion of identity.
+data RepoPatchV3 prim wX wY where
+  Prim :: prim wX wY -> RepoPatchV3 prim wX wY
+  Conflictor :: FL prim wX wY             -- ^ effect
+             -> S.Set (Contexted prim wY) -- ^ conflicts
+             -> Contexted prim wY         -- ^ identity
+             -> RepoPatchV3 prim wX wY
hunk ./src/Darcs/Patch/V3/Core.hs 71
-  Rotcilfnoc :: FL (PrimWithName name prim) wX wY             -- ^ effect
-             -> S.Set (Contexted (PrimWithName name prim) wY) -- ^ conflicts
-             -> Contexted (PrimWithName name prim) wY         -- ^ identity
-             -> RepoPatchV3 name prim wY wX
-
-pattern PrimP :: TestOnly => NamedPrim prim wX wY -> RepoPatchV3 PrimPatchId prim wX wY
+  Rotcilfnoc :: FL prim wX wY             -- ^ effect
+             -> S.Set (Contexted prim wY) -- ^ conflicts
+             -> Contexted prim wY         -- ^ identity
+             -> RepoPatchV3 prim wY wX
+
+pattern PrimP :: TestOnly => NamedPrim prim wX wY -> RepoPatchV3 (NamedPrim prim) wX wY
hunk ./src/Darcs/Patch/V3/Core.hs 84
-  -> RepoPatchV3 PrimPatchId prim wX wY
+  -> RepoPatchV3 (NamedPrim prim) wX wY
hunk ./src/Darcs/Patch/V3/Core.hs 89
-instance (Invert prim, PrimCanonize prim) => Effect (RepoPatchV3 name prim) where
-  effect (Prim p) = wnPatch p :>: NilFL
-  effect (Conflictor r _ _) = mapFL_FL wnPatch r
-  effect (Rotcilfnoc r _ _) = invert (mapFL_FL wnPatch r)
+instance PrimContainer prim => Effect (RepoPatchV3 prim) where
+  effect (Prim p) = primContents p :>: NilFL
+  effect (Conflictor r _ _) = mapFL_FL primContents r
+  effect (Rotcilfnoc r _ _) = mapFL_FL primContents (invert r)
hunk ./src/Darcs/Patch/V3/Core.hs 101
-type instance PatchId (RepoPatchV3 name prim) = name
-
-instance (Eq2 prim, Commute prim, SignedId name) => Ident (RepoPatchV3 name prim) where
+type instance PatchId (RepoPatchV3 prim) = PatchId prim
+
+instance Ident prim => Ident (RepoPatchV3 prim) where
hunk ./src/Darcs/Patch/V3/Core.hs 110
-instance (Invert prim, SignedId name) => Invert (RepoPatchV3 name prim) where
+instance (Invert prim) => Invert (RepoPatchV3 prim) where
hunk ./src/Darcs/Patch/V3/Core.hs 117
-instance (SignedId name, StorableId name, PrimPatch prim) => Merge (RepoPatchV3 name prim) where
+instance PrimContainer prim => Merge (RepoPatchV3 prim) where
hunk ./src/Darcs/Patch/V3/Core.hs 174
-instance (SignedId name, StorableId name, PrimPatch prim)
-  => CommuteNoConflicts (RepoPatchV3 name prim) where
-
+instance PrimContainer prim => CommuteNoConflicts (RepoPatchV3 prim) where
hunk ./src/Darcs/Patch/V3/Core.hs 249
-  :: (SignedId name, StorableId name, PrimPatch prim)
-  => CommuteFn (RepoPatchV3 name prim) (RepoPatchV3 name prim)
+  :: PrimContainer prim
+  => CommuteFn (RepoPatchV3 prim) (RepoPatchV3 prim)
hunk ./src/Darcs/Patch/V3/Core.hs 312
-instance (SignedId name, StorableId name, PrimPatch prim) => Commute (RepoPatchV3 name prim) where
+instance PrimContainer prim => Commute (RepoPatchV3 prim) where
hunk ./src/Darcs/Patch/V3/Core.hs 325
-instance PatchInspect prim => PatchInspect (RepoPatchV3 name prim) where
+instance PatchInspect prim => PatchInspect (RepoPatchV3 prim) where
hunk ./src/Darcs/Patch/V3/Core.hs 337
-instance (SignedId name, Eq2 prim, Commute prim) => Eq2 (RepoPatchV3 name prim) where
+instance (Eq2 prim, Commute prim, Ident prim) => Eq2 (RepoPatchV3 prim) where
hunk ./src/Darcs/Patch/V3/Core.hs 349
-instance (Show name, Show2 prim) => Show (RepoPatchV3 name prim wX wY) where
+instance Show2 prim => Show (RepoPatchV3 prim wX wY) where
hunk ./src/Darcs/Patch/V3/Core.hs 362
-instance (Show name, Show2 prim) => Show1 (RepoPatchV3 name prim wX) where
+instance Show2 prim => Show1 (RepoPatchV3 prim wX) where
hunk ./src/Darcs/Patch/V3/Core.hs 365
-instance (Show name, Show2 prim) => Show2 (RepoPatchV3 name prim) where
+instance Show2 prim => Show2 (RepoPatchV3 prim) where
hunk ./src/Darcs/Patch/V3/Core.hs 368
-instance PrimPatch prim => PrimPatchBase (RepoPatchV3 name prim) where
-  type PrimOf (RepoPatchV3 name prim) = prim
-
-instance PatchDebug prim => PatchDebug (RepoPatchV3 name prim)
-
--- This instance is specialised to PrimPatchId because it is dependent
--- on the relationship between PatchInfo and PrimPatchId
-instance FromPrim (RepoPatchV3 PrimPatchId prim) where
+instance PrimContainer prim => PrimPatchBase (RepoPatchV3 prim) where
+  type PrimOf (RepoPatchV3 prim) = PrimContents prim
+
+instance PatchDebug prim => PatchDebug (RepoPatchV3 prim)
+
+-- generalising this for all 'RepoPatchV3' would require 'PrimContainer'
+-- to get a notion of construction as well as querying, as well as
+-- decoupling FromPrim from PatchInfo
+instance FromPrim (RepoPatchV3 (NamedPrim prim)) where
hunk ./src/Darcs/Patch/V3/Core.hs 381
-      go :: [PrimPatchId] -> FL prim wX wY -> FL (RepoPatchV3 PrimPatchId prim) wX wY
+      go :: [PrimPatchId] -> FL prim wX wY -> FL (RepoPatchV3 (NamedPrim prim)) wX wY
hunk ./src/Darcs/Patch/V3/Core.hs 386
-instance PrimPatch prim => Apply (RepoPatchV3 name prim) where
-  type ApplyState (RepoPatchV3 name prim) = ApplyState prim
+instance PrimContainer prim => Apply (RepoPatchV3 prim) where
+  type ApplyState (RepoPatchV3 prim) = ApplyState prim
hunk ./src/Darcs/Patch/V3/Core.hs 390
-instance PatchListFormat (RepoPatchV3 name prim) where
+instance PatchListFormat (RepoPatchV3 prim) where
hunk ./src/Darcs/Patch/V3/Core.hs 393
-instance (PrimPatch prim, Annotate prim) => Annotate (RepoPatchV3 name prim) where
+-- not generalised to all 'RepoPatchV3' for now as the obvious constraint
+-- change to Annotate (PatchContents Prim) requires UndecidableInstances,
+-- and Annotate is tied to PatchInfo anyway
+instance (PrimPatch prim, Annotate prim) => Annotate (RepoPatchV3 (NamedPrim prim)) where
hunk ./src/Darcs/Patch/V3/Core.hs 399
-instance IsHunk prim => IsHunk (RepoPatchV3 name prim) where
+instance IsHunk prim => IsHunk (RepoPatchV3 prim) where
hunk ./src/Darcs/Patch/V3/Core.hs 404
-instance PrimPatch prim => Summary (RepoPatchV3 name prim) where
-  conflictedEffect (Conflictor _ _ (ctxView -> Sealed (_ :> x))) = [IsC Conflicted (wnPatch x)]
-  conflictedEffect (Rotcilfnoc _ _ (ctxView -> Sealed (_ :> x))) = [IsC Conflicted (wnPatch x)]
-  conflictedEffect (Prim x) = [IsC Okay (wnPatch x)]
+instance PrimContainer prim => Summary (RepoPatchV3 prim) where
+  conflictedEffect (Conflictor _ _ (ctxView -> Sealed (_ :> x))) = [IsC Conflicted (primContents x)]
+  conflictedEffect (Rotcilfnoc _ _ (ctxView -> Sealed (_ :> x))) = [IsC Conflicted (primContents x)]
+  conflictedEffect (Prim x) = [IsC Okay (primContents x)]
hunk ./src/Darcs/Patch/V3/Core.hs 449
-instance (SignedId name, StorableId name, PrimPatch prim)
-  => Conflict (RepoPatchV3 name prim) where
-
+instance PrimContainer prim => Conflict (RepoPatchV3 prim) where
hunk ./src/Darcs/Patch/V3/Core.hs 453
-      resolveComponents :: [Node name prim wX] -> [ConflictDetails prim wX]
+      resolveComponents :: [Node prim wX] -> [ConflictDetails (PrimContents prim) wX]
hunk ./src/Darcs/Patch/V3/Core.hs 455
-      mergeThem :: [Contexted (PrimWithName name prim) wX] -> Sealed (FL prim wX)
-      mergeThem = mapSeal (mapFL_FL wnPatch) . mergeList . map ctxToFL
+      mergeThem :: [Contexted prim wX] -> Sealed (FL (PrimContents prim) wX)
+      mergeThem = mapSeal (mapFL_FL primContents) . mergeList . map ctxToFL
hunk ./src/Darcs/Patch/V3/Core.hs 460
-data Node name prim wY = Node
-  { self :: Contexted (PrimWithName name prim) wY
-  , neighbors :: S.Set (Contexted (PrimWithName name prim) wY)
+data Node prim wY = Node
+  { self :: Contexted prim wY
+  , neighbors :: S.Set (Contexted prim wY)
hunk ./src/Darcs/Patch/V3/Core.hs 465
-deriving instance (Show name, Show2 prim) => Show (Node name prim wY)
+deriving instance Show2 prim => Show (Node prim wY)
hunk ./src/Darcs/Patch/V3/Core.hs 510
-findVertices
-  :: forall name prim wO wX wY
-   . (SignedId name, StorableId name, PrimPatch prim)
-  => RL (RepoPatchV3 name prim) wO wX
-  -> RL (RepoPatchV3 name prim) wX wY
-  -> [Contexted (PrimWithName name prim) wY]
+findVertices :: forall prim wO wX wY. PrimContainer prim
+             => RL (RepoPatchV3 prim) wO wX
+             -> RL (RepoPatchV3 prim) wX wY
+             -> [Contexted prim wY]
hunk ./src/Darcs/Patch/V3/Core.hs 515
-  go :: S.Set name
-     -> [Contexted (PrimWithName name prim) wY]
-     -> RL (RepoPatchV3 name prim) wO wA
-     -> RL (RepoPatchV3 name prim) wA wB
-     -> FL (RepoPatchV3 name prim) wB wY
-     -> [Contexted (PrimWithName name prim) wY]
+  go :: S.Set (PatchId prim)
+     -> [Contexted prim wY]
+     -> RL (RepoPatchV3 prim) wO wA
+     -> RL (RepoPatchV3 prim) wA wB
+     -> FL (RepoPatchV3 prim) wB wY
+     -> [Contexted prim wY]
hunk ./src/Darcs/Patch/V3/Core.hs 551
-conflictsWith
-  :: (SignedId name, PrimPatch prim)
-  => Contexted (PrimWithName name prim) wX
-  -> Contexted (PrimWithName name prim) wX
-  -> Bool
+conflictsWith :: PrimContainer prim
+              => Contexted prim wX
+              -> Contexted prim wX
+              -> Bool
hunk ./src/Darcs/Patch/V3/Core.hs 563
-findEdges
-  :: (SignedId name, PrimPatch prim)
-  => [Contexted (PrimWithName name prim) wY] -> [Node name prim wY]
+findEdges :: PrimContainer prim
+          => [Contexted prim wY] -> [Node prim wY]
hunk ./src/Darcs/Patch/V3/Core.hs 580
-alternatives
-  :: (SignedId name, Eq2 prim)
-  => [Node name prim wX]
-  -> [[[Contexted (PrimWithName name prim) wX]]]
+alternatives :: (Eq2 prim, Ident prim) => [Node prim wX] -> [[[Contexted prim wX]]]
hunk ./src/Darcs/Patch/V3/Core.hs 598
-mergeList
-  :: (SignedId name, StorableId name, PrimPatch p)
-  => [Sealed (FL (PrimWithName name p) wX)] -> Sealed (FL (PrimWithName name p) wX)
+mergeList :: PrimContainer prim
+          => [Sealed (FL prim wX)] -> Sealed (FL prim wX)
hunk ./src/Darcs/Patch/V3/Core.hs 616
-instance PrimPatch prim => Check (RepoPatchV3 name prim)
+instance PrimContainer prim => Check (RepoPatchV3 prim)
hunk ./src/Darcs/Patch/V3/Core.hs 619
-instance PrimPatch prim => RepairToFL (RepoPatchV3 name prim)
+instance PrimContainer prim => RepairToFL (RepoPatchV3 prim)
hunk ./src/Darcs/Patch/V3/Core.hs 622
-instance (SignedId name, StorableId name, PrimPatch prim)
-  => ShowPatch (RepoPatchV3 name prim) where
-
+instance PrimContainer prim => ShowPatch (RepoPatchV3 prim) where
hunk ./src/Darcs/Patch/V3/Core.hs 627
-instance (SignedId name, StorableId name, PrimPatch prim)
-  => ShowContextPatch (RepoPatchV3 name prim) where
-
+instance PrimContainer prim => ShowContextPatch (RepoPatchV3 prim) where
hunk ./src/Darcs/Patch/V3/Core.hs 633
-instance (SignedId name, StorableId name, PrimPatch prim)
-  => ReadPatch (RepoPatchV3 name prim) where
-
+instance PrimContainer prim => ReadPatch (RepoPatchV3 prim) where
hunk ./src/Darcs/Patch/V3/Core.hs 655
-instance (SignedId name, StorableId name, PrimPatch prim)
-  => ShowPatchBasic (RepoPatchV3 name prim) where
-
+instance PrimContainer prim => ShowPatchBasic (RepoPatchV3 prim) where

[WIP: example
Ganesh Sittampalam <ganesh at earth.li>**20190827120936
 Ignore-this: f44e1d7d85a7e22218be066f2eb84e84
] hunk ./darcs.cabal 169
+                      Darcs.Patch.Prim.Examples
addfile ./src/Darcs/Patch/Prim/Examples.hs
hunk ./src/Darcs/Patch/Prim/Examples.hs 1
-
+{-# OPTIONS_GHC -Wno-missing-methods -Wno-missing-signatures #-}
+{-# LANGUAGE EmptyDataDecls, ViewPatterns #-}
+module Darcs.Patch.Prim.Examples
+  ( module Darcs.Patch.Prim.Examples
+  , module Darcs.Util.Printer
+  ) where
+
+import Darcs.Patch.Apply
+import Darcs.Patch.Commute
+import Darcs.Patch.Merge
+import Darcs.Patch.CommuteNoConflicts
+import Darcs.Patch.CommuteFn
+import Darcs.Patch.Ident
+import Darcs.Patch.Inspect
+import Darcs.Patch.Invert
+import Darcs.Patch.FileHunk
+import Darcs.Patch.Repair
+import Darcs.Patch.Format
+import Darcs.Patch.Prim.Container
+import Darcs.Patch.Read
+import Darcs.Patch.Show
+import Darcs.Patch.Prim.Class
+import Darcs.Patch.Set
+
+import Darcs.Patch.Witnesses.Eq
+import Darcs.Patch.Witnesses.Ordered
+import Darcs.Patch.Witnesses.Sealed
+import Darcs.Patch.Witnesses.Show
+
+import Darcs.Patch.V3.Core
+import Darcs.Patch.V3.Contexted
+
+import Darcs.Util.Printer ( putDocLn, text )
+
+import Control.Exception
+import Data.Functor.Compose
+import Data.List
+import Data.Maybe
+import Data.Set ( Set )
+import qualified Data.Set as Set
+
+data PrimCore = Q | R | S | T | U | V
+  deriving (Show, Eq, Ord)
+
+dependencies :: [(PrimCore, PrimCore)]
+dependencies = []
+
+conflicts :: [(PrimCore, PrimCore)]
+conflicts = map sortPair
+  [(S, V), (S, T), (S, U), (R, T)]
+
+data Prim wX wY = Fwd PrimCore | Rev PrimCore
+  deriving (Show, Eq)
+
+instance Show1 (Prim wX) where
+  showDict1 = ShowDictClass
+
+instance Show2 Prim where
+  showDict2 = ShowDictClass
+
+data Id = Plus PrimCore | Minus PrimCore
+  deriving (Show, Eq, Ord)
+
+instance Invert Prim where
+  invert (Fwd p) = Rev p
+  invert (Rev p) = Fwd p
+
+type P3 = RepoPatchV3 Prim
+
+pr :: PrimCore -> FreeLeft (RL P3)
+pr n = freeGap (NilRL :<: Prim (Fwd n))
+
+rSTU :: FreeLeft (RL P3)
+rSTU = pr S <+> pr T <+> pr U
+
+rRSTU :: FreeLeft (RL P3)
+rRSTU = pr S <+> pr T <+> pr R <+> pr U
+
+rSTUV :: FreeLeft (RL P3)
+rSTUV = rSTU <.> pr V
+
+rRSTUV :: FreeLeft (RL P3)
+rRSTUV = rRSTU <.> pr V
+
+rSTUValt :: FreeLeft (RL P3)
+rSTUValt = rSTU <+> pr V
+
+rRSTUValt :: FreeLeft (RL P3)
+rRSTUValt = rRSTU <+> pr V
+
+allRepos :: [PrimCore] -> [FreeLeft (RL P3)]
+allRepos [] = [emptyGap NilRL]
+allRepos names = do
+  name <- names
+  repo <- allRepos (names \\ [name])
+  [repo <+> pr name, repo <.> pr name]
+
+data Minimised = Minimised PrimCore RepoContextCore
+  deriving (Eq, Ord)
+
+showMinimised (Minimised x (RepoContextCore a r)) = showRC (RepoContext a r) ++ show x
+
+mkMinimised :: (RL P3 :> P3) Origin wA -> Minimised
+mkMinimised (ps :> p) =
+  case minimise (ps :> (p :>: NilFL)) of
+    Sealed qs -> unseal2 toMinimised $ last $ mapFL Sealed2 $ toWC qs
+ where toMinimised (WC (RepoContext a r) (Prim (Fwd x))) = Minimised x (RepoContextCore a r)
+       toMinimised (WC _ (Prim (Rev _))) = error "minimising a rev patch"
+       toMinimised (WC _ _) = error "minimising left a conflictor"
+
+fullMinimals :: RL P3 Origin wA -> [Minimised]
+fullMinimals NilRL = []
+fullMinimals (ps :<: p) = mkMinimised (ps :> p) : fullMinimals ps
+
+showWithFullMin :: PrimCore -> FreeLeft (RL P3) -> IO (Maybe String)
+showWithFullMin name fl = handle (\(_ :: ErrorCall) -> return Nothing) $ do
+  Sealed ps <- return $ unFreeLeft fl
+  Sealed (pContext :> p) <- return $ findP name ps
+  let ms = sort $ fullMinimals ps
+  let
+    showRes :: FL P3 Origin wB -> String
+    showRes = unseal2 showWC . last . mapFL Sealed2 . toWC
+  let full = reverseRL $ pContext :<: p
+  let str = intercalate " " (map showMinimised ms) ++ ": " ++ showRes full
+  length str `seq` return (Just (intercalate " " (map showMinimised ms) ++ ": " ++ showRes full))
+
+enumerateFull :: [PrimCore] -> PrimCore -> IO ()
+enumerateFull names name = do
+  items <- sort . nub . catMaybes <$> mapM (showWithFullMin name) (allRepos (name:names))
+  mapM_ putStrLn items
+
+showWithMin :: PrimCore -> FreeLeft (RL P3) -> IO (Maybe String)
+showWithMin name fl = handle (\(_ :: ErrorCall) -> return Nothing) $ do
+  Sealed (pContext :> p) <- return $ unseal (findP name) (unFreeLeft fl)
+  Sealed pMinFL <- return $ minimise (pContext :> (p :>: NilFL))
+  let
+    showRes :: FL P3 Origin wB -> String
+    showRes = unseal2 showWC . last . mapFL Sealed2 . toWC
+  let full = reverseRL $ pContext :<: p
+  return $ Just $ showRes pMinFL ++ " <- " ++ showRes full
+
+enumerate :: [PrimCore] -> PrimCore -> IO ()
+enumerate names name = do
+  items <- sort . nub . catMaybes <$> mapM (showWithMin name) (allRepos (name:names))
+  mapM_ putStrLn items
+
+findP :: PrimCore -> RL P3 wA wB -> Sealed ((RL P3 :> P3) wA)
+findP p NilRL = error $ "patch " ++ show p ++ " not found in input"
+findP p (xs :<: x) | ident x == Plus p = Sealed (xs :> x)
+findP p (xs :<: _) = findP p xs
+
+(<+>) :: FreeLeft (RL P3) -> FreeLeft (RL P3) -> FreeLeft (RL P3)
+p <+> q =
+  FLInternal (Poly (Compose (
+   case (unFreeLeft p, unFreeLeft q) of
+    (Sealed p', Sealed q') ->
+      case merge (p' :\/: q') of
+        q'' :/\: _ -> Sealed (p' +<+ q'')
+  )))
+
+(<.>) :: FreeLeft (RL P3) -> FreeLeft (RL P3) -> FreeLeft (RL P3)
+(<.>) = joinGap (+<+)
+
+infixl 4 <.>
+infixl 4 <+>
+
+data RepoContextCore =
+  RepoContextCore
+  { rccActive :: Set PrimCore
+  , rccReverted :: Set PrimCore
+  }
+  deriving (Eq, Ord)
+
+data RepoContext wA =
+  RepoContext
+  { active :: Set PrimCore
+  , reverted :: Set PrimCore
+  }
+  deriving (Eq, Ord)
+
+showRC :: RepoContext wA -> String
+showRC (RepoContext a r) =
+ "<" ++ intercalate "," (map show (Set.toList a)) ++ "|" ++ intercalate "," (map show (Set.toList r)) ++ ">"
+
+emptyRC :: RepoContext Origin
+emptyRC = RepoContext Set.empty Set.empty
+
+updateRC :: P3 wA wB -> RepoContext wA -> RepoContext wB
+updateRC (Prim (Fwd p)) rc = rc { active = Set.insert p (active rc) }
+updateRC (Conflictor eff _ (ctxView -> Sealed (_ :> Fwd p))) rc =
+  rc
+   { active = active rc Set.\\ idsOf eff
+   , reverted = p `Set.insert` reverted rc `Set.union` idsOf eff
+   }
+  where
+   idsOf :: FL Prim wX wY -> Set PrimCore
+   idsOf NilFL = Set.empty
+   idsOf (Rev e :>: ps) = Set.insert e (idsOf ps)
+   idsOf _ = error "updateRC.idsOf: impossible"
+updateRC _ _ = error "updateRC: impossible"
+
+printWithMin :: FreeLeft (RL P3) -> IO ()
+printWithMin repo =
+  case unFreeLeft repo of
+    Sealed r -> putStrLn $ showPs r ++ "\n==>\n" ++ showPsMin r
+
+data WC p wA wB = WC (RepoContext wA) (p wA wB)
+
+mapWC :: (p wA wB -> q wA wB) -> WC p wA wB -> WC q wA wB
+mapWC f (WC c p) = WC c (f p)
+
+toWC :: FL P3 Origin wX -> FL (WC P3) Origin wX
+toWC ps = go emptyRC ps
+  where
+    go :: RepoContext wA -> FL P3 wA wB -> FL (WC P3) wA wB
+    go _ NilFL = NilFL
+    go rc (q :>: qs) = WC rc q :>: go (updateRC q rc) qs
+
+showWC :: WC P3 wA wB -> String
+showWC (WC c p) = showRC c ++ " " ++ showP p
+
+showPs :: RL P3 Origin wB -> String
+showPs = intercalate " " . mapFL showWC . toWC . reverseRL
+
+showPsMin :: RL P3 Origin wB -> String
+showPsMin = unseal (showPs . reverseFL) . minimise . splitLast
+
+showPr :: Prim wA wB -> String
+showPr (Fwd v) = show v
+showPr (Rev v) = show v ++ "^"
+
+showP :: P3 wA wB -> String
+showP (Prim p) = "[" ++ showPr p ++ "]"
+showP (Rotcilfnoc {}) = error "TODO: showP Rotcilfnoc"
+showP (Conflictor eff conf p) =
+  "[" ++
+  intercalate ";" (mapFL showPr eff) ++
+  ", {" ++
+  intercalate "," (map showC (Set.toList conf)) ++
+  "}, " ++
+  showC p ++
+  "]"
+
+showC :: Contexted Prim wA -> String
+showC (ctxView -> (Sealed (_ :> p))) = showPr p
+
+minimise :: (RL P3 :> FL P3) wA wB -> Sealed (FL P3 wA)
+minimise (NilRL :> rest) = Sealed rest
+minimise ((ps :<: p) :> rest) =
+  case commuterIdFL selfCommuter (p :> rest) of
+    Nothing -> minimise (ps :> (p :>: rest))
+    Just (rest' :> _) -> minimise (ps :> rest')
+
+splitLast :: RL p wA wB -> (RL p :> FL p) wA wB
+splitLast (ps :<: p) = ps :> p :>: NilFL
+splitLast NilRL = NilRL :> NilFL
+
+mergeRepos :: Merge p
+          => [Sealed (RL p wX)]
+          -> Sealed (RL p wX)
+mergeRepos = foldr mergeTwo (Sealed NilRL)
+  where
+    mergeTwo (Sealed ps) (Sealed qs) =
+      case merge (ps :\/: qs) of
+        (qs' :/\: _) -> Sealed $ ps +<+ qs'
+
+b `dependsOn` a = (a, b) `elem` dependencies
+a `conflictsWith` b = sortPair (a, b) `elem` conflicts
+
+sortPair (a, b)
+  | a <= b = (a, b)
+  | otherwise = (b, a)
+
+type instance PatchId Prim = Id
+
+instance SignedId Id where
+  invertId (Plus p) = Minus p
+  invertId (Minus p) = Plus p
+
+instance Ident Prim where
+  ident (Fwd p) = Plus p
+  ident (Rev p) = Minus p
+
+instance PrimContainer Prim where
+  type PrimContents Prim = Prim
+
+data State (m :: * -> *) = State
+
+instance Apply Prim where
+  type ApplyState Prim = State
+  apply _ = return ()
+
+instance PrimPatch Prim
+
+instance Commute Prim where
+  commute (Fwd a :> Fwd b)
+   | a == b = error $ "impossible self-commute: Fwd " ++ show a
+   | a `conflictsWith` b = error $ "commute of conflicting patches: Fwd " ++ show (a, b)
+   | b `dependsOn` a = Nothing
+   | otherwise = Just (Fwd b :> Fwd a)
+  commute (Rev b :> Rev a)
+   | a == b = error $ "impossible self-commute: Rev " ++ show a
+   | a `conflictsWith` b = error $ "commute of conflicting patches: Rev " ++ show (b, a)
+   | b `dependsOn` a = Nothing
+   | otherwise = Just (Rev a :> Rev b)
+
+  commute (Fwd a :> Rev b)
+   | a == b = Nothing
+   | a `conflictsWith` b = Nothing
+   | otherwise = Just (Rev b :> Fwd a)
+  commute (Rev b :> Fwd a)
+   | a == b = error $ "impossible inverted-self-commute: Rev/Fwd " ++ show a
+   | a `conflictsWith` b = Nothing
+   | otherwise = Just (Fwd a :> Rev b)
+
+instance CommuteNoConflicts Prim where
+  commuteNoConflicts = commute
+
+instance Eq2 Prim where
+  unsafeCompare (Fwd x) (Fwd y) = x == y
+  unsafeCompare (Rev x) (Rev y) = x == y
+  unsafeCompare _ _ = False
+
+instance IsHunk Prim where
+  isHunk _ = Nothing
+
+instance PatchInspect Prim where
+
+instance RepairToFL Prim where
+
+instance PrimCanonize Prim where
+instance PrimClassify Prim where
+instance PrimConstruct Prim where
+instance PrimDetails Prim where
+instance PrimApply Prim where
+instance PrimSift Prim where
+instance PatchListFormat Prim
+
+instance PrimMangleUnravelled Prim
+
+instance ReadPatch Prim where
+instance ShowPatchBasic Prim where
+  showPatch _ (Fwd a) = text (show a)
+  showPatch _ (Rev a) = text (show a++"^")
+instance ShowPatch Prim where
+instance ShowContextPatch Prim where
+
hunk ./src/Darcs/Patch/V3/Core.hs 12
-module Darcs.Patch.V3.Core ( RepoPatchV3, pattern PrimP, pattern ConflictorP ) where
+module Darcs.Patch.V3.Core
+  ( RepoPatchV3(..), pattern PrimP, pattern ConflictorP
+  ) where
hunk ./src/Darcs/Patch/Witnesses/Sealed.hs 40
-    , FreeLeft
+    , FreeLeft(..), Poly(..)
hunk ./src/Darcs/Patch/Witnesses/Sealed.hs 42
-    , FreeRight
+    , FreeRight(..)

Context:

[introduce PrimWithName and make NamedPrim a type synonym
Ganesh Sittampalam <ganesh at earth.li>**20190827114448
 Ignore-this: 934632425eaa3bc82e5769dbee7549a9
] 
[Refactor the commute implementation for NamedPrims
Ganesh Sittampalam <ganesh at earth.li>**20190827113620
 Ignore-this: b1aabe8d5b3340a8a65a636460710dd8
 
 It now just relies on the Ident class instead of the internals.
 This also distinguishes a case that ought to be an internal error,
 but the unit tests seem to rely on it, so this is left as a
 TODO for now.
] 
[use Darcs.Util.Graph.components for RepoPatchV3
Ben Franksen <ben.franksen at online.de>**20190825211920
 Ignore-this: a6991e94f26b09f302c3a51ea09171f8fa09c9c73caa3f701f752f00c76c8274761a2dd0bdbe3d86
 
 This required a few refactors and the introduction of a new data type for
 components. In particular, the ltmis algorithm needs to be adapted to
 working with just a subset of the vertices of a graph.
] 
[move functions to generate graphs from harness to library
Ben Franksen <ben.franksen at online.de>**20190825162321
 Ignore-this: b31586463112c753be6a0112b555f7b7f848cc5c39470ede7701a94f2268d021c1000a45e0b093a5
] 
[simplify and improve Darcs.Util.Graph.components
Ben Franksen <ben.franksen at online.de>**20190825162606
 Ignore-this: ed2245de76947994d2a937643fb3d6c406968d7c31f779733504ed605eb15302c6dc1a3703427567
 
 It wasn't incorrect (according to the spec) but it did not always return
 vertices ordered and also did a bit too much work.
] 
[add Darcs.Util.Graph.components with properties and tests
Ben Franksen <ben.franksen at online.de>**20190825123434
 Ignore-this: 3d7e63f134e3528d7d1d64973bc32fb8bbd6d5ba174423d72cd2bc34e02251119394633179e0fa59
] 
[remove Darcs.Util.Graph.bk and some minor refactors
Ben Franksen <ben.franksen at online.de>**20190825123225
 Ignore-this: b3e8e66874b3692e2f417ba3c877d9573b6fc8b39507b1d28aacd80a087cd35705c524039ac64731
] 
[replace quickcheck with leancheck for testing Graph properties
Ben Franksen <ben.franksen at online.de>**20190825133104
 Ignore-this: 6ef50b2fd5c131b28df5584f650b525b1e8ed1c5af17dc0a6c0ff4ecfb11022c3286e182fc8fffcd
 
 Calculating graph properties scales very badly because the specifications
 aren't optimised (naturally). Exhaustive testing with leancheck is a lot
 more effective here because we avoid testing with (too) large graphs.
 Unfortunately test-framework is a bit limited in that it doesn't allow to
 scale the number of tests, just to set them to a fixed value. We opt to
 set it to 0x8000 which covers all graphs up to size 6.
] 
[Darcs.Util.Graph: add properties and test them
Ben Franksen <ben.franksen at online.de>**20190821104132
 Ignore-this: 51c2f7127ec6bf9366b0afc8a5aee83e602505c16a12d9d69623369cff58365cccef73d31b3bd3b5
] 
[Darcs.Util.Graph: add hadocks
Ben Franksen <ben.franksen at online.de>**20190821084048
 Ignore-this: 7b7931bdd919da44e34ae60340f446783e1b5343dfe3aeca2b241d4b1ee25c7e514c35907bdc60ca
] 
[Darcs.Util.Graph: make helper functions local to ltmis
Ben Franksen <ben.franksen at online.de>**20190821083917
 Ignore-this: 7869236b4f6e283050b2195f54c2465091194278a9b32f210de5c6cb24b2a2f11b1f8b2a402084c6
] 
[pass a PrimCanonize dictionary explicitly when needed
Ganesh Sittampalam <ganesh at earth.li>**20190812142441
 Ignore-this: 377a198414a29a79b2fee197920a5cab
 
 This allows us to get rid of the dummy instance for
 PrimCanonize (NamedPrim prim)
 
] 
[use new TestablePrim alias in the harness instead of PrimPatch
Ganesh Sittampalam <ganesh at earth.li>**20190812141315
 Ignore-this: c9ab451d95db338f8e9ff6c3a57364ef
 
 This allows the removal of a bunch of dummy instances for NamedPrim
 
] 
[improve doc comments for Rotcilfnoc
Ganesh Sittampalam <ganesh at earth.li>**20190811165258
 Ignore-this: 35c95b9e7ce666ebe2d48ac6736775d
] 
[replace some undefineds with TypeApplications
Ganesh Sittampalam <ganesh at earth.li>**20190812134126
 Ignore-this: 67ab11c1b41ff8ffca3027493ebc923b
] 
[replace commenting out with if False in qc_V1P1
Ganesh Sittampalam <ganesh at earth.li>**20190812133057
 Ignore-this: 807001bd1d8c8d8ddce51135e7d598a1
 
 Predictably the code had rotted a bit, but it looks like
 from history that commute_properties is now pair_properties
] 
[add V3INTEGRATION comments about the NamedPrim representation
Ganesh Sittampalam <ganesh at earth.li>**20190809153535
 Ignore-this: 2312bd732fdc7a1e6868dfc732c8fb45
] 
[use the old test case generator for most RepoPatchV2 properties
Ben Franksen <ben.franksen at online.de>**20190801211751
 Ignore-this: 1078a32e6e47edba95e4595ebe3db99f76c4203ef2a74c9e9360d7cf9393b8165622ddfd26f3b6da
 
 With the new test case generator many properties fail for RepoPatchV2, so we
 go back to the simpler generator that does not record patches after
 conflicts. This required re-adding merge_properties and also adds
 triple_properties (for permutivity). While we're at it, also test the
 triple_properties for prim patches.
] 
[harness: simplify type signatures and superclass constraints
Ben Franksen <ben.franksen at online.de>**20190717152157
 Ignore-this: 8bc80efd13a66a248f82571add8a91d8828340395f600dc0e2a09a148aca34706ad93a05eb410a39
] 
[harness: add propConsistentReorderings and test it
Ben Franksen <ben.franksen at online.de>**20190717152018
 Ignore-this: 5320df5208bfb482142ecc6768dcecce8c5c756c86e1caa4e3d2a6fb0b06890cf78a904d617bbaf2
 
 This property is similar to propConsistentTreeFlattenings but takes an RL
 RepoPatch and a start state as input. This allows us to test it more
 thoroughly by using the new test case generator for RL RepoPatch.
] 
[harness: simplify constraints in D.T.Patch
Ben Franksen <ben.franksen at online.de>**20190716174132
 Ignore-this: b974317bad52331d8edb4091e4ed727f5b52092f04c6a114a5f62338a1f91d04c24c64b781975f5c
] 
[use TestOnly for the constructors of RepoPatchV3
Ganesh Sittampalam <ganesh at earth.li>**20190809182248
 Ignore-this: 6a51e1baadcad20103eb191863197b7d
] 
[add 2 TODO items with V3INTEGRATION tag to Darcs.Util.Graph
Ben Franksen <ben.franksen at online.de>**20190716172454
 Ignore-this: 42a7aa4a7aa59224b09211911858c52ebbf9ff7035c39156d2e19367f3880519763b9663c8399fcc
] 
[clean up imports in two modules
Ben Franksen <ben.franksen at online.de>**20190714114534
 Ignore-this: c6baa1d94e49f44c563741c974ccdc42e98148c7641ee3c3c4cd4c7f4db10ffa3983acb9c19a03fc
] 
[change the return type of mangleUnravelled
Ben Franksen <ben.franksen at online.de>**20190712194311
 Ignore-this: 7c8143c71ca601b1e32ccce142fd40fabf99e268c3fd8063212ff1b63a60bf1bdff7a426fd698698
 
 This makes it clear that mangleUnravelled is unable to deal with conflicts
 involving anything other than hunks. Previously we returned the unmodified
 head of the input list if that was the case, now we return Nothing.
] 
[add an explicit type for the output of resolveConflicts
Ben Franksen <ben.franksen at online.de>**20190712194303
 Ignore-this: b595de1e35192407f2a162f8a3e525fb19bc9bf15527bbcd999589260929c0729d54e05762014db3
 
 This makes it clear that the output contains first the
 'mangled' view followed by all the conflicting parts.
 Currently the mangled view is the conflict markers if
 the conflict is all hunks, and one of the conflicting
 parts if not.
] 
[cleanup and refactor mangleUnravelled
Ben Franksen <ben.franksen at online.de>**20190712182656
 Ignore-this: 58ee0b078c09f1f163de3626ef806869e03ec528ddd54c5e361dde62ac88c6e981d04eb6b67d4e53
] 
[move instance PrimMangleUnravelled for Prim.V1 to its own module
Ben Franksen <ben.franksen at online.de>**20190712172529
 Ignore-this: 47695726193eddf3990a3f3ff1e48c57c8ced7fc355928c84a39ad9c2bc0a1c82ba9a22165014b00
 
 This is a pure code move without any changes to the definitions. It serves
 as preparation for a larger refactor but makes sense in its own right.
] 
[harness: test prop_ctxEq
Ben Franksen <ben.franksen at online.de>**20190716200452
 Ignore-this: 5748801a2bf402fd13c56c729685681410c9c09169633d3314ee257e6bf0aceaeb2b4d31ab17ff5d
] 
[fix v3 repo property prop_conflictsCommutePastConflictor
Ben Franksen <ben.franksen at online.de>**20190716153400
 Ignore-this: af00b2159f3c691dbd903e510ae1240fe6e6be6bf4f4d5773dd8260e97b0142f352ad0b822e938e
 
 The property as stated before didn't take conflict resolutions into account,
 that is, parts of a conflict could be resolved by recording a patch that
 depends on that part. In this case we can only commute the conflicted part
 past the conflictor if we drag the resolution with us.
] 
[add two properties about conflict resolution and test them
Ben Franksen <ben.franksen at online.de>**20190710174341
 Ignore-this: 3420413c7b20f8cee14c3c68b96b18f1638a20dd7136898191f8768cef03f5f9bfbf4dd525ea5494
 
 This required adding a utility function permutationsRL and factoring out
 mergeList from D.R.Resolution into D.P.CommuteNoConflicts.
] 
[v3: add an important conflictor property
Ben Franksen <ben.franksen at online.de>**20190624101201
 Ignore-this: 1a3903fa83494eca84415faba474a6669aeaba0bf3a2e5d82079b01b4eed811a96e19372ca388f2b
] 
[refactor the interface for creating Named patches from prims
Ben Franksen <ben.franksen at online.de>**20190714091935
 Ignore-this: bb7f0bd1f451d6f0a01cab219dabc57dc5ac0eb3258a2828a5eae49b750b15aa591526ffcc26de30
 
 This uncouples the type family PatchId from class Ident, so we can use it
 for patch types that have no instance Ident. This allows us to change the
 type of method fromPrim to receive a 'PatchId p' instead of the raw
 ingredients of a PrimPatchId. We add method fromPrims so we can delegate
 generating prim patch ids to the implementation of the RepoPatch type. The
 default method definitions for fromPrim and fromPrims ignore their input, so
 we don't even have to create dummy type instances for PatchId.
 
 We add the function positivePrimPatchIds to the interface of NamedPrim to
 support implementation of fromPrims for RepoPatchV3. This hides the serial
 numbers from client code which are now an implementation detail of
 NamedPrim. The function takes a PatchInfo as input, so the fact that we use
 the hash of the PatchInfo underneath is now also an implementation detail. A
 single exception is made with unsafePrimPatchId which we need (only) in the
 harness to define an instance Arbitrary.
] 
[v3: fix and restructure conflict resolution
Ben Franksen <ben.franksen at online.de>**20190710211725
 Ignore-this: 648fc16081d495f7067b6e2a3b7d42f905bb29a7053ee952447bb1e3023e1034a6fc651c00330f79
 
 It probably doesn't make much sense to view the diffs here, since I really
 restructured things a lot, re-wrote the documentation comments, and renamed
 and reordered functions.
 
 The main semantic changes are:
 - fixed the 'components' function which was buggy
 - fixed and cleaned up the history traversal to find vertices
 - throw out the no longer needed 'dropDominated'
 - calculate conflicts between vertices freshly
 
 The last point was crucial. In my original version I made the mistake to
 think that we can read off conflicts between vertices, i.e. contexted prims,
 directly from the conflictor. This is only so in the simplest case of two
 conflicting prims. In general it is false: the contexted patch represented
 by a conflictor need not directly conflict with all of the conflicts stored
 in the conflictor. This cannot be so, since e.g. a prim can conflict with a
 conflictor simply because it conflicts with one of the conflicts stored in
 the conflictor. The side-conditions in the commuteNoConflict cases make that
 pretty clear.
] 
[move v3 helper functions idsFL and idsRL to harness
Ben Franksen <ben.franksen at online.de>**20190710171914
 Ignore-this: adb91e53426a7602e0422b360e678a5ca64279ed7125bde9275c247ad1a7a4e0334f50bf0cb10a42
] 
[v3: remove debug stuff and other minor cleanups
Ben Franksen <ben.franksen at online.de>**20190710211129
 Ignore-this: a8cf0462f87cb0ec43d7a1766554e810d618f6a347784c650a923906d26de3b93f3fa66c9ff4e85a
] 
[fix the function used internally in v3 to merge FLs
Ben Franksen <ben.franksen at online.de>**20190710182302
 Ignore-this: a961e389d32076bb743fac0c9679e36245ba2320786178eceb40540fef3680583c3fbbe2b1316457
 
 It is used to merge non-conflicting FLs into a single alternative for
 conflict resolution. The bug was that we forgot to call findCommonFL and
 thus mergeNoConflicts could fail.
] 
[make PrimPatchId opaque and check invariant when constructing it
Ben Franksen <ben.franksen at online.de>**20190708161010
 Ignore-this: c4fe732deebf074a10265e3d85736bc736fe44e158615bc459d81f08614a5c7709e7372e529bbd72
] 
[document and add property for PrimPatchId invariant
Ben Franksen <ben.franksen at online.de>**20190615092033
 Ignore-this: 6e00fdb919775f7ddaec3d98bd0c30a2db2419a5348dbc468a00f28c648c79026e549d63c464eef5
] 
[improved test case generator for RepoPatches
Ben Franksen <ben.franksen at online.de>**20190624063022
 Ignore-this: f238d840b780add48ccd6fb6e7e02221dbf48096ea8e92885ce3dc9bebfd53b7b0bfd8e0dbec673e
 
 We previously generated RepoPatches by merging prims from a Tree. While this
 generates conflictors, it never generates sequences where a patch depends on
 a conflictor. The new generator (which can only be used for patch types that
 have a Merge instance i.e. not prims) directly generates an RL of patches,
 making sure we cover all possible cases.
] 
[harness: make sure once and for all that generated Trees have enough patches
Ben Franksen <ben.franksen at online.de>**20190707081626
 Ignore-this: f74b5c224e055fc6289096ae2b1e44ce422b50024f6c63adf005988be856431befc67cef3707b1f1
] 
[harness: remove a dirty hack from patch tree generators
Ben Franksen <ben.franksen at online.de>**20190621134136
 Ignore-this: 61e9017bd189f4936c59ab8442f7eb827893b1351d9ff5a3e8ac3877ae012d02e3a83383e1b65da1
 
 This re-adds a slightly modified version of sizeTree which we use to
 calculate the number of pairs in a flattened Tree.
] 
[harness: move nontrivialX conditions to D.T.P.A.Generic and remove dead code
Ben Franksen <ben.franksen at online.de>**20190621194726
 Ignore-this: 425ad9283a3e67720a165a6e6255359dce6daabb54a460ff3f2f033493ac1776e7bdc7a4e10f5987
] 
[harness: remove unused sizeTree 
Ben Franksen <ben.franksen at online.de>**20190707114205
 Ignore-this: e43847945cec7c3fad49895260208dcabdc5babf1fffc3ce3d289ea377086b6bb0c64e48a9786f84
] 
[harness: remove some out-commented code from D.T.P.A.Generic
Ben Franksen <ben.franksen at online.de>**20190621133552
 Ignore-this: 4ef0c24e4142c4eb0fa4b83487e592bce0b81f75a6f30351048e83e4c4e0f4bd5b4b71a6c32b0dd3
] 
[harness: remove unused propFail
Ben Franksen <ben.franksen at online.de>**20190621133040
 Ignore-this: 5a1497663b926b6f1c7b3a2881e480417b4c52d6a5a81f08438619d9d5510b2a919200c9320c0762
 
 While a comment said this is "handy for debugging arbitrary code" I could
 not find an any further explanation or an example. I guess it can be
 re-added easily if needed.
] 
[fix a bug in darcs1->darcs-2 conversion
Ben Franksen <ben.franksen at online.de>**20190226222910
 Ignore-this: f65ad0aced1aa6d473b8d59ebc5605daf931c569537214090f541186a967f8bf6b201a89139429b6
 
 The test data for threewayanddep threewayandmultideps were quite obviously
 wrong! The darcs-2 Conflictors are complete bogus, referring to patches that
 don't appear in the repo. This is caused by erroneous calls to
 sortCoalesceFL in the RepoPatchV1 implementation in unravel and in effect.
 The way these functions are normally used (effect when we apply a patch and
 unravel to generate conflict markup) is quite tolerant wrt coalescing.
 However, unravel is also used to convert darcs-1 Mergers to darcs-2
 Conflictors, and here the result is catastrophic. Instead of sortCoalesceFL
 we must merely cancel inverses, just like we do in the darcs-2 and darcs-3
 theory when we construct contexted patches (aka Nons).
] 
[rename module Darcs.Patch.Parse to Darcs.Util.Parser
Ben Franksen <ben.franksen at online.de>**20190217202539
 Ignore-this: 2cd7b62ee5cf6015e9f648cc1ddcf120dd7a9f06b7a6934fa28b7c81f7447f54c6a1b34797a5115
 
 There is nothing specific to patches in this module, in fact we use it for
 inventories as well.
] 
[fix warning in Darcs.Patch.Merge
Ganesh Sittampalam <ganesh at earth.li>**20190613183959
 Ignore-this: 6944e5e80cf628bc45f690cba84afd0c
] 
[harness: more detailed fail output for some properties
Ben Franksen <ben.franksen at online.de>**20190226093418
 Ignore-this: 11a41e9f3c7e5d599ade6794d32422f1995a330891726e740340fd5ccca993a91eafe3b3e7ec3100
] 
[move v3 repo properties to harness
Ben Franksen <ben.franksen at online.de>**20190225091504
 Ignore-this: 8bde91c045669b4d785d9a658b9b52b898c130ae5106e7358d067f685323a3c19d84a228b81730ac
 
 This is so we can use Darcs.Test.Util.TestResult and give better output when
 testing the property fails.
] 
[remove unused method isConflicted from class Conflict
Ben Franksen <ben.franksen at online.de>**20190301185825
 Ignore-this: b9b542bbe788194b8c6fdcfb3d7c70edebf34b76227b314df1f3d1fa6bbbff962575bbdf5835fb21
 
 Besides, we already have it as (isNothing . toPrim).
] 
[remove the obsolete PatchInspect superclass of Conflict
Ben Franksen <ben.franksen at online.de>**20190227230137
 Ignore-this: 735d0cdf081ee726b4799d2fc16f4011fdbc899b0c63f6a8b716ff43e1228c421d393a99e3b4cc3
] 
[harness: remove qc_V2P1 and qc_V3P1
Ben Franksen <ben.franksen at online.de>**20190225101544
 Ignore-this: 4c6e5161e8255083ce81f9be1596d42c04630df8058f0ade412f44327cf8d94ec11610b3e67a3035
 
 The properties listed therein do not in any way depend on the prim patch
 being V1. So I generalized the signatures and moved the tests to qc_V2 and
 qc_V3, respectively.
] 
[declare instances of IdEq2 for Named, NamedPrim, and PatchInfoAnd
Ben Franksen <ben.franksen at online.de>**20190224080814
 Ignore-this: 89d31c807008dd022dbadff8c514b7d7971cff6658751f9383618f3a8ffdcf2c4621d4b505b7d06
] 
[fold partialPermutivity into permutivity property
Ben Franksen <ben.franksen at online.de>**20190223094647
 Ignore-this: 567469e46368f0da6e89adaad2f3e33cab5f012b2827b4e9b56e3c402bbabccec1e24cecd056d84f
] 
[replace our own patch parser with attoparsec
Ben Franksen <ben.franksen at online.de>**20190217111256
 Ignore-this: c64d383cab9f491eefed0fd899779aeee209a196fb8081454332f595b4d02cc1b0d0539eba3ec02f
 
 We already depend on attoparsec for convert import and its functionality and
 implementation is quite similar to our self-written parser monad. I have
 checked that this does not impact performance negatively.
] 
[optimize parsing of PrimPatchId
Ben Franksen <ben.franksen at online.de>**20190216113744
 Ignore-this: 2cbf157b49fcca77248c240cdca76a9bf65bc7c7210299b5625e492a1b250ede01bb488f2f0fd41c
 
 Profiling showed that a lot of time was spent inside b16Dec when reading v3
 patches. We now read the SHA1 directly off the ByteString which is much
 faster than going via b16Dec and binary decoding. Also fail properly in the
 parse monad if the hash is malformed rather than calling error.
] 
[add more detailed comments for some cases of findConflicts
Ben Franksen <ben.franksen at online.de>**20190215161223
 Ignore-this: f4e9e6b12267be5026752bdeb437b8986df3e2a0cc505e8abb32277a0bb3d3520a22a3b635d97d22
] 
[fix prop_conflictsCommutePastConflictor
Ben Franksen <ben.franksen at online.de>**20190215155817
 Ignore-this: 66c198d17461ac90450d37a4b47cf912ee5a52f16277aa5b86a76cd62bc90a9fac759b55fb203a68
 
 The property was almost correct but not quite. Indeed, patches we conflict
 with may not individually commute past the conflictor because of
 dependencies between these patches. However we can always commute them to a
 contiguous segment right before the conflictor, and then commute them past
 the conflictor as a whole.
] 
[add a number of INLINE or INLINABLE pragmas
Ben Franksen <ben.franksen at online.de>**20190215111230
 Ignore-this: 36cde62676771b68e151121c1028c0dea46d6b4e4b3ab9f06a49e3f1f10c06e48b48d8d9dfb6cf50
] 
[implement resolveConflicts for RepoPatchV3
Ben Franksen <ben.franksen at online.de>**20190213191419
 Ignore-this: 5930378d244113a2c1ec5a25ebea540fddcfaa0991403d0f46ee0e3ce3b7b7a0818c1a26a28dad52
] 
[change the type of resolveConflicts
Ben Franksen <ben.franksen at online.de>**20190213172409
 Ignore-this: 77cdb5896438291f91e9a4b64f3c165beffb1b042d5ff8af49e729a20be1e80228d8cc0ed0a72288
 
 It now gets two RLs of patches as input and produces a simple (not nested)
 list of resolutions. The change in the input type(s) has been done because
 otherwise a RepoPatchV3 cannot correctly implement resolveConflicts, which
 requires that we know the transitive set of conflicting patches for each
 conflict. But a V3 conflictor contains only the patches that directly
 conflict. The separation into two input RLs is so that we can still resolve
 only the conflicts inside a (trailing) segment of all patches in a repo,
 which is how we call it when merging patches.
 
 There are no longer instances of class Conflict for RLs and FLs. Instead, we
 offer the stand-alone function combineConflicts and use that in the
 implementation of resolveConflicts for RepoPatchV1/2.
 
 The change in the result type is just a cleanup: instead of adding the
 mangled resolutions as a first element and then taking the head (in
 standardResolution) we now replace the inner list with the mangled version.
 
 Passing the full context to resolveConflicts requires a number changes
 downstream. This is not strictly needed for V1/V2 which ignore the context,
 so we could pass undefined, but we need to make this change for V3 anyway.
 Instead of adding yet another parameter to all functions involved, we now
 pass a (Fork common us them) which cleans up type signatures (and
 incidentally some of the code, too).
] 
[show the PrimPatchId only ForStorage, not ForDisplay
Ben Franksen <ben.franksen at online.de>**20190212171739
 Ignore-this: 14e9d992008886472c8074eb51478b87ddc92a0f9166796697678a7f7800f77e3b6f33800b4e8a90
 
 The PrimPatchId is not useful to the user and clutters up the output when
 --verbose is in effect. It also allows more test scripts to pass without
 having to adapt them.
] 
[bugfix in instance ShowContextPatch for NamedPrim
Ben Franksen <ben.franksen at online.de>**20190210204803
 Ignore-this: 68a4bfee97592c22cbe1db6e2c9f55619ec5202e4b80a8a6eed7368c579a77c7234009fb49e62f6f
] 
[add Darcs.Util.Graph
Ben Franksen <ben.franksen at online.de>**20190209161000
 Ignore-this: 124741eb525d8358ac597505bafa83045427a876de6edf9aa1b13f1d02499265e15fe3ac614d7966
 
 This contains an efficient algorithm to determine maximal independent sets
 of an undirected graph.
] 
[separate class Summary out from class Conflict
Ben Franksen <ben.franksen at online.de>**20190209122716
 Ignore-this: 72faff5442a74f6d7e36d07c5d32a8205e520713009a01d7728a297d17c7add1387def4c422d6c5a
 
 This prepares a change in the type and meaning of resolveConflicts but makes
 sense independently. The method conflictedEffect is used only to generate a
 summary for potentially conflicted patches and thus has been moved to the
 new class Summary. The class Conflict gets a new method isConflicted which
 just returns whether a patch is conflicted or not.
 Incidentally this gets rid of a number of unneeded instances for Conflict
 with nonsense/dummy implementations for resolveConflicts (such as for Named,
 PatchInfoAnd, RebaseChange, and RebaseSelect).
] 
[fix instance MightBeEmptyHunk for NamedPrim
Ben Franksen <ben.franksen at online.de>**20190209135159
 Ignore-this: b1086cabaaab6213c883e46b2f628c627865a904b94b0ecea32b8c4b82cbd00da8bd4ff8ae93e3c6
 
 Property effectPreserving fails for Prim.V1 empty hunks, and so it does for
 its NamedPrim wrapper.
] 
[fix in the QC generator for prim patch IDs
Ben Franksen <ben.franksen at online.de>**20190209134332
 Ignore-this: 91ebf416d68a3e32c88a4b57f2b215d2a714c83ba9d52f7044ba9cf6c10b795f0cb05a7725481dbb
] 
[restore alphabetical order of exposed-modules in darcs.cabal
Ben Franksen <ben.franksen at online.de>**20190208164649
 Ignore-this: 8e8b4a08b048a798154b8545ec1eda37a4078baae2163b901cc2f64abfdfa10f7d0aad145cbf361f
] 
[move Darcs.Patch.V3.Prim to Darcs.Patch.Prim.Named
Ben Franksen <ben.franksen at online.de>**20190208164649
 Ignore-this: 11c6b305355e9d6b75e3f02ca85dc3246d220886c1d5d133ba1dcea8d68d94fc76ade6e8e8924d74
 
 This is actually a fully generic wrapper for any PrimPatch type and
 technically not tied to V3.
] 
[add prim patch identifier when constructing Named patches
Ben Franksen <ben.franksen at online.de>**20190208164649
 Ignore-this: f57ffc7d3a83e9779566083826ee3b2b46048f78267100ea9a54e9bd94cb502ebfdc712e48f2f2f3
 
 This re-adds method fromPrim to class FromPrim, this time with additional
 parameters to construct the identifier. This is then used in function
 infopatch instead of fromAnonymousPrim.
] 
[renamed fromPrim to fromAnonymousPrim
Ben Franksen <ben.franksen at online.de>**20190208164649
 Ignore-this: c48e828a89e8afd62066c77998c5cd18584060e279f92823d7496cd823316426a7649606fc03e82a
] 
[add V3 stuff to the test suite (quickcheck tests only)
Ben Franksen <ben.franksen at online.de>**20190208164538
 Ignore-this: 4a6082f0fdd9a47b753fa9f020bc87cad4d7c8fed450ac497660aec14a7fc8ba59a9071d1c4e951c
] 
[add RepoPatchV3 aka camp conflictors
Ben Franksen <ben.franksen at online.de>**20190208164513
 Ignore-this: feeb4c3e9c99f20f77cb5980bad455e454715b484b2b5185195a2455e7e14abb6563a5e08c2faccc
] 
[add some functions we need for V3 to Darcs.Patch.Ident
Ben Franksen <ben.franksen at online.de>**20190208155041
 Ignore-this: dbe9d108136fda53b93c507df62c94f3ac15a8fc1b614c23358e0aa15b444b1675f863ec4fe190b1
] 
[fix documentation in Darcs.Patch.CommuteFn
Ben Franksen <ben.franksen at online.de>**20190224073329
 Ignore-this: 1e653f68a6e8d88386e9f1274cd12d952b192f85889394d8592ecd8228bebe806dede0d58527c096
 
 The possibility of failure means that all CommuteFns are more or less
 equally strict: to consume a result sequence we must know that the result is
 Just and that requires all commutes to be performed at least up to the point
 where we know they succeed.
] 
[harness: slightly improve docs for generic properties
Ben Franksen <ben.franksen at online.de>**20190226091049
 Ignore-this: e10a9008733ea6205413b55617ed0d9b3fba9f7bdb1f5d7bbf5553c9ccaa610e7699b4ed4f76b6ca
] 
[remove unused instance Merge (RL p)
Ben Franksen <ben.franksen at online.de>**20190304134928
 Ignore-this: 8687305e380d01d0ce4dbe7768568f9e9ab22e9981780f8f37d1b516a4211d735558387bc59e17a9
] 
[fix in tests/convert-darcs2.sh: add missing "cd .."
Ben Franksen <ben.franksen at online.de>**20190226214009
 Ignore-this: 7593682e01c1f22e9b12e93aa6bdc9d93ec81445f938577bdb84a9ae22f3a34150f98169d245edf8
] 
[make it clear that coercing Repository is "unsafe"
Ganesh Sittampalam <ganesh at earth.li>**20181118220143
 Ignore-this: a6c3812e365d19cd17377fe146dda216
 
 This may be a little pedantic, especially as we don't claim that
 mkRepo is unsafe, but it's consistent with the API for patches.
] 
[use mergeNoConflicts in the definition of standardResolution
Ben Franksen <ben.franksen at online.de>**20180916104610
 Ignore-this: 146e0e181392dbee9f1286bef5e4c1035b0fd68208e78e33d75b5aff63d6b32168cbc6f446779b91
] 
[replace use of fromAnonymousPrim with call to constructor
Ben Franksen <ben.franksen at online.de>**20190208164954
 Ignore-this: 43e342cde5dc6e4985b875276b0b7d984e7c3163434b049b37e1098456dd75e0363072588ad9416
 
 This further minimizes calls to fromAnonymousPrim which is good because with
 V3 this is now an unsafe method.
] 
[better diagnostics when property mergeEitherWay fails
Ben Franksen <ben.franksen at online.de>**20190205105245
 Ignore-this: 2cc1b0a1357bd305a63ead1fe6e1120637ce8969fab1b01705db2b28e2070dbe26bff863f68dfa16
] 
[rollback of rename conflictedEffect to isConflicted
Ben Franksen <ben.franksen at online.de>**20190209115302
 Ignore-this: 846fbce4cea91f41337b551ff6a650a7f9ff58159c5b7462fcde2153ce01be01c7cf0568d5eb315b
 
 Contrary to what I stated there, conflictedEffect does have a lot to do with
 the effect of a patch. It is just in the wrong class which I am going to fix
 in another patch.
] 
[resolve issue2618: option --ask-deps adds too many dependencies
Ben Franksen <ben.franksen at online.de>**20190124183655
 Ignore-this: 99b3f4b4f6e72a80773321890a3ae6b08bf2b2121e5590db51ae4aec503edd253f84818c5f2e0ac4
 
 The trick is to filter out any patches in the result from runSelection that
 depend on later ones. While this may also filter out explicitly selected
 patches, these should rightfully not have been offered in the first place.
 I took the freedom to clean up and simplify the code for askAboutDepends.
 This concerns mainly the initial filtering of patches that are depended on
 by what we record, which is now reduced to a plain commuteWhatWeCanRL.
] 
[accept issue2618: option --ask-deps adds too many dependencies
Ben Franksen <ben.franksen at online.de>**20190124183618
 Ignore-this: 3c530e6336303b14ab82382d755cd50f37aa7115891e465a6dbf3ea4389398b1e7ecc01d0f46a935
] 
[annotate all uses of anonymous with comments
Ben Franksen <ben.franksen at online.de>**20190123184250
 Ignore-this: e36396a975c47090fbd77903cb3948ded7ba576e723a3963f5e48c505d7b1729d70940a846a0850a
 
 Whenever we call anonymous to construct a Named patch we must now check
 that we don't accidentally store patches that result from merging them
 with normal patches.
] 
[add class IdEq2 to Darcs.Patch.Ident
Ben Franksen <ben.franksen at online.de>**20190124135342
 Ignore-this: c5466acfb13224c405ebfe055b186d2a57d0d9d53dbf6044facba677efe0dba803c865e3469e8cde
 
 This allows a faster equality test for FLs of patches with identity.
] 
[remove class PrimPatchCommon
Ben Franksen <ben.franksen at online.de>**20190123145855
 Ignore-this: a928a57c0712f3e27971cc2df9bb30763581f11f8e18bf28d9bddd441a6b4ec2d67b2b60a6d6de78
] 
[avoid direct imports of Darcs.Patch.FromPrim from outside of Darcs.Patch
Ben Franksen <ben.franksen at online.de>**20190122194221
 Ignore-this: f3526d3539faa6b8a0f3c7f547fa95d4a2d1acaac062b6e5465e5cc4f2c7b63b3ed356eb5cf026a1
 
 The only exception is now the implementation of rebase inject which needs
 low-level access to fromPrim.
] 
[remove fromPrim from Darcs.Patch
Ben Franksen <ben.franksen at online.de>**20190122193314
 Ignore-this: 5466d3c0d875be04d4d987230016b2ed5ce623aef2d4cf31113d73c0244c3f751c348fc38236487e
 
 This is now no longer an official part of the Patch API.
] 
[move classes PrimPatchBase, FromPrim, and ToFromPrim to their own module
Ben Franksen <ben.franksen at online.de>**20190122192439
 Ignore-this: 7a05d15ffab8643ee34adffdca910beb4628c478cc98eb7fd114244a00b448d9a46d63f459622e8e
 
 These classes are not part of the Prim patch API but the RepoPatch API.
] 
[move instance FromPrim (FL p) to Darcs.Test.Patch.Examples.Set1
Ben Franksen <ben.franksen at online.de>**20190122184024
 Ignore-this: 46af7bff9fa0123cbf9341529ba5b69a5e44a1a589d1ea87b5a6f8829d701d7f97651716b0ddcbb2
 
 This is the only place where the instance is used.
] 
[remove instances for FromPrim and PrimPatchBase for prim types
Ben Franksen <ben.franksen at online.de>**20190122183012
 Ignore-this: 756b3fd6b00bcd2a2d4af647a9dda4b645023bfd24f136fb8d7530afcc687ae5d3f96622fb2b7ece
] 
[eliminate use of fromPrim in convertDarcs2
Ben Franksen <ben.franksen at online.de>**20190122175720
 Ignore-this: f49d305cb77f4260a6bafab2fd9a96b297b441e1c5e9aee711d0a44eee52b3ae3f4b010e55179088
 
 The code now uses the data constructor V2.Normal instead.
] 
[eliminate an unneeded use of fromPrim
Ben Franksen <ben.franksen at online.de>**20190122173108
 Ignore-this: 3b97bef8e57f2ae1fb571f6ec5a5b817e4ff097d7fc2698ef7e258d54dd9dd7d4009f783244b51af
] 
[refactor: eliminate class FromPrims
Ben Franksen <ben.franksen at online.de>**20190122172158
 Ignore-this: 54d76dec03513588d7bf8b59c79aa24c6af77c5b4d106b2fbd33e3de2e9d06d6ed7aa01c4f325fb8
 
 Again, preparation for adding identities to prim patches. The method
 fromPrims was used mainly to construct Named patches via infopatch or
 anonymous from Darcs.Patch.Named. These functions now take an FL of prim
 patches as input.
] 
[inline function Darcs.Patch.Named.namepatch
Ben Franksen <ben.franksen at online.de>**20190122132111
 Ignore-this: 4a9fbb4c69164a54029c50bcb7ff3b369728de13989296b4132d52b92b4fadf038a7f1da62d79a6c
 
 This is in preparation of adding identifiers to prims when constructing
 named patches.
] 
[replace errorDoc, assertDoc, bug, and impossible with direct error calls
Ben Franksen <ben.franksen at online.de>**20181214153646
 Ignore-this: bc37ba5af9afd01725140e6f008839811b0e17058f0fe7d531998017d0c0da6d5393430840765653
 
 All of these functions indicate the same thing: if they are evaluated then
 this is a bug in Darcs. In case such an error happens we want to know the
 file and line number. If we use any of these functions, then the location we
 get from ghc is only an unhelpful src/Darcs/Prelude.hs or
 src/Darcs/Util/Printer.hs. That is, unless the callstack actually contains
 useful information, which apparently requires profiling to be enabled. So
 this is useless to us in practice because who uses a special
 profiling-enabled Darcs in their daily work?
] 
[support QuickCheck 2.12
Ganesh Sittampalam <ganesh at earth.li>**20190116061531
 Ignore-this: e907466ec9d44ac9fc309e40fa82bcfc
] 
[support zip-archive 0.4
Ganesh Sittampalam <ganesh at earth.li>**20190116052802
 Ignore-this: 53bd6a4c63f1dc0c98c2dfa4fe6f578d
] 
[RepoModel tests: replace Either with an explicit failure type
Ganesh Sittampalam <ganesh at earth.li>**20190115065956
 Ignore-this: 200c9c8fd864a98063dd76a510c9ab0c
 
 This means we can have a non-orphan MonadFail instance.
 
 Immediately before this change fail on this type would
 have just called error, but the code dates from before
 the explicit fail definition was removed from Either in 2010,
 so this probably restores the original intention.
 
 (see https://ghc.haskell.org/trac/ghc/ticket/4159)
 
] 
[treat path to unrevert bundle like all other repo paths
Ben Franksen <ben.franksen at online.de>**20181204184737
 Ignore-this: a67547eb79315034ea92fc3b47b1bb2b3484af0a4e5aa07a53b28dd37359a26f089058ba0b3fcdee
 
 This means that we treat it as relative to the repo base directory instead
 of having it depend on the repoLocation of our Repository. Also factors
 unrevertPath to Darcs.Repository.Paths.
] 
[move removeFromTentativeInventory closer to its single call site
Ben Franksen <ben.franksen at online.de>**20181113101957
 Ignore-this: 33863d10e41a0a82de494a7c9d421bec57c1c0e61c6493823200328e715d578ab5649ea2384206ac
] 
[removed unneeded pseudo-instances for class Effect
Ben Franksen <ben.franksen at online.de>**20181018102651
 Ignore-this: ff7c46758f59624261bd27d2c155fee465cb12bc2c103f1b1eeb455465f8f77fa1714c12f930209b
] 
[fully respect the useIndex option
Ben Franksen <ben.franksen at online.de>**20181203182954
 Ignore-this: 2ffeb71ab73962267e4db6092fb7e29081faab86419e478f6e26d4685cc133eb8de75f8a8c7f02b6
 
 This hopefully eliminates any remaining unchecked uses of the index.
 Darcs.Repository.State now contains a CPP macro TEST_INDEX to control
 whether some testing code is included that accesses the index /and/ does a
 readPlainTree with an appropriate filter and then checks that the resulting
 trees are equal. We also pass the repoLocation explicitly to readPlainTree
 now (if available), because it turned out that some uses of the functions in
 D.R.State are made with a CWD that is not equal to the repo base dir.
 The implementation of readUnrecorded is now in terms of
 readUnrecordedFiltered instead of repeating ourselves.
] 
[rollback of "resolve issue1959"
Ben Franksen <ben.franksen at online.de>**20181203181310
 Ignore-this: d2a01578d01e78c05b7d39179b4e6118099da55c615c296fb8b87a13813d3fad7e978de7c85508d4
 
 This change is unsound for several reasons. One is that catching permission
 errors is unreliable as it can depend on the OS what kind of IOError is
 thrown. Another issue is that catching these errors may hide problems for
 repo-modifying commands like add and remove where we rely on the index being
 updated or at least being invalidated properly.
] 
[fix: insert a valid date when creating anonymous named patch
Ben Franksen <ben.franksen at online.de>**20181116202605
 Ignore-this: 69775e49e45c1591b6858c4580e882795524ba8a442d1be6b4874062444f96e285a828f972ac0f3c
 
 Otherwise we get an exception when we try to e.g. display the patch.
] 
[remove duplicate definition of invertCommuter as inverseCommuter
Ben Franksen <ben.franksen at online.de>**20181031160755
 Ignore-this: 805b23e32cfafa5b956b34214a043702ce7cd910a30d455489cd5be81ba14ef29acf21f94b6c6506
] 
[resolve issue2604: remove --reply and related options
Ben Franksen <ben.franksen at online.de>**20181012230927
 Ignore-this: 95ca795c7cb43c7400f23da7256516130bb730069129bc7d83bb43e73c2f5eeaca02c19423c9bf4a
 
 The options are: ccApply, reply, happyForwarding and were supported by the
 apply and push commands. This patch removes all conditional compilation from
 Darcs.Util.Compat. It also removes the dependency on the random package when
 building for Windows.
] 
[disentangle D.R.State.filteredWorking
Ben Franksen <ben.franksen at online.de>**20181002212643
 Ignore-this: 366cca7d58b10eb1437fec6dc11c9e2a79d59d3a7173967b6a40bb41b98b35f554c30c115b231e32
 
 Swapping the order of the cases and then trying to pull out applyTreeFilter
 relevant made it apparent that
 (a) using the index in the IgnoreIndex case can be replaced by passing the
     pending_tree instead, and
 (b) applyTreeFilter relevant was missing in the UseIndex+ScanKnown case.
] 
[patch index: replace fn2fp with displayPath
Ben Franksen <ben.franksen at online.de>**20181014090111
 Ignore-this: ba08371018fffd2957a8616c50e91233e75c752557a12a6ad6bb8d56d405d4cfdf58da2ff12c5aff
] 
[patch index: clean up import and export lists
Ben Franksen <ben.franksen at online.de>**20181014085600
 Ignore-this: 384f78dd7cf592b3a0e918338fa1a8b7a5b6e5e4ece20896cca4756d02812eddf132623e2d6f654e
] 
[add progress reporting to patch index
Ben Franksen <ben.franksen at online.de>**20181014083856
 Ignore-this: d6caeb553930ada3e7c4ae4f6fa99130bb30478e07b0e0e9df7962465fb3dff31e36c148727d6609
] 
[fix in patch index: use removeFile, not removeDirectoryRecursive to remove noPatchIndex
Ben Franksen <ben.franksen at online.de>**20181014082907
 Ignore-this: e7aae98873b4c7a3f83536b2228cedc8de9ed534413f2ea7caa4e303d165bd884c7cf1d9c617ec8
] 
[rename FileName to AnchoredPath and remove the type synonym
Ben Franksen <ben.franksen at online.de>**20181011212536
 Ignore-this: 884cf842b0855404bb9300f92aaac123040e122ca3963ce4fef20880ff80ac8789379834ed1d2561
] 
[use AnchoredPath instead of FileName for internal path representation
Ben Franksen <ben.franksen at online.de>**20181011211834
 Ignore-this: 4a62454e764a04280bc2fe153fce932dc5e5f555e8629be860c5e261167434e5e2ecf3564f551d8
 
 This is a large patch that touches many files. I have tried hard to make
 reviewing it as easy as possible by avoiding changes that aren't necessary
 to achieve the goal. For instance, in this patch, FileName is still used but
 is a synonym for AnchoredPath. I have resisted the temptation to include
 cleanup changes, except where it was necessary for me to make sense of
 existing code.
 
 AnchoredPath is now used throughout, from the UI down to the patches
 themselves, for all paths that potentially reference user content in a
 repository. This means paths under _darcs are /not/ included, and neither
 are paths /to/ a repository or a cache or other files not under darcs
 control.
 
 Arguments from the command line are sanitized and converted to AnchoredPath
 early on. This is now concentrated in two routines: pathsFromArgs, and
 pathSetFromArgs, see their documentation for details. We convert to FilePath
 only for IO operations or for display to the user.
 
 Parsing of prim V1 patches is a bit stricter now: it fails if paths are not
 explicitly relative i.e. start with "./". The standard constructor for the
 Name type (makeName) now checks that the invariants aren't violated, that
 is, a Name is never empty, ".", or "..". Unfortunately, the index code still
 needs to use unsafeMakeName because it violates these invariants, at least
 temporarily.
] 
[delete commented out code
Ganesh Sittampalam <ganesh at earth.li>**20181017054933
 Ignore-this: 141d9e1511190a3bc6dd0d60c263a356
] 
[move mangleUnravelled to new class PrimMangleUnravelled
Ben Franksen <ben.franksen at online.de>**20181003184913
 Ignore-this: 1ba0a4b9437bc75f58db069ed33277c4067516fe61fa9da92d2706fe6232ecd3b8fcb2029724071
 
 This refactor serves two purposes: First, we isolate yet another bunch of
 code that heavily depends on Prim.V1, similar to the recent introduction of
 PrimSift. Second, while this is support code for generating the conflict
 resolution markup, it is not related to conflictors or conflicts per se; in
 fact, it works on and uses only features of prim patches.
] 
[remove excessive debug output in D.R.HashedIO
Ben Franksen <ben.franksen at online.de>**20180930172235
 Ignore-this: e874542daf908b7bbbd67aa6fa1636b5f42799d1a6f2c01f187b11495532282d1de5b1da39eceffd
] 
[eliminate hard-coded repo paths from the UI layer
Ben Franksen <ben.franksen at online.de>**20181003185748
 Ignore-this: f90032e9a8e52b7f3fc55295befa08f03ac3fede42a495a2b0c91feda1b963431ae757f6c2f48010
 
 There is one exception in darcs convert where we create a "marks" file
 inside _darcs but I guess this is an ad-hoc addition.
 
 Note that this is the first time this operation of concentrating repo paths
 to a single module actually pays off: in the convert implementation we used
 a wrong file name _darcs/tentative_hashed_pristine (the correct name is
 _darcs/pristine.tentative). So this also fixes a bug.
] 
[fix in output of log command
Ben Franksen <ben.franksen at online.de>**20181007165339
 Ignore-this: 1c8666e31ec6b5103bad9b9864b09faa70849f2e357350e75b11ed7345d912f39f823dc9b643ed80
 
 I think the 'not' here got lost during a refactor.
] 
[resolve issue1959: catch permission errors when accessing the index
Ben Franksen <ben.franksen at online.de>**20181002230526
 Ignore-this: 2477c259bf7e9998c699b56a13dccc2187839f5271be678f85e6f2c86bc102e313526f4799d14da9
] 
[use cryptonite instead of cryptohash and random
Ben Franksen <ben.franksen at online.de>**20180921142554
 Ignore-this: 331cdff4ee3a495fd0c8fbcb2a2563d5
 
 This also replaces our own implementation of SHA1.
 
 It is unfortunate that we have to add the memory package as a dependency
 but there is currently no other way to get at the content of a Digest.
] 
[factor yet another bunch of repo paths to D.R.Paths
Ben Franksen <ben.franksen at online.de>**20180922153612
 Ignore-this: 4be35b34f99043bb88979727aa0c7a6
] 
[avoid needless String/ByteString conversions when reading format file
Ben Franksen <ben.franksen at online.de>**20180922122839
 Ignore-this: d9ebfdc76eda57e29f7dba52b122f0af
] 
[reliably fail if we detect that an old-style rebase is in progress
Ben Franksen <ben.franksen at online.de>**20180920135615
 Ignore-this: fc4023a78ddae501af398916c1b4554f
 
 The trick is to check if the repo type is tagged with SIsRebase, which means
 that the repo format has rebase-in-progress, and then count the suspended
 patches in the new-style rebase patch. If it is zero we can assume that we
 have an old-style rebase in progress.
 
 While the check itself is simple, making sure it is called with the right
 parameters at the right time is not. One problem is that we must make an
 exception for the 'rebase upgrade' command. This is achieved by adding a new
 kind of RepoJob (OldRebaseJob) just for this command. A further complication
 arises because startRebaseJob is called with an SIsRebase-typed repo
 regardless of whether a rebase was in progress initially or not. In this
 case we cannot decide whether to run the check based on the repo type alone,
 but instead have to (re-)test the format stored in repository token.
] 
[add command 'rebase upgrade'
Ben Franksen <ben.franksen at online.de>**20180919201151
 Ignore-this: 2336365ca25c08b3366c2a05f2a6ac8
 
 This required a few additional refactorings mostly in D.R.Hashed. We lift a
 local function to the top level that (lazily) reads the patches from a
 single inventory. Since this does not return a PatchSet but only an RL of
 PatchInfoAnd, we can generalize it to return PatchInfoAndG and so can be
 used with WrappedNamed instead of Named. The WrappedNamed has been
 resurrected and largely cut down to what is needed for this single purpose.
] 
[use englishNum for correct grammar in rebase status line
Ben Franksen <ben.franksen at online.de>**20180919231029
 Ignore-this: cfca8a805b760612c7ddef031445daef
] 
[add PatchInfoAndG which is polymorphic in the named patch type
Ben Franksen <ben.franksen at online.de>**20180919095655
 Ignore-this: aa2fdfd81cb236f2db7886dcbc7fb7cc
 
 The standard PatchInfoAnd is now a type synonym that fixes the named patch
 type as 'Named'. Unfortunately this required the addition of Eq2 constraints
 in lots of places.
 
 The goal of this generalization is to be able to convert old-style rebasing
 repos, for which we need to read PatchInfoAndG with a simplified version of
 the old WrappedNamed as the named patch type.
] 
[remove the WrappedNamed layer
Ben Franksen <ben.franksen at online.de>**20180918171323
 Ignore-this: 2f29e084bd43127dcda265f3729ee882
] 
[two fixes in clone and convert import commands
Ben Franksen <ben.franksen at online.de>**20180918021046
 Ignore-this: 151345be0c286e0ef17c07cb67593fe0
 
 The bug was in both cases that finalizeRepositoryChanges was not correctly
 paired with revertRepositoryChanges. This was exposed by the new way of
 storing the rebase patch, which crashes when it tries to rename the
 tentative rebase patch back to its final version.
] 
[store rebase patch at the repo layer instead of mixing it with normal patches
Ben Franksen <ben.franksen at online.de>**20180918170040
 Ignore-this: b53e98ddc25a3b21a5a30eb552e1f5b0
 
 This does not yet do away with the WrappedNamed layer and the
 RepoType/PatchType cruft, which will be done in a second and third step.
 Some tests now fail which is due to bugs which are only weakly related to
 the change made here, so will be fixed in a follow-up patch.
 
 Note that this changes is incompatible in that previous versions of darcs
 can't handle a repo with a new-style rebase in progress and vice versa. This
 is something we cannot avoid unless we keep all the old code around, which
 would reap us us of most of the benefits we get from this change.
] 
[move more repo paths to D.R.Paths
Ben Franksen <ben.franksen at online.de>**20180702165826
 Ignore-this: 8d1d58ce13ee439349aaffd04d956dba
] 
[clean up imports in Darcs.Patch.Ident to avoid warnings
Ben Franksen <ben.franksen at online.de>**20180917115841
 Ignore-this: 432ee51baa22ac2711e83bba3a24ef75
] 
[add class Ident to abstract over patches with an identity
Ben Franksen <ben.franksen at online.de>**20171029221412
 Ignore-this: 4fc76e8ecaca72ffc59c9f54e0444788
 
 This change is a preparation for the addition of identifiers to prim
 patches, so we can use the same algorithms for them.
] 
[added foldRL_M, foldwFL, and foldwRL, renamed foldlFL/RL to foldFL/RL
Ben Franksen <ben.franksen at online.de>**20171101004239
 Ignore-this: 36ac70895a164b1f81af8cbd463b20a
 
 First, the renamings (removing the 'l') have been made because (a) the name
 is wrong for RL, which is actually right associative, and (b) because these
 are both the "natural" folds, i.e. the ones that replace the cons operator
 with a function.
 
 The other functions aren't used, yet, but will be used in the upcoming
 addition of RepoPatchV3. The 'w' variants allow the transformation of
 witnessed values, they are similar to foldRL/FL_M just not monadic.
] 
[layout fixes and a trivial refactor in D.T.P.Check
Ben Franksen <ben.franksen at online.de>**20180915075933
 Ignore-this: 453ec8305f86cd2fe939c7b7d51f1c4d
] 
[move mergeEitherWayValid from V1Set1 to Generic
Ben Franksen <ben.franksen at online.de>**20180502071708
 Ignore-this: 2c925f24883f80cfe7b6e0e2bc91b57e
] 
[fix comment and remove out-commented code in D.T.P.A.PrimFileUUID
Ben Franksen <ben.franksen at online.de>**20180502065405
 Ignore-this: dc1ca6f29eae22a0142fea3f16cd87d2
] 
[reformat parts of D.T.P.Arbitrary.Generic to avoid overlong lines
Ben Franksen <ben.franksen at online.de>**20180502065049
 Ignore-this: b452772137b0382324ff993713766a0
] 
[document laziness of commuter functions and slightly improve commuterRLFL
Ben Franksen <ben.franksen at online.de>**20180911184016
 Ignore-this: 34e7f8b5428b88321be57de62093f869
 
 The result lists of commuterRLFL are now produced in an alternating fashion,
 so that both can be consumed lazily (from head to tail).
] 
[make Commute a superclass of CommuteNoConflicts
Ben Franksen <ben.franksen at online.de>**20180911220005
 Ignore-this: 1b0320b60ba26eb2638dd5848589d239
] 
[make CommuteNoConflicts a superclass of PrimPatch
Ben Franksen <ben.franksen at online.de>**20180908165001
 Ignore-this: 722e6ad73533f93801d5437ff2dcd4f8
 
 This allows to use mergeNoConflicts for prim patches. An alternative would
 be to scrap CommuteNoConflicts and instead add commuteNoCnflicts to the
 Commute class.
] 
[use generic commuter functions to scrap boilerplate
Ben Franksen <ben.franksen at online.de>**20180908143225
 Ignore-this: 2c538f1c8f85f79709fe21a05fc00242
] 
[factor CommuteNoConflicts to its own module
Ben Franksen <ben.franksen at online.de>**20180908111336
 Ignore-this: c9bc4844fa5d5d9008a9628ca067f4e0
 
 Also improved the documentation for it and for mergeNoConflicts.
] 
[replace D.UI.C.Util.repoTags with D.P.Set.patchSetTags
Ben Franksen <ben.franksen at online.de>**20180718224724
 Ignore-this: e6d6c3babd5ad98051284c7f4f9582b6
 
 Also remove unused functions 'tags' and 'patchSetfMap' from D.P.Set.
] 
[avoid access to PatchSet constructors where possible
Ben Franksen <ben.franksen at online.de>**20180611181705
 Ignore-this: b7f88c9dccf9f50ed35824b06d452882
 
 This includes the full UI subsystem but also parts of Patch and Repository.
] 
[moved inOrderTags from convert command to D.P.Set
Ben Franksen <ben.franksen at online.de>**20180611171952
 Ignore-this: ec6700455ba8bb3d51f0190c6bbdb748
] 
[replace our rmRecursive with removeDirectoryRecursive from directory package
Ben Franksen <ben.franksen at online.de>**20180901093655
 Ignore-this: 95f9308013bf8a20ab4081d240f6db7
 
 This function has been fixed not to follow symbolic links since
 directory-1.2.2.0, so we no longer need to roll our own.
] 
[replace most calls to getDirectoryContent with listDirectory
Ben Franksen <ben.franksen at online.de>**20180715124309
 Ignore-this: 7917d3ab42a320fe8ef6611a2ecafc98
 
 This function has been around since directory-1.2.5.0 (we currently require
 at least 1.2.7). Using it lets us avoid manually filtering out "." and ".."
 entries.
] 
[improve docs for crudeSift and v1siftForPending
Ben Franksen <ben.franksen at online.de>**20180827165549
 Ignore-this: 18a6434d795d72bb5cbc7e49dd4c1405
] 
[simplify v1siftForPending
Ben Franksen <ben.franksen at online.de>**20180827165528
 Ignore-this: ad28511cb3e006aaec594fc505a67980
 
 Using the Maybe monad here is completely unnecessary.
] 
[simplify definition of local function sift
Ben Franksen <ben.franksen at online.de>**20180827165039
 Ignore-this: a0aac43bf64c452c789b38e9a5fc2bbc
] 
[move code from D.P.Prim.Sift to D.P.Prim.V1
Ben Franksen <ben.franksen at online.de>**20180827093641
 Ignore-this: be2dd09f9b9003632e7ed182b02be74f
] 
[treeDiff: abbreviate 'anchorPath ""' with a local function
Ben Franksen <ben.franksen at online.de>**20180828091242
 Ignore-this: bed0e8761895410a5423d96dea0488ba
] 
[add comment to explain how treeDiff handles file vs. subtree removals
Ben Franksen <ben.franksen at online.de>**20180826172551
 Ignore-this: ad166f87bcfc6d37901a7f7ed1844cea
] 
[consistent naming for "working tree"
raichoo at googlemail.com**20180716163939
 Ignore-this: c2ad7855940a5d4b1f96039b5c2913e2
] 
[avoid warning in D.R.State on non-Windows OS
Ben Franksen <ben.franksen at online.de>**20180825084425
 Ignore-this: ae818ac8646082bbfd4cd1c172e3455
] 
[tightened repo witnesses to demand wR~wT for more functions in in D.R.State
Ben Franksen <ben.franksen at online.de>**20180825091243
 Ignore-this: e3eff4f91c0ee52fa8d075b481d67531
 
 This started out with readPending and propagates to
 readPendingAndMovesAndUnrecorded, readUnrecorded, readUnrecordedFiltered,
 readRecordedAndPending, readIndex, updateIndex, getMoves. Requires a small
 code change in finalizeRepositoryChanges and a corresponding tightening in
 D.R.Repair.checkIndex.
] 
[fix docs for finalizeRepositoryChanges
Ben Franksen <ben.franksen at online.de>**20180825090512
 Ignore-this: a8c0fc990ce726cd171893832e88d935
] 
[fix and simplify checkUnrecordedConflicts and then inline
Ben Franksen <ben.franksen at online.de>**20180722122446
 Ignore-this: 62da36f754c62647520b0cb1f2f0f592
 
 The implementation in checkUnrecordedConflicts really only checked for
 conflicts with pending, but we need to check for conflicts with pending and
 working; and the merge that gives us this information has already been
 calculated in tentativelyMergePatches: all new conflicts are contained in
 them'' and new conflicts with pending and working are contained in pw'.
 
 Also, when tentativelyMergePatches is called by a remote apply (during
 execution of a push command), there is no interactive stdin, so promptYorn
 throws an exception, which is now cought. This fixes an existing bug that
 was hidden because the prompting happened only for conflicts with the remote
 pending, whereas it now happens for all conflicts with unrecorded changes.
] 
[in D.R.Resolution, throw an error if cleanly merging conflict resolutions fails
Ben Franksen <ben.franksen at online.de>**20180604154921
 Ignore-this: aeae746a8b3a681d6bd1acd2d330ed4
 
 This is clearly an internal error and should be handled as such. It was
 previously ignored by silently dropping the patch that could not be merged.
] 
[fix: must not siftForPending in revertPending
Ben Franksen <ben.franksen at online.de>**20180719171004
 Ignore-this: 53c02a5e44597eb90b772b7c9debc32d
 
 The reason is that we want the checks that attempt to apply pending to
 pristine to fail as early as possible and also consistently regardless of
 whether we are in a transaction or not. If we siftForPending with a buggy
 pending such as constructed in tests/pending_has_conflicts.sh applyToTree no
 longer fails.
] 
[no longer lie about repo witnesses
Ben Franksen <ben.franksen at online.de>**20180719170744
 Ignore-this: b689ab3e73b43e13977bb157669aa3b2
 
 In particular, this means that most of the procedures in D.R.State now
 require that the recorded and the tentative state coincide, so that reading
 the recorded state is justified even if we are in a "transaction" i.e.
 revertRepositoryChanges has been called (via withRepoLock). Also,
 finalizeRepositoryChanges now returns a properly casted Repository.
 
 We now track the Repository token using a single local variable that gets
 shadowed by each successive "update". This makes it impossible to
 accidentally use an old version. To avoid warnings, these variables are
 prefixed with an underscore.
] 
[simplify readRecorded and readPending
Ben Franksen <ben.franksen at online.de>**20180619204359
 Ignore-this: 1ffe804603dc34fc1793c3cc8638d173
 
 ...using peekPristineHash and the new D.R.Paths module.
] 
[define repo paths in a separate module
Ben Franksen <ben.franksen at online.de>**20180619203930
 Ignore-this: 4096a66894bd124171161508c4c1fa6c
] 
[move applyToTentativePristine to before repo changes
Ben Franksen <ben.franksen at online.de>**20180702131930
 Ignore-this: 5695f7a39381cf488c7054687bf2fcdf
 
 This is pure code aesthetics. The call gets the original r (Repository)
 passed, so it looks better if we make it before we call the functions that
 return the new (coerced) Repository.
] 
[explain how tentativelyMergePatches works
Ben Franksen <ben.franksen at online.de>**20180702131923
 Ignore-this: 29c052902fade67f56b241acf4dc63a0
 
 This patch also renames a few local variables in this function.
] 
[resolve issue2592: update pending with coalesced look-for changes
Ben Franksen <ben.franksen at online.de>**20180702163803
 Ignore-this: 433b715f2787c1199c4309581eb1ea36
] 
[simplified setTentativePending and fix its type witnesses
Ben Franksen <ben.franksen at online.de>**20180702145112
 Ignore-this: a20b32a92265091a1d81c9d963949cd1
] 
[make D.R.Pending.prepend more type safe (by removing it)
Ben Franksen <ben.franksen at online.de>**20180702145101
 Ignore-this: 4dd145953c7168603ca8a3694c9109ec
 
 This function coerced witnesses and had corresponding warnings attached. The
 need for coercing was that it reads the pending patch and also writes it
 back with some changes that were removed from the repo prepended. If we
 split this action up and read pending before adding the patches to the repo
 and afterwards write the pending, then the witnesses all match up just fine.
 This requires removeFromTentativeInventory to return a repo with
 appropriately coerced witnesses.
 The cost of this operation is that we must export read/writeTentativePending.
] 
[fix handling of pending patch in amend command
Ben Franksen <ben.franksen at online.de>**20180702134008
 Ignore-this: 4f95452e8c4bdc28cd3ed20be14f0035
 
 In case of look-for-moves/replaces, the code called
 tentativelyRemoveFromPending on the old patch. This was done after
 tentativelyRemovePatch and tentativelyAddPatch had already adapted the
 pending patch (via YesUpdatePending). This is clearly wrong and worked only
 because tentativelyRemovePatches called prepend, which pre-filtered the new
 prim patches with crudeSift. This is no longer done, and so we now get
 failures when we try to apply pending.
 
 The clean solution is to pass NoUpdatePending to both tentativelyRemovePatch
 and tentativelyAddPatch and then adapt pending in one go with the difference
 between old and new patch. The function tentativelyRemoveFromPending now
 takes an FL of prim patches, has more correct type witnesses, uses less
 coercion, and has its UpdatePending parameter removed.
 
 This restores the regression of issue2209-look_for_replaces after the fix
 for issue2548-inconsistent-pending. It also makes the previously failing
 test look_for_replaces1 succeed.
] 
[accept issue2592: unclean pending with look-for options
Ben Franksen <ben.franksen at online.de>**20180618190530
 Ignore-this: 7d3d1d113694143bde626d0d8ed3a5ed
] 
[remove UpdatePending parameter from tentativelyAddToPending
Ben Franksen <ben.franksen at online.de>**20180702143403
 Ignore-this: 49e37e39bbac54cfdff71900c3a6416a
 
 All call sites passed YesUpdatePending, literally.
] 
[add revertPending to complement finalizePending
Ben Franksen <ben.franksen at online.de>**20180702141814
 Ignore-this: b9175e36e417254dede371d6573c6dcf
] 
[removed UpdatePending parameter from a few functions
Ben Franksen <ben.franksen at online.de>**20180702131536
 Ignore-this: 137a392994f408bcd843ce4deb5b0487
 
 Affected are setTentativePending, prepend, the functions in D.R.Merge,
 addToPending, and addPendingDiffToPending. The parameter could be removed
 because either all call sites passed YesUpdatePending (literally), or the
 same or closely related case distinction was already done at the call site.
] 
[rename UpdateWorking to UpdatePending
Ben Franksen <ben.franksen at online.de>**20180702131409
 Ignore-this: b32c179994ff299dfc1598bab875b454
 
 The name of this type (and the parameter names) now reflect what it does,
 namely configure for certain calls whether the pending patch should be
 updated or not.
] 
[remove writePatchSet and patchSetToRepository from D.R.Clone
Ben Franksen <ben.franksen at online.de>**20180610151003
 Ignore-this: a6c059b9450839f7ac46f0524f93e4dd
 
 patchSetToRepository was already commented out and writePatchSet was used
 only in D.UI.Commands.Repair, where the relevant parts are now inlined. Also
 did some refactorings there while we're at it.
] 
[move filterNonInternal from tag command to D.P.Match
Ben Franksen <ben.franksen at online.de>**20180611173502
 Ignore-this: ad9429c268fdb84055c681e4500accfc
] 
[move matchingHead to D.P.Match, move contextPatches to D.P.Depends
Ben Franksen <ben.franksen at online.de>**20180611171139
 Ignore-this: d9560cc892e65e5a2ac6244df9bbc6d5
] 
[simplify return type of splitOnTag
Ben Franksen <ben.franksen at online.de>**20180611102459
 Ignore-this: a724190d1f45336cd4e538377a3e5a87
 
 Instead of returning a PatchSet with an empty trailing list of patches plus
 trailing patches separately, we as well return just a PatchSet and put the
 trailig patches back.
] 
[refactor matching of PatchSets
Ben Franksen <ben.franksen at online.de>**20180609222350
 Ignore-this: 8263b213cb129ade39454183349f9361
 
 This affects the commands annotate, clone, diff, dist, show contents, and
 show files. For these, selecting a single patch or a range of patches makes
 no sense; instead matching means to select the version (PatchSet) consisting
 of all patches up to (including) the latest matching patch, except for --tag
 where we get the exact version corresponding to the tag.
 
 The functions findAPatch and matchPatch and the data type
 InclusiveOrExclusive are now obsolete have been removed. Other functions are
 superseded: getPatchesBeyondTag is replaced by the more general
 splitOnMatchingTag; getTagS and getMatcherS have been inlined into
 getNonrangeMatchS, which has been renamed to rollbackToPatchSetMatch;
 havePatchsetMatch is replaced by patchSetMatch. The new data type
 PatchSetMatch precisely captures the different ways to match a PatchSet;
 patchSetMatch returns it and rollbackToPatchSetMatch and getOnePatchSet take
 it as argument. Also, getNonrangeMatch is now called getRecordedUpToMatch,
 and dropn is renamed to patchSetDrop and exported.
 
 There are now separate DarcsFlags and MatchFlags for --index=N (OneIndex)
 versus --index=N-M (MatchIndexRange), which streamlines index matching.
] 
[make spanRL lazy, add takeWhileRL
Ben Franksen <ben.franksen at online.de>**20180609222232
 Ignore-this: 4bd05d0fc5146aac6be7934056d18716
] 
[inlined a where clause in splitOnTag
Ben Franksen <ben.franksen at online.de>**20180609221946
 Ignore-this: df78934f07e25f690a9839073f96d1ef
] 
[simplify D.P.Match.matchExists
Ben Franksen <ben.franksen at online.de>**20180609142356
 Ignore-this: 6b66004d0117c5256a30f5defbfa22f5
] 
[removed unsused (incl. darcsden) function getFirstMatchS
Ben Franksen <ben.franksen at online.de>**20180609121825
 Ignore-this: 1dc69395d33727eaaab76ed6525102c4
] 
[simplify D.R.Hashed.reorderInventory
Ben Franksen <ben.franksen at online.de>**20180608093343
 Ignore-this: 2d59b83971455f2f76a51fddc48028dc
 
 This gets rid of the last use of tentativelyReplacePatches which has been
 removed. Instead of removing patches from the repo and then adding them
 back, we directly write the new patchset. tentativelyReplacePatches filtered
 out the rebase patch from the patches it removes. This was brittle and also
 unnecessary: we can assume the rebase patch is not covered by any tag and
 thus automatically belongs to the untagged tail of patches.
 
 Finding the latest tag and cleaning it is now optimized by using the new
 utility function breakRL. This avoids searching for the latest tag twice
 (first in misplacedPatches and then again in splitOnTag). The fused
 functionality is now in function D.P.Depends.cleanLatestTag.
 
 The test for darcs optimize has been enhanced to actually test that optimize
 reorder does what it should.
] 
[add class PrimSift so we can avoid using PrimConstruct and PrimClassify in Pending
Ben Franksen <ben.franksen at online.de>**20180505065806
 Ignore-this: a236357241048ec8e0eb26a99250bedb
] 
[move tryShrinkingInverse to D.P.Invert, rename to dropInverses
Ben Franksen <ben.franksen at online.de>**20180301225601
 Ignore-this: 8dc5633d478d66135dfa2f36898edc7f
 
 The function is defined solely in terms of Invert and Eq2.
] 
[remove commuteFLorComplain and replace with commuteFL
Ben Franksen <ben.franksen at online.de>**20180516074050
 Ignore-this: 22c884f446084a9a87abe9175db1e817
 
 The extra information provided by commuteFLorComplain was nowhere used.
] 
[respect verbosity options in amend command
Ben Franksen <ben.franksen at online.de>**20180713170751
 Ignore-this: 47054467ad82cadc305e6373154d11db
] 
[add/change some comments in optimize upgrade command
Ben Franksen <ben.franksen at online.de>**20180612174221
 Ignore-this: 2411d122f587c7d49a9b12f38f1ce182
] 
[export getPrefLines for darcsden
Ben Franksen <ben.franksen at online.de>**20180609112943
 Ignore-this: b5c24b98188f95c845c680e418c889de
] 
[use +<<+ in D.P.Set.appendPSFL
Ben Franksen <ben.franksen at online.de>**20180608120457
 Ignore-this: 932a5ac2ba0aa305746698d9212ffe85
] 
[remove method anIdentity from PrimConstruct
Ben Franksen <ben.franksen at online.de>**20180501154124
 Ignore-this: 2a4afd0048567d73c35245274c286ec7
 
 This method was used only in the test harness to extract pairs and triples
 of adjacent patches from an arbitrary patch tree, in case the tree does not
 contain enough patches. Rather than conjuring meaningless patches out of
 thin air, a better solution is to reject starting states with not enough
 patches. Along the way, some unused functions and instances in the test
 harness were deleted.
] 
[add laws to classes Commute and CommuteNoConflicts
Ben Franksen <ben.franksen at online.de>**20180607195130
 Ignore-this: 9b2be35019e7b0210db0eaaf4a85f4a1
] 
[replace naturalMerge with mergeNoConflicts
Ben Franksen <ben.franksen at online.de>**20180607181432
 Ignore-this: 7a4b0793074bb3be28a8693100d2978b
 
 This change is a consequence of my improved understanding of what
 commuteNoConflicts is about and how non-conflicting merge should work, see
 the haddocks for details. The new function is also more efficient because
 (a) commuteNoConflicts has to consider fewer cases and (b) we can now drop
 the extra commute check on the result of the merge.
] 
[in D.P.V1.Commute, remove commuteNoMerger and replace with commuteNoConflicts
Ben Franksen <ben.franksen at online.de>**20180604154812
 Ignore-this: 52691e31f7822683c67d1768a94bcbe4
] 
[simplify V1 merge by calculating both branches in one go
Ben Franksen <ben.franksen at online.de>**20180530163134
 Ignore-this: ba1d3de13df7724f5aeec898e8cb5915
] 
[factor swapMerge from D.P.V2.RepoPatch to D.P.Merge
Ben Franksen <ben.franksen at online.de>**20180530163032
 Ignore-this: 4492404a94fe2704aad86c0fdded992c
] 
[refactor the instance Commute RepoPatchV2
Ben Franksen <ben.franksen at online.de>**20180529130151
 Ignore-this: e58fe2aad17250793d1f4b38e9fbbb90
 
 To avoid repeated calls to commuteNoConflicts in cases where we know it will
 fail, add commuteConflicting as a separate top-level function. Also factor
 out invertCommuter which is now used for both commuteConflicting and
 commuteNoConflicts.
] 
[improved haddocks for CommuteNoConflicts
Ben Franksen <ben.franksen at online.de>**20180529125540
 Ignore-this: 66fd77d34e106b6edd693193e9e02771
] 
[remove out-commented code line from mangleUnravelledHunks
Ben Franksen <ben.franksen at online.de>**20180426071255
 Ignore-this: 7116db02cb6ab3b75b392aafbdbcbec
] 
[add haddocks for D.P.Conflict.IsConflictedPrim
Ben Franksen <ben.franksen at online.de>**20180426071209
 Ignore-this: 1c66041eff309d484cfbbb3ead0d2867
] 
[rename 'conflictedEffect' to 'isConflicted'
Ben Franksen <ben.franksen at online.de>**20180426070037
 Ignore-this: 59ea355b5af257a5be76236361107be0
 
 This function (class method) is used to classify patches and has nothing to
 do with the effect of a patch.
] 
[apply hunks for the same file in one go for V2, too
Ben Franksen <ben.franksen at online.de>**20180216111952
 Ignore-this: 6cf6e1421a30221c95762a02f0869f09
 
 It seems this optimization was never done for RepoPatchV2.
] 
[support containers 0.6.x
Ganesh Sittampalam <ganesh at earth.li>**20180622115811
 Ignore-this: cec9331750943804a68430ff5d177321
] 
[fix issue1857 test on Windows
Ganesh Sittampalam <ganesh at earth.li>**20180610184054
 Ignore-this: 6fc9b0a9ee752b0e615cbe82fef20776
] 
[support QuickCheck 2.11
Ganesh Sittampalam <ganesh at earth.li>**20180609153034
 Ignore-this: 13b7a0fa536221ade5575148670d8b7c
] 
[TAG 2.14.0
Guillaume Hoffmann <guillaumh at gmail.com>**20180404143457
 Ignore-this: b65f09f1e7a78e00ba98e63108be2833
] 
Patch bundle hash:
215d5b60814cbd5ce2b3f69a3cb6dfb4f0947a3e


More information about the darcs-devel mailing list