return mlistA;
  public MergeList mergeLists( MergeList mlistA, MergeList mlistB ) {    boolean __followAonly = false; // Special var, that when set causes merge to only follow A                                    // used for quick'n'dirty conflict resolution    MergeList merged = new MergeList(mlistA.getEntryParent());    mergeDeletedOrMoved( mlistA, mlistB );// LATER      mergeDeletedOrMovedOut( docA, docB, mlistA, mlistB, docBMatching );/*    System.out.println("A list (after delormove):");    mlistA.print();    System.out.println("B list (after delormove):");    mlistB.print();*/    // Now we should have exactly the same entries in mlistA and mlistB    // quick check    if( mlistA.getEntryCount() != mlistB.getEntryCount() )        throw new RuntimeException("ASSERTION FAILED: MergeList.merge(): lists different lengths!");    // So let's do the merge    // Some things to prove:    // No node can get "skipped" (deleted)    // No node gets extra copies    // Sequencing isn't violated if merge is successful    int posA = 0, posB = 0, nextA=-1,nextB=-1;    while(true) {      // pos is set up so that ea and eb are merge-partners      MergeEntry ea = mlistA.getEntry(posA), eb= mlistB.getEntry(posB);//        MergeEntry chosenEn=ea,otherEn=eb;      merged.add( ea );      ea.setMergePartner(eb.getNode());      // Hangon nodes      if( eb.getHangonCount() > 0 ) {        boolean hangonsAreEqual = false;        if( ea.getHangonCount() > 0 ) {          // Check if the hangons match _exactly_ (no inserts, and exactly same sequence of copies)          // Then we can include the hangons just once. This resembles the case when content of          // two nodes has been updated the same way... not a conflict, but maybe suspicious          if( eb.getHangonCount() == ea.getHangonCount() ) {            hangonsAreEqual = true;            for(int i=0;hangonsAreEqual && i<ea.getHangonCount();i++)              hangonsAreEqual = matches( eb.getHangon(i).getNode(),  ea.getHangon(i).getNode() );          }          // Both have hangons,          // add CONFLICTCODE here          // for now, chain A and B hangons          if( hangonsAreEqual )            System.out.println("CONFLICTW; both nodes have hangons, but they were equal"); // as updated(or A if no update)-Other");          else            System.out.println("CONFLICTW; both nodes have hangons; sequencing them"); // as updated(or A if no update)-Other");/*          System.out.println("First list:");          mlistA.print();          System.out.println("Second list:");          mlistB.print();*/        }        if( !hangonsAreEqual ) {          for( int i=0;i<eb.inserts.size();i++)            ea.inserts.add( eb.inserts.elementAt(i) );        }      }      // See if we're done      if( ea.node == END || eb.node == END ) {        if( ea.node != eb.node )          throw new RuntimeException("ASSERTION FAILED: Merge.mergeLists(). Both cursors not at end");        break;      }      // figure out the next one      nextA = ea.locked && mlistA.getEntry(posA+1).locked ? posA + 1 : -1; // -1 means free      if( __followAonly )        nextB = -1;      else        nextB = eb.locked && mlistB.getEntry(posB+1).locked ? posB + 1 : -1;      if( nextA == -1 && nextB == -1 ) { // No locking, just let both go forward        nextA = posA + 1;        nextB = posB + 1;      }      if( nextB == -1 )        nextB = mlistB.findPartner(mlistA.getEntry(nextA));   /// getPartnerPos( mlistA.getEntry(nextA), mlistB, docB, docBMatching );      else if (nextA == -1 )        nextA = mlistA.findPartner(mlistB.getEntry(nextB)); ///getPartnerPos( mlistB.getEntry(nextB), mlistA, docA, this );      else if (nextB != mlistB.findPartner(mlistA.getEntry(nextA))) { //           getPartnerPos( mlistA.getEntry(nextA), mlistB, docB, docBMatching ) ) {        // add CONFLICTCODE here        // This part is especially troublesome, as just using the sequencing of A may get us into        // and infinite loop! (m5 rev 1.1!)        // for now, follow sequencing of mlist A        System.out.println("CONFLICT: Sequencing conflict, using only one list's sequencing");        __followAonly = true;        nextB = mlistB.findPartner(mlistA.getEntry(nextA)); ///getPartnerPos( mlistA.getEntry(nextA), mlistB, docB, docBMatching);        //return mlistA;      }      posA = nextA;      posB = nextB;    }/*    System.out.println("Merged list:");    merged.print();*/    return merged;  }