anchor.diff:  -include_lib("eunit/include/eunit.hrl").
   
   -record(field,
  -        {name, fnum, type, multiplicity, opts}).
  +        {name, fnum, type, occurrence, opts}).
   
   decode_msg(MsgName, MsgDefs, Bin) ->
       Msg    = new_default_msg(MsgName, MsgDefs),
  
positive.code:     MsgDef = keyfetch(MsgName, MsgDefs),
      {MsgName,
       lists:foldl(
         fun(#field{name=FName, multiplicity=repeated}, AccFields) ->
                 PrevSeq = keyfetch(FName, AccFields),
                 NewSeq = keyfetch(FName, NewFields),
                 replace_field(FName, append_seqs(PrevSeq, NewSeq), AccFields);
  
negative.code:     %% http://code.google.com/apis/protocolbuffers/docs/encoding.html
      NewFields =
          case FieldDef of
              #field{name = FName, occurrence = required, type={msg,FMsgName}}->
                  merge_field(FName, Value, Fields, FMsgName, MsgDefs);
              #field{name = FName, occurrence = optional, type={msg,FMsgName}}->
                  merge_field(FName, Value, Fields, FMsgName, MsgDefs);
              #field{name = FName, occurrence = required}->
                  replace_field(FName, Value, Fields);
              #field{name = FName, occurrence = optional}->
                  replace_field(FName, Value, Fields);
              #field{name = FName, occurrence = repeated} ->
                  append_to_field(FName, Value, Fields)
          end,
      decode_field(MsgDef, MsgDefs, Rest, {MsgName, NewFields}).
  