Bug 696474 - python client should only delete files from server which no longer exist on client
python client should only delete files from server which no longer exist on c...
Status: CLOSED CURRENTRELEASE
Product: Zanata
Classification: Community
Component: Component-PythonClient (Show other bugs)
unspecified
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: James Ni
David Mason
:
Depends On:
Blocks: zanata-1.5.0
  Show dependency treegraph
 
Reported: 2011-04-14 02:07 EDT by Sean Flanigan
Modified: 2012-03-06 20:33 EST (History)
2 users (show)

See Also:
Fixed In Version: 1.3.3
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-03-06 20:33:56 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Sean Flanigan 2011-04-14 02:07:19 EDT
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):
0:1.2.2-1.fc13
Comment 1 James Ni 2011-04-26 05:14:06 EDT
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.
Comment 2 Sean Flanigan 2011-05-02 21:24:13 EDT
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.)
Comment 3 James Ni 2011-05-02 22:14:44 EDT
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.
Comment 4 James Ni 2011-05-03 21:30:56 EDT
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.
Comment 5 Ding-Yi Chen 2011-10-19 00:20:34 EDT
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

Results:
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

Expected:
About_Fedora.pot is update, other documents are not touched

Actual:
zanata-python-client showed:
Delete the Article_Info

Delete the Revision_History
Comment 6 James Ni 2011-10-19 05:59:29 EDT
Hi Ding, 

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.
Comment 7 James Ni 2011-10-20 22:13:50 EDT
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.
Comment 8 David Mason 2012-02-21 20:43:29 EST
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.

See: https://github.com/zanata/zanata-python-client/commit/7cff8ef6b60bea8981a0f62f35ac3d44f9f9390c
Comment 9 Sean Flanigan 2012-03-06 19:15:55 EST
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.
Comment 10 James Ni 2012-03-06 20:33:56 EST
It is already fixed in 1.3.3 of zanata-python-client, so close it as CURRENTRELEASE

Note You need to log in before you can comment on or make changes to this bug.