Hi,
Does anyone know how I can diff files on my local machine and a remote server accessible only via FTP? The problem I have is that my client doesn't have any kind of CVS and I have to do all my development on my local machine before uploading it to their test server, then if everything works OK I have to do the same thing with their live server. A bonus feature(?) of this arrangement is that one of their other developers only works on the live site and never updates the test server with his changes, so I can't automatically overwrite the files on both servers in case I overwrite some of his code. This isn't strictly a Linux question because I'm using OS X, but if there's any Un*x/Linux software available I should be able to compile it.
Thanks in advance,
Mecha Godzilla
diff over FTP
Moderator: General Moderators
- mecha_godzilla
- Forum Contributor
- Posts: 375
- Joined: Wed Apr 14, 2010 4:45 pm
- Location: UK
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: diff over FTP
Have you tried rsync? That is the standard solution for *nix. I use is all the time.
(#10850)
- mecha_godzilla
- Forum Contributor
- Posts: 375
- Joined: Wed Apr 14, 2010 4:45 pm
- Location: UK
Re: diff over FTP
Thanks - I'll look into that. I think rdiff might be closer to what I want because what I need to be able to do is see whether or not any changes have been made to the files on the remote server before I overwrite them, so that I can sync my local copy of the files before I overwrite the copies on the live server. If rsync or rdiff can compare the file checksums and ask me whether I want the files overwritten that would probably work. What I was hoping for was a networked version of diff, so maybe I could do something like
diff /htdocs/my_web_site/my_script.php ftp://username:password@www.mydomain.com/my_script.php
and diff would go and get the file on the remote server for me. Maybe I could do what I want using PHP - loop through all the files and retrieve them via FTP, then pipe the output to diff. Not exactly optimal but it might work.
M_G
diff /htdocs/my_web_site/my_script.php ftp://username:password@www.mydomain.com/my_script.php
and diff would go and get the file on the remote server for me. Maybe I could do what I want using PHP - loop through all the files and retrieve them via FTP, then pipe the output to diff. Not exactly optimal but it might work.
M_G
Re: diff over FTP
Still thinking this through, but what if you set up Git on your end (if you haven't already), rsync'ed the live environment to your local, and git diff locally. That would at least allow you to see their changes, merge them in, create a commit for the changes they've made (commit messages would be interesting...), and then add your new work on top. At least have commit history and the ability to revert changes available on one end and get diff in the process.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: diff over FTP
rsync had a -n dry run flag that will give you the same info (rdiff is not always installed standard). I agree with Celauran that you might want to look at your entire process and incorporate Git into it. There are some major benefits to using Git. You may even be able to use Git hooks to do the rsync part automatically.
(#10850)
- mecha_godzilla
- Forum Contributor
- Posts: 375
- Joined: Wed Apr 14, 2010 4:45 pm
- Location: UK
Re: diff over FTP
Thank you both for your suggestions. I haven't used rsync before so that's something I need to look at. I use Fossil for version control rather than Git but that's just because I found Fossil easier to get on with - I do have Git installed though. So, I guess I need to do some reading up and report back - thanks again for your help.
M_G
M_G