anchor.diff:  
                           let anc = findCommonAncestor s w.History
   
  +
  +                        let changesOnMyBranch = changeFromTo anc w.History
  +
  +                        let conflictTable = Dictionary<obj, Op>()
  +                        changesOnMyBranch |> Change.iter (fun o ->
  +                            conflictTable.[o.Target] <- o
  +                        )
  +
                           // TODO: check for conflicts
  -                        let ops = 
  +                        let mergeRes, change = 
                               transact (fun () ->
  -                                forwardCollectOps w anc s
  +                                forwardMerge w conflictTable anc s
                               )
   
  -
  -                        let commit =
  -                            {
  -                                hash = Guid.NewGuid()
  -                                ops = ops
  -                                message = sprintf "Merge branch %s into %s" source w.Branch
  -                                author = Environment.UserName
  -                                date = DateTime.UtcNow
  -                                mergeSource = Some(source, s)
  -                            }
  -
  -                        let newHistory = Commit(w.History, commit)
  -
  -                        w.History <- newHistory
  -                        w.LocalModifications <- NoChange
  -                        w.Branches.[w.Branch] <- newHistory
  +                        match mergeRes with
  +                            | Success ->
  +
  +                                let commit =
  +                                    {
  +                                        hash = Guid.NewGuid()
  +                                        ops = Change.toList change
  +                                        message = sprintf "Merge branch %s into %s" source w.Branch
  +                                        author = Environment.UserName
  +                                        date = DateTime.UtcNow
  +                                        mergeSource = Some(source, s)
  +                                    }
  +
  +                                let newHistory = Commit(w.History, commit)
  +
  +                                w.History <- newHistory
  +                                w.LocalModifications <- NoChange
  +                                w.Branches.[w.Branch] <- newHistory
  +                            | Conflicts l ->
  +                                Log.warn "merge conflict"
  +                                for (l,r) in l do
  +                                    Log.warn "    conflicting assignments: {%A} vs {%A}" l r
   
                       | _ ->
                           Log.warn "could not find branch %A" source
               else
                   Log.warn "cannot merge when having local modifications"
   
  +    let log (w : WorkingCopy) =
  +        let rec log (h : History) =
  +            seq {
  +                match h with
  +                    | Empty -> ()
  +                    | Commit(b, commit) ->
  +                        yield commit
  +                        yield! log b
  +            }
  +
  +        log w.History
  +
   [<AutoOpen>]
   module WorkingCopyExtensions =
       
  
positive.code:                     | Empty ->
                          ()
          
          let rec forward (w : WorkingCopy) (current : History) (target : History) =
              if current != target then
                  match target with
  
negative.code:         git.merge "a10"
          print()
  
  
          git.checkout "a10"
          git.checkout "conflict"
          git.apply (PMod.change b 10)
          git.commit "sync"
          git.merge "b5"
          print()
  
          git.printLog()
  
          // and back to master
          git.checkout "master"
          print()
  