[fix #188] Flush stack only when file changed

The view for the pair (peerId, filename) must be flushed whenever a
command applies to a new file, not everytime.
Flush it also in the end, not to forget any command.
Add unit test to check several commands

This checks that #188 is really fixed with the same peer sending 2
synchronization commands in one session with a delta on the same file.
Merge pull request #192 from satabin/fix/synchronization-188

Fix/synchronization 188