While working on the FileImporter extension I add an integration test that simulates the import of a file with two text- and two file-revisions using the complete core chain behind these operations. 
The test fails when I run it locally because it seems to be executed quite fast and it runs into a name conflict in the LocalFile.php.  The CI seems to be to slow so it does not occur there, but another colleague had the same problems locally.
I tried to fix the issue because one code path calling publishTo comes from uploadOld in OldLocalFile.php and there we already have a archive name that could be used ( and that does not collide with a current timestamp ) but this then leads to a different naming conflict deeper down in FileRepo with the copy and store operations. - That's where my brain stopped working and I thought it might be better putting this into a ticket.
So some questions:
- Do we need to generate these archive names there?
- Why does it seem we can't take the existing archive name there?
- I don't get the difference between store and copy in the FileRepo why does every file triggers both?
- Any ideas how to fix this?