Description of problem:
When pushing files to Zanata, the python client first removes *all* existing documents from the server. It should only delete the files which need to be removed, ie files which don't exist on the client.
Version-Release number of selected component (if applicable):
I make changes for publican push, the the python client only delete the files which don't exist on the client.
If user push a single file to server with 'publican push', i still require source folder and then python client could still check whether existing server files still exist on the client.
For software projects, it could be tricky, since most software project only have one pot file, this kind of compare between server and client is meaningless. We need to find a better way for that.
Please check commit 1bafce3 of devel branch of zanataclient.
So for doc projects, if the user pushes a single file, do you delete any other files?
For software projects, can't you request a list of files from the server, and delete all of them except the one which you are about to push? (Most of the time, there will only be one file, and it will have the same name, so you won't have to delete anything.)
No, if user push a single file for doc projects, i will not delete any other files, I still request a list of files from the server, and check if all of them are still on the client side, if not, i will delete it.
So basically, for doc projects, I will do this check before the publican push, whatever the content that user want to push: a single file or a folder of source file.
I modify the deleting files from server for software projects based on your suggestion, the changes are in commit 524508e of devel branch of zanataclient on github.
On version 1.3.1
Test case 1: (Passed)
For project AboutFedora, version f11
Assume project and version are created, and current work directory is in AboutFedora, and zanata.xml and zanata.ini are configured properly.
1. zanata push --project-type=podir
2. rm -f pot/Author_Group.pot
3. zanata push --project-type=podir
As expected, Author_Group is removed from zanata server
Test case 2: (Failed)
Continue from test case 1:
1. zanata push --project-type=podir About_Fedora.pot
About_Fedora.pot is update, other documents are not touched
Delete the Article_Info
Delete the Revision_History
Thanks for your testing, i just add a process for deleting files from server for project type is podir, the python client will request a list of files from the server, and check if all of them are still in the source folder, if not, the python client will delete it.
But please be careful the source folder, the python client will try to find po files under current first, if can not find anyone, then it will try pot folder. so if the python client find any pot file under current path, it will assume that source folder is *current path*.
And for deleting method, python client will get file list from server, and check if all of them are still in the *source folder*, if not, the python client will delete it from server.
So when you using 'zanata push --project-type=podir About_Fedora.pot', please make sure that About_Fedora.pot is in ./pot, and there is no pot file under current path, otherwise, if you push About_Fedora.pot from current path, the python client will still delete the file from server, since these file can not find under current path, but actually these files are in pot folder.
The commit 137c46e include the changes, please help me to verify it and hope you understand my meanings, if you find this change didn't meat your requirement, please let me know.
Ok, according to Sean's suggestion, if user pushing single file, python client will not check the files on server and delete them. please check commit 1ac731f for the changes.
Verified in current head (commit 7cff8ef6b60bea8981a0f62f35ac3d44f9f9390c).
Deletes missing files from server when pushing all files.
Does not delete missing files from server when pushing a single file.
James, please fill in the Fixed in Version (not a git commit ID; the next version of zanata-python-client will do). Then when the next release goes out, please mark it as CLOSED.
It is already fixed in 1.3.3 of zanata-python-client, so close it as CURRENTRELEASE