Note: You are viewing an old version of this page. View the current version.

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

Other diffs: Previous Major Revision, Previous Author

Newer page: version 2 Last edited on Monday, 1 February 2010 1:52:59 by CyberLeo Revert
Older page: version 1 Last edited on Monday, 19 October 2009 14:03:04 by CyberLeo Revert
@@ -1,9 +1,9 @@
 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 silently ignore the newly updated files 
+Rerun mergemaster, and it will ignore the newly updated files 
  
 <code brush="bash"> 
 cd /var/tmp/temproot 
 find . -type f | while read file 
@@ -22,7 +22,7 @@
  # Make sure the changed line is the FreeBSD CVS tag 
  cvstag="$(echo "${diff}" | grep -c '$FreeBSD: ')" 
  [ "${cvstag}" -ne 1 ] && continue 
  
- mv -v "${file}" "/${file}" 
+ mv -vf "${file}" "/${file}" 
 done 
 </code> 

version 2

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
  # Detect if there are any additions or deletions
  diff=$(diff -e "${file}" "/${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

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