Could we test during upload if files on remote server changed since last upload?
While developing a website there are often occasions when direct modification of file on web server is needed. The problem is that there is no easy way of integrating this changes back into repository.
I made simple bash script for this purpose:
#!/bin/bash
ftp="ftp://user:<email address hidden>
# creating new branch for importing changes from remote copy
bzr ignore .remote
bzr commit -m "Added directory named .remote to ignores";
bzr branch --hardlink . .remote
# downloading remote changes
cd .remote
lftp $ftp -e 'mirror -n -v -x \.bzr-upload.revid -x \.bzrignore; quit'
# commiting them to created branch
bzr commit -m "files changed directly on ftp server"
cd ..
# merging branches
bzr merge .remote
# resolving conflicts
if [ -n "`bzr conflicts | grep -v 'Text conflict in '`" ]
then
echo "There are some non-text conflicts, please resolve them manualy. After resolving please run this script once again.";
exit;
fi
# resolve text conflicts using kdiff3 tool
for file in `bzr conflicts | awk 'BEGIN { ORS="\0"; } /^Text conflict in / { print $4; }'`;
do
kdiff3 $file.BASE $file.THIS $file.OTHER -o $file
[ -f $file.orig ] && rm $file.* && bzr resolve $file
done;
if [ -z "`bzr conflicts`" ]
then
# commiting result of a merge to working branch
bzr commit -m "remote changes merged with local changes"
# uploading result of a merge to remote server
bzr upload $ftp
# ensure that .remote branch is up to date
cd .remote
rsync ../* ./ --exclude '.bzr' --exclude '.bzrignore' --exclude '.remote'
bzr commit -m "remote changes merged with localchanges"
# touch files hoping lftp mirror will download less files next time
find -print0 | xargs -0 touch
cd ..
fi;
It's far from optimal solution. It's way too noisy, and unnecessarily downloads some files from ftp.
Perhaps you could extend upload plugin with such functionality?
Or create another plugin supporting such workflow?
Question information
- Language:
- English Edit question
- Status:
- Answered
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Kamil Szot for more information if necessary.