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

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

Other diffs: Previous Major Revision, Previous Author

Newer page: version 3 Last edited on Monday, 1 February 2010 4:53:31 by CyberLeo Revert
Older page: version 2 Last edited on Monday, 1 February 2010 1:52:59 by CyberLeo Revert
@@ -7,22 +7,25 @@
 <code brush="bash"> 
 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 
+ if [ -e "${file}" -a -e "/${file}" ]  
+ then  
+ # 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 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 
+ # 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 
+ # Make sure the changed line is the FreeBSD CVS tag  
+ cvstag="$(echo "${diff}" | grep -c '$FreeBSD: ')"  
+ [ "${cvstag}" -ne 1 ] && continue  
+ fi  
  
  mv -vf "${file}" "/${file}" 
 done 
 </code> 

version 3

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 "/${file}" ]
  then
    # 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
  fi

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