Suppose I have: DirectoryA - contains a PHP web application, unchanged, exactly as downloaded DirectoryA2 - contains a customised version of DirectoryA
DirectoryB - contains a new version of the PHP web application
I want to merge the changes that represent DirectoryA -> DirectoryA2, into DirectoryB to create DirectoryB2.
This seems to me the sort of thing that diff can do in its sleep but my past attempts have failed. It also probably points at some kind of version control solution, although there is no version control in place at the moment (if this is a good time to implement it then I'm all ears!) I don't expect this to be completely automated, but I believe and expect that using the right tools I can substantially improve the job from the starting point of comparing individual files manually.
I have so far got as far as diff --brief -r DirectoryA DirectoryA2
[If specifics help, DirectoryA is version 1.3.8a of ZenCart, DirectoryB is version 1.3.9f of ZenCart, and DirectoryA1 is a site built on version 1.3.8a of ZenCart, but with obvious changes (changes to stylesheets, new images, new plugins, etc). From a practical point of view, DirectoryA2 is mostly a superset of DirectoryA (new product images, plugins, templates, etc) but there are customisations (usually fairly trivial ones) to core files, and there will be a number of files from DirectoryA that were deleted (installation files, docs, etc). There would also be some file and directory permission changes.]
Mark Rogers wrote:
I want to merge the changes that represent DirectoryA -> DirectoryA2, into DirectoryB to create DirectoryB2.
This seems to me the sort of thing that diff can do in its sleep but my past attempts have failed. It also probably points at some kind of version control solution, although there is no version control in place at the moment (if this is a good time to implement it then I'm all ears!) I don't expect this to be completely automated, but I believe and expect that using the right tools I can substantially improve the job from the starting point of comparing individual files manually.
Two obvious options:
No version control: use a tool that offers "Merge Directories with Ancestor..." where A is the ancestor of both A2 and B, saving to B2. Emacs has one, vimdiff might too but I've not checked. You could do it with diff and patch and fixing files up manually based on .rej files, but why make it hard?
Adding version control: commit A, make new branch, copy A2 over the working copy (A) and commit, return to master branch (so making the working copy A again), copy B over the working copy (A) and commit, return to new branch (which is A2) and merge master (which changed from A to B since the branch point) onto it, resulting in your B2. That's with git but similar concepts probably work with others.
I've done both of these many times. I feel adding version control is usually worth the small extra time. My co-op can be hired ;-)
Regards,
On 03/09/10 12:46, MJ Ray wrote:
I've done both of these many times. I feel adding version control is usually worth the small extra time.
Thanks for the suggestions, I think it's time I got my head around git!
My co-op can be hired ;-)
Maybe you should email me your rates offlist, and we'll see what happens!
On 03/09/10 12:46, MJ Ray wrote:
Adding version control: commit A, make new branch, copy A2 over the working copy (A) and commit, return to master branch (so making the working copy A again), copy B over the working copy (A) and commit, return to new branch (which is A2) and merge master (which changed from A to B since the branch point) onto it, resulting in your B2. That's with git but similar concepts probably work with others.
OK, so I have done this but I'm not sure I have got everything right - ZenCart's own sanity checks don't seem to think I'm running the version I think I'm running.
Can you (or anyone else!) sanity check what I did so I can rule out the git merge side of things?
cp -a /path/to/zencart/zen-cart-v1.3.8a-full-fileset-12112007 htdocs git init git add . git commit -m'ZenCart 1.3.8a'
git checkout -b "MySite138a" master rm -rf htdocs cp -a /path/to/mysite/htdocs . git add . git commit -a -m'MySite 1.3.8a'
git checkout master rm -rf htdocs cp -a /path/to/zencart/zen-cart-v1.3.9f-full-fileset-08142010 htdocs git add . git commit -a -m'ZenCart 1.3.9f'
git checkout MySite138a git merge master git add . git commit -a -m'MySite 1.3.9f'
Update: I've resolved the problem I was having (a config file was still pointing to the old site directory so all my included files were coming from the old 1.3.8a site, doh!).
All the same, if anyone can sanity check the steps I took I'd appreciate it. I don't really understand why I needed "git add" and "git commit -a" at each step, for a start.
PS: Apologies to MJR, I messed up the to/cc on the last email. Thunderbird no longer recognises my list email now it goes through an Exchange server, grrr....