简体   繁体   中英

Compare kernel source and ignore win/linux permission in mercurial

Here is my steps to compare kernel code.

  1. Got a correct permission kernel code and store in src
  2. Put src in mercurial. (cd src ; hg init ; hg ci -A -m"")
  3. Copy windows guy's modification to src

Because the file permission in windows will always treated as 777. That shows almost all files have modified.

I've read this link , but I don't think it is a good method to solve this problem.

I wish there is a method to let me 'hg revert' the wrong permission files.

Here is my workable code reverting the status to original kernel source.

#!/bin/bash
find $(hg root) \( -type d -name .hg -prune \) \
  -o \( -type f -print \) | xargs chmod a-x                                                          
hg st -n -m | while read fname ; do
  v=`hg di --git $fname |head -2 | awk '/^old/{print $3;}'`
  case $v in
    100644) chmod 644 $fname;;
    100755) chmod 755 $fname;;
  esac
done

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM