NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
avoid overwriting files when editing remotely


Joined: 06 Aug 2008
Posts: 4
Reply with quote
Hello,

Have an issue and interested if anyone here has a solution that will work with NuSphere.

In certain cases saving a change to a file "clobbers" changes made by others. Let me explain how this happens:

We use SVN for version control. Each developer has their own development instance on a shared server that pulls its source from the SVN repository.

Each developer uses NuSphere locally on their windows machine and edits using the remote SFTP Account method (expanding explorer tree, files are fetched on request and saved directly back to the server when saved). SVN updates and commits are done from the command line within the developer's dev instance.

The problem occurs when:

1) developer_1 opens a file, let's call it myFile.php
2) developer_2 checks in a change to myFile.php
3) developer_1 SVN updates their dev instance while keeping myFile.php open in NuSphere.
a) myFile.php in developer_1's dev instance now has developer_2's changes
b) myFile.php open in developer_1's NuSphere instance is still the pre-developer_2 change version
4) developer_1 saves changes to myFile.php via NuSphere
a) developer_1 has now overwritten the most-up-to-date version of myFile.php in their dev instance
5) developer_1 commits changes to myFile.php
a) developer_2's changes have now been "clobbered"
b) all future SVN updates will not have developer_2's changes

Some additional notes / ideas:

1) if NuSphere checked for difference / timestamp diffs when attempting to save it seems this would resolve the issue; but it does not in SFTP mode

2) using the NuSphere CVS/SVN client would resolve this but
a) how would you handle efficiently sync'ing w/the developers dev instance on the server (e.g., no jump-through-hoops to view a change)?
b) this introduces another layer of complexity, requiring each developer to have their own branch so changes are not automatically committed

3) use an NFS mount (SAMBA) so NuSphere treats the files as local files, supporting the "check if the file has been changed" capability

4) set a company policy that you do not SVN update with files open in your IDE
a) this is our current policy, not working Smile

thanks,
Ryan
View user's profileFind all posts by rjn13Send private message
Site Admin

Joined: 13 Jul 2003
Posts: 7901
Reply with quote
Ryan,

What you're asking about is how to use version control system. I think your question has no relation to the front-end IDE, because you can overwrite somebody's else changes using ANY products if you use them in a wrong way.

With vesion control system in place you have good opportunity to avoid file conflicts like the ones you've described, but it's possible only in the case if you use the system in a correct way. You can not avoid conflicts on the files shared among other deveopers if all update them themselves (asynchronously). Just do not do this and you'll get no conflicts. Let your Version Control system update the files and make sure it is the only source for the changes, does not matter the files are on the remote server or on the local one (what matters is the fact that the files are shared).

In other words, if you're working with other developers on the same set of remote files, do never use upload or download (do not save the files if you access them through Samba). Create a script on the server that will fetch the files from the repository and don't forget to update the repository with your changes beforehand.

Alternatively, do not work on the same set of files with the other developers. Have separated vhosts for each developer and fetch the changes made by the other develpers from the repository and do this only when you need these changes (mostly after they reported their chunk of the work is complete).

I believe you can easily find some other ways on how to get Version control sytem help you.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 06 Aug 2008
Posts: 4
Reply with quote
Thanks for the thorough reply Dmitri.

We are currently using a setup like you describe: SVN for version control, separate vhosts for each developer, each working off files checked out from the trunk. No file instances are shared (edited) between developers.

Is it possible for the SFTP mode of nusphere to check the server file on save to make sure it hasn't changed since the last access? That would at least tell the developer that they are about to overwrite changes made to the file stored on the server (e.g., if its was SVN updated while still being edited in the NuSphere client).

thanks!
View user's profileFind all posts by rjn13Send private message


Joined: 10 Feb 2007
Posts: 48
Reply with quote
It has been awhile, but I was working on a project that used WebDAV http://www.webdav.org/. I recall files had to be checked out, which meant that they could not accidentally be overwritten.
View user's profileFind all posts by StorymanSend private message


Joined: 06 Aug 2008
Posts: 4
Reply with quote
Hey Storyman,

That's one thing i was thinking about.. it looks like using WebDAV may perform the last update check to protect you from overwriting a file that has changed on the server. Anyone verify this / using the WebDAV method?

thanks,
Ryan
View user's profileFind all posts by rjn13Send private message


Joined: 10 Feb 2007
Posts: 48
Reply with quote
Hi Ryan,

I can tell you that I personally found it a pain in the you-know-where because a file had to be check out before it could be worked on, which also meant that if someone had checked out a file that I needed to work on--and hadn't checked it back in--I had to email them to ask them to check it back in ASAP.
View user's profileFind all posts by StorymanSend private message


Joined: 06 Aug 2008
Posts: 4
Reply with quote
Hi Storyman,

Yes, but was that a result of the source control model your company was using and not the use of Web-DAV vs SFTP vs other methods of shuttling files back and forth?
View user's profileFind all posts by rjn13Send private message
avoid overwriting files when editing remotely
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic