1434 |
1434 |
1435 function flist_from_mercurial_forest |
1435 function flist_from_mercurial_forest |
1436 { |
1436 { |
1437 rm -f $FLIST |
1437 rm -f $FLIST |
1438 if [ -z "$Nflag" ]; then |
1438 if [ -z "$Nflag" ]; then |
1439 print " File list from hg foutgoing $PWS ..." |
1439 print " File list from hg foutgoing $PWS ..." |
1440 outgoing_from_mercurial_forest |
1440 outgoing_from_mercurial_forest |
1441 HG_LIST_FROM_COMMIT=1 |
1441 HG_LIST_FROM_COMMIT=1 |
1442 fi |
1442 fi |
1443 if [ ! -f $FLIST ]; then |
1443 if [ ! -f $FLIST ]; then |
1444 # hg commit hasn't been run see what is lying around |
1444 # hg commit hasn't been run see what is lying around |
1445 print "\n No outgoing, perhaps you haven't commited." |
1445 print "\n No outgoing, perhaps you haven't commited." |
1446 print " File list from hg fstatus -mard ...\c" |
1446 NO_OUTGOING= |
|
1447 print " File list from hg fstatus -mard ...\c" |
1447 FSTAT_OPT= |
1448 FSTAT_OPT= |
1448 fstatus |
1449 fstatus |
1449 HG_LIST_FROM_COMMIT=0 |
1450 HG_LIST_FROM_COMMIT=0 |
1450 fi |
1451 fi |
1451 print " Done." |
1452 print " Done." |
1464 do |
1465 do |
1465 echo $TREE/$F |
1466 echo $TREE/$F |
1466 done >> $FLIST |
1467 done >> $FLIST |
1467 |
1468 |
1468 # Then all the added files |
1469 # Then all the added files |
1469 # But some of these could have been "moved" or renamed ones |
1470 # But some of these could have been "moved" or renamed ones or copied ones |
1470 # so let's make sure we get the proper info |
1471 # so let's make sure we get the proper info |
1471 # hg status -aC will produce something like: |
1472 # hg status -aC will produce something like: |
1472 # A subdir/File3 |
1473 # A subdir/File3 |
1473 # A subdir/File4 |
1474 # A subdir/File4 |
1474 # File4 |
1475 # File4 |
1475 # A subdir/File5 |
1476 # A subdir/File5 |
1476 # The first and last are simple addition while the middle one |
1477 # The first and last are simple addition while the middle one |
1477 # is a move/rename |
1478 # is a move/rename or a copy. We can't distinguish from a rename vs a copy |
1478 |
1479 # without also getting the status of removed files. The middle case above |
|
1480 # is a rename if File4 is also shown a being removed. If File4 is not a |
|
1481 # removed file, then the middle case is a copy from File4 to subdir/File4 |
|
1482 # FIXME - we're not distinguishing copy from rename |
1479 $HGCMD -aC | $FILTER | while read LINE; do |
1483 $HGCMD -aC | $FILTER | while read LINE; do |
1480 ldone="" |
1484 ldone="" |
1481 while [ -z "$ldone" ]; do |
1485 while [ -z "$ldone" ]; do |
1482 ldone="1" |
1486 ldone="1" |
1483 set - $LINE |
1487 set - $LINE |
1623 elif [[ -n $OUTREV ]]; then |
1627 elif [[ -n $OUTREV ]]; then |
1624 STATUS_REV="--rev $OUTREV" |
1628 STATUS_REV="--rev $OUTREV" |
1625 else |
1629 else |
1626 # hg commit hasn't been run see what is lying around |
1630 # hg commit hasn't been run see what is lying around |
1627 print "\n No outgoing, perhaps you haven't commited." |
1631 print "\n No outgoing, perhaps you haven't commited." |
|
1632 NO_OUTGOING= |
1628 fi |
1633 fi |
1629 # First let's list all the modified or deleted files |
1634 # First let's list all the modified or deleted files |
1630 |
1635 |
1631 hg status $STATUS_REV -mdn | $FILTER > $FLIST |
1636 hg status $STATUS_REV -mdn | $FILTER > $FLIST |
1632 |
1637 |
1636 # hg status -aC will produce something like: |
1641 # hg status -aC will produce something like: |
1637 # A subdir/File3 |
1642 # A subdir/File3 |
1638 # A subdir/File4 |
1643 # A subdir/File4 |
1639 # File4 |
1644 # File4 |
1640 # A subdir/File5 |
1645 # A subdir/File5 |
1641 # The first and last are simple addition while the middle one |
1646 # The first and last are simple addition while the middle one |
1642 # is a move/rename |
1647 # is a move/rename or a copy. We can't distinguish from a rename vs a copy |
|
1648 # without also getting the status of removed files. The middle case above |
|
1649 # is a rename if File4 is also shown a being removed. If File4 is not a |
|
1650 # removed file, then the middle case is a copy from File4 to subdir/File4 |
|
1651 # FIXME - we're not distinguishing copy from rename |
1643 |
1652 |
1644 hg status $STATUS_REV -aC | $FILTER >$FLIST.temp |
1653 hg status $STATUS_REV -aC | $FILTER >$FLIST.temp |
1645 while read LINE; do |
1654 while read LINE; do |
1646 ldone="" |
1655 ldone="" |
1647 while [ -z "$ldone" ]; do |
1656 while [ -z "$ldone" ]; do |
1903 # the full path |
1912 # the full path |
1904 $parent cat --rev $parentrev --output $olddir/$DIR/$F $DIR/$F 2>/dev/null |
1913 $parent cat --rev $parentrev --output $olddir/$DIR/$F $DIR/$F 2>/dev/null |
1905 fi |
1914 fi |
1906 fi |
1915 fi |
1907 else |
1916 else |
1908 # It's a rename (or a move), so let's make sure we move |
1917 # It's a rename (or a move), or a copy, so let's make sure we move |
1909 # to the right directory first, then restore it once done |
1918 # to the right directory first, then restore it once done |
1910 current_dir=`pwd` |
1919 current_dir=`pwd` |
1911 cd $CWS/$PDIR |
1920 cd $CWS/$PDIR |
1912 if [ -n "$rflag" ]; then |
1921 if [ -n "$rflag" ]; then |
1913 parentrev=$PARENT_REV |
1922 parentrev=$PARENT_REV |
2772 # [to del a file] @@ -X,Y +1,0 @@ --> @@ -X,Y +0,0 @@ |
2781 # [to del a file] @@ -X,Y +1,0 @@ --> @@ -X,Y +0,0 @@ |
2773 # |
2782 # |
2774 cleanse_rmfile="sed 's/^\(@@ [0-9+,-]*\) [0-9+,-]* @@$/\1 +0,0 @@/'" |
2783 cleanse_rmfile="sed 's/^\(@@ [0-9+,-]*\) [0-9+,-]* @@$/\1 +0,0 @@/'" |
2775 cleanse_newfile="sed 's/^@@ [0-9+,-]* \([0-9+,-]* @@\)$/@@ -0,0 \1/'" |
2784 cleanse_newfile="sed 's/^@@ [0-9+,-]* \([0-9+,-]* @@\)$/@@ -0,0 \1/'" |
2776 |
2785 |
2777 rm -f $WDIR/$DIR/$F.patch |
2786 if [[ -v NO_OUTGOING ]]; |
2778 if [[ -z $rename ]]; then |
2787 then |
2779 if [ ! -f $ofile ]; then |
2788 # Only need to generate a patch file here if there are no commits in outgoing |
2780 diff -u /dev/null $nfile | sh -c "$cleanse_newfile" \ |
2789 rm -f $WDIR/$DIR/$F.patch |
2781 > $WDIR/$DIR/$F.patch |
2790 if [[ -z $rename ]]; then |
2782 elif [ ! -f $nfile ]; then |
2791 if [ ! -f $ofile ]; then |
2783 diff -u $ofile /dev/null | sh -c "$cleanse_rmfile" \ |
2792 diff -u /dev/null $nfile | sh -c "$cleanse_newfile" \ |
2784 > $WDIR/$DIR/$F.patch |
2793 > $WDIR/$DIR/$F.patch |
2785 else |
2794 elif [ ! -f $nfile ]; then |
2786 diff -u $ofile $nfile > $WDIR/$DIR/$F.patch |
2795 diff -u $ofile /dev/null | sh -c "$cleanse_rmfile" \ |
2787 fi |
2796 > $WDIR/$DIR/$F.patch |
2788 else |
2797 else |
2789 diff -u $ofile /dev/null | sh -c "$cleanse_rmfile" \ |
2798 diff -u $ofile $nfile > $WDIR/$DIR/$F.patch |
2790 > $WDIR/$DIR/$F.patch |
2799 fi |
2791 |
2800 else |
2792 diff -u /dev/null $nfile | sh -c "$cleanse_newfile" \ |
2801 diff -u $ofile /dev/null | sh -c "$cleanse_rmfile" \ |
2793 >> $WDIR/$DIR/$F.patch |
2802 > $WDIR/$DIR/$F.patch |
2794 |
2803 |
2795 fi |
2804 diff -u /dev/null $nfile | sh -c "$cleanse_newfile" \ |
2796 |
2805 >> $WDIR/$DIR/$F.patch |
2797 |
2806 |
2798 # |
2807 fi |
2799 # Tack the patch we just made onto the accumulated patch for the |
2808 |
2800 # whole wad. |
2809 |
2801 # |
2810 # |
2802 cat $WDIR/$DIR/$F.patch >> $WDIR/$WNAME.patch |
2811 # Tack the patch we just made onto the accumulated patch for the |
2803 |
2812 # whole wad. |
2804 print " patch\c" |
2813 # |
|
2814 cat $WDIR/$DIR/$F.patch >> $WDIR/$WNAME.patch |
|
2815 fi |
|
2816 |
|
2817 print " patch\c" |
2805 |
2818 |
2806 if [[ -f $ofile && -f $nfile && -z $mv_but_nodiff ]]; then |
2819 if [[ -f $ofile && -f $nfile && -z $mv_but_nodiff ]]; then |
2807 |
2820 |
2808 ${CDIFFCMD:-diff -bt -C 5} $ofile $nfile > $WDIR/$DIR/$F.cdiff |
2821 ${CDIFFCMD:-diff -bt -C 5} $ofile $nfile > $WDIR/$DIR/$F.cdiff |
2809 diff_to_html $F $DIR/$F "C" "$COMM" < $WDIR/$DIR/$F.cdiff \ |
2822 diff_to_html $F $DIR/$F "C" "$COMM" < $WDIR/$DIR/$F.cdiff \ |
2892 fi |
2905 fi |
2893 |
2906 |
2894 print |
2907 print |
2895 done < $FLIST |
2908 done < $FLIST |
2896 |
2909 |
|
2910 # Create the new style mercurial patch here using hg export -r [all-revs] -g -o $CHANGESETPATH |
|
2911 if [[ $SCM_MODE == "mercurial" ]]; then |
|
2912 if [[ !(-v NO_OUTGOING) ]]; then |
|
2913 EXPORTCHANGESET="$WNAME.changeset" |
|
2914 CHANGESETPATH=${WDIR}/${EXPORTCHANGESET} |
|
2915 rm -f $CHANGESETPATH |
|
2916 touch $CHANGESETPATH |
|
2917 if [[ -n $ALL_CREV ]]; then |
|
2918 rev_opt= |
|
2919 for rev in $ALL_CREV; do |
|
2920 rev_opt="$rev_opt --rev $rev" |
|
2921 done |
|
2922 elif [[ -n $FIRST_CREV ]]; then |
|
2923 rev_opt="--rev $FIRST_CREV" |
|
2924 fi |
|
2925 |
|
2926 if [[ -n $rev_opt ]]; then |
|
2927 (cd $CWS;hg export -g $rev_opt -o $CHANGESETPATH) |
|
2928 # echo "Created new-patch: $CHANGESETPATH" 1>&2 |
|
2929 # Use it in place of the jdk.patch created above |
|
2930 rm -f $WDIR/$WNAME.patch |
|
2931 fi |
|
2932 set +x |
|
2933 fi |
|
2934 fi |
|
2935 |
2897 frame_nav_js > $WDIR/ancnav.js |
2936 frame_nav_js > $WDIR/ancnav.js |
2898 frame_navigation > $WDIR/ancnav.html |
2937 frame_navigation > $WDIR/ancnav.html |
2899 |
2938 |
2900 if [[ -f $WDIR/$WNAME.ps && -x $CODEREVIEW && -x $PS2PDF ]]; then |
2939 if [[ -f $WDIR/$WNAME.ps && -x $CODEREVIEW && -x $PS2PDF ]]; then |
2901 print " Generating PDF: \c" |
2940 print " Generating PDF: \c" |
2987 print "<tr><th>Summary of changes:</th><td>" |
3026 print "<tr><th>Summary of changes:</th><td>" |
2988 printCI $TOTL $TINS $TDEL $TMOD $TUNC |
3027 printCI $TOTL $TINS $TDEL $TMOD $TUNC |
2989 print "</td></tr>" |
3028 print "</td></tr>" |
2990 |
3029 |
2991 if [[ -f $WDIR/$WNAME.patch ]]; then |
3030 if [[ -f $WDIR/$WNAME.patch ]]; then |
2992 print "<tr><th>Patch of changes:</th><td>" |
3031 print "<tr><th>Patch of changes:</th><td>" |
2993 print "<a href=\"$WNAME.patch\">$WNAME.patch</a></td></tr>" |
3032 print "<a href=\"$WNAME.patch\">$WNAME.patch</a></td></tr>" |
2994 fi |
3033 elif [[ -f $CHANGESETPATH ]]; then |
|
3034 print "<tr><th>Changeset:</th><td>" |
|
3035 print "<a href=\"$EXPORTCHANGESET\">$EXPORTCHANGESET</a></td></tr>" |
|
3036 fi |
|
3037 |
2995 if [[ -f $WDIR/$WNAME.pdf ]]; then |
3038 if [[ -f $WDIR/$WNAME.pdf ]]; then |
2996 print "<tr><th>Printable review:</th><td>" |
3039 print "<tr><th>Printable review:</th><td>" |
2997 print "<a href=\"$WNAME.pdf\">$WNAME.pdf</a></td></tr>" |
3040 print "<a href=\"$WNAME.pdf\">$WNAME.pdf</a></td></tr>" |
2998 fi |
3041 fi |
2999 |
3042 |