Differences between version 5 and previous revision of KnowledgeBase/FreeBSD/merge-unchanged.sh.

Other diffs: Previous Major Revision, Previous Author

Newer page: version 5 Last edited on Saturday, 19 February 2011 21:57:00 by CyberLeo Revert
Older page: version 4 Last edited on Sunday, 6 June 2010 14:01:34 by CyberLeo Revert
@@ -1,4 +1,6 @@
+Alternately, just pass mergemaster the flags -U (auto-upgrade files that have not been user-modified) and -i (auto-install new files)  
+----  
 Run mergemaster to set up /var/tmp/temproot, then abort it before touching any files. 
  
 Run this against it, to install all files whose only change is their CVS ID 
  

version 5

Alternately, just pass mergemaster the flags -U (auto-upgrade files that have not been user-modified) and -i (auto-install new files)


Run mergemaster to set up /var/tmp/temproot, then abort it before touching any files.

Run this against it, to install all files whose only change is their CVS ID

Rerun mergemaster, and it will ignore the newly updated files

cd /var/tmp/temproot
find . -type f | while read file
do
  if [ -e "${file}" -a -e "${DESTDIR}/${file}" ]
  then
    # Detect if there are any additions or deletions
    diff=$(diff -e "${file}" "${DESTDIR}/${file}")
    [ $? -eq 0 ] && continue

    # Ignore files with additions or deletions
    echo "${diff}" | egrep -q '^[0-9]+[ad]$' && continue

    # Ignore files with more than one change
    changes="$(echo "${diff}" | egrep -c '^[0-9]+c$')"
    [ "${changes}" -ne 1 ] && continue

    # Make sure the changed line is the FreeBSD CVS tag
    cvstag="$(echo "${diff}" | grep -c '$FreeBSD: ')"
    [ "${cvstag}" -ne 1 ] && continue
  fi

  mv -vf "${file}" "${DESTDIR}/${file}"
done