webrev: "hg copy" issue

Magnus Ihse Bursie magnus.ihse.bursie at oracle.com
Thu May 24 12:40:58 UTC 2018


The fix seems reasonable.

I'm not a formal reviewer (I think..?), and I'm not sure who are, but 
you have my blessing.

(Consider this also as a ping for the formal reviewers)

/Magnus

On 2018-04-16 19:22, Ichiroh Takiguchi wrote:
> Hello.
>
> It seems webrev.ksh (version: 25.16-hg+openjdk.java.net) treats "hg 
> copy" action
> like "hg move" action.
> Because of this issue, *.patch file had entry for file remove action.
> I'm not sure, it's well-known issue or not.
> Anyway, I created sample fix, please check it.
>
> Thanks,
> Ichiroh Takiguchi
>
> ===========================================
> --- webrev.ksh.orig    2018-04-13 15:01:18.000000000 +0900
> +++ webrev.ksh    2018-04-13 18:35:59.000000000 +0900
> @@ -1596,12 +1596,14 @@
>          fi
>          done
>      done < $FLIST.temp
> +    > $FLIST.clean.remove
>      hg status $STATUS_REV -rn | $FILTER > $FLIST.temp
>      while read RFILE; do
> -        grep "$RFILE" $FLIST >/dev/null
> +        egrep "^$RFILE\$| $RFILE\$" $FLIST >/dev/null
>          if [ $? -eq 1 ]; then
>          echo $RFILE >>$FLIST
>          fi
> +        echo $RFILE >>$FLIST.clean.remove
>      done < $FLIST.temp
>      rm -f $FLIST.temp
>      fi
> @@ -2313,11 +2315,18 @@
>      oldname=""
>      oldpath=""
>      rename=
> +    copy=
>      if [[ $# -eq 2 ]]; then
>          PP=$2            # old filename
>          oldname=" (was $PP)"
>          oldpath="$PP"
>          rename=1
> +        # if the file is renamed, file name should be in $FLIST.remove
> +        # if the file is copied, file name should not be in 
> $FLIST.rename
> +        grep "^$PP$" $FLIST.remove >/dev/null
> +        if [ $? -eq 1 ]; then
> +            copy=1
> +        fi
>              PDIR=${PP%/*}
>              if [[ $PDIR == $PP ]]; then
>              PDIR="."   # File at root of workspace
> @@ -2495,8 +2504,10 @@
>                        diff -u $ofile $nfile > $WDIR/$DIR/$F.patch
>                    fi
>                else
> +                if [[ -z $copy ]]; then
>                    diff -u $ofile /dev/null | sh -c "$cleanse_rmfile" \
>                        > $WDIR/$DIR/$F.patch
> +                fi
>
>                    diff -u /dev/null $nfile | sh -c "$cleanse_newfile" \
>                        >> $WDIR/$DIR/$F.patch
> ===========================================
>



More information about the webrev-dev mailing list