Fossil SCM
The --numstat option to "fossil diff" now shows a total at the end.
Commit
9bb61a420bf5158bcfecc38c891bb649d12c51dc4638843b07810eb732945555
Parent
953fac2b9b19692…
6 files changed
+6
-1
+6
-1
+5
+5
+1
+1
+6
-1
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -1955,11 +1955,16 @@ | ||
| 1955 | 1955 | int nDel = 0, nIns = 0, i; |
| 1956 | 1956 | for(i=0; c.aEdit[i] || c.aEdit[i+1] || c.aEdit[i+2]; i+=3){ |
| 1957 | 1957 | nDel += c.aEdit[i+1]; |
| 1958 | 1958 | nIns += c.aEdit[i+2]; |
| 1959 | 1959 | } |
| 1960 | - blob_appendf(pOut, "%10d %10d", nIns, nDel); | |
| 1960 | + g.diffCnt[1] += nIns; | |
| 1961 | + g.diffCnt[2] += nDel; | |
| 1962 | + if( nIns+nDel ){ | |
| 1963 | + g.diffCnt[0]++; | |
| 1964 | + blob_appendf(pOut, "%10d %10d", nIns, nDel); | |
| 1965 | + } | |
| 1961 | 1966 | }else if( diffFlags & DIFF_SIDEBYSIDE ){ |
| 1962 | 1967 | sbsDiff(&c, pOut, pRe, diffFlags); |
| 1963 | 1968 | }else{ |
| 1964 | 1969 | contextDiff(&c, pOut, pRe, diffFlags); |
| 1965 | 1970 | } |
| 1966 | 1971 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -1955,11 +1955,16 @@ | |
| 1955 | int nDel = 0, nIns = 0, i; |
| 1956 | for(i=0; c.aEdit[i] || c.aEdit[i+1] || c.aEdit[i+2]; i+=3){ |
| 1957 | nDel += c.aEdit[i+1]; |
| 1958 | nIns += c.aEdit[i+2]; |
| 1959 | } |
| 1960 | blob_appendf(pOut, "%10d %10d", nIns, nDel); |
| 1961 | }else if( diffFlags & DIFF_SIDEBYSIDE ){ |
| 1962 | sbsDiff(&c, pOut, pRe, diffFlags); |
| 1963 | }else{ |
| 1964 | contextDiff(&c, pOut, pRe, diffFlags); |
| 1965 | } |
| 1966 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -1955,11 +1955,16 @@ | |
| 1955 | int nDel = 0, nIns = 0, i; |
| 1956 | for(i=0; c.aEdit[i] || c.aEdit[i+1] || c.aEdit[i+2]; i+=3){ |
| 1957 | nDel += c.aEdit[i+1]; |
| 1958 | nIns += c.aEdit[i+2]; |
| 1959 | } |
| 1960 | g.diffCnt[1] += nIns; |
| 1961 | g.diffCnt[2] += nDel; |
| 1962 | if( nIns+nDel ){ |
| 1963 | g.diffCnt[0]++; |
| 1964 | blob_appendf(pOut, "%10d %10d", nIns, nDel); |
| 1965 | } |
| 1966 | }else if( diffFlags & DIFF_SIDEBYSIDE ){ |
| 1967 | sbsDiff(&c, pOut, pRe, diffFlags); |
| 1968 | }else{ |
| 1969 | contextDiff(&c, pOut, pRe, diffFlags); |
| 1970 | } |
| 1971 |
+6
-1
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -1955,11 +1955,16 @@ | ||
| 1955 | 1955 | int nDel = 0, nIns = 0, i; |
| 1956 | 1956 | for(i=0; c.aEdit[i] || c.aEdit[i+1] || c.aEdit[i+2]; i+=3){ |
| 1957 | 1957 | nDel += c.aEdit[i+1]; |
| 1958 | 1958 | nIns += c.aEdit[i+2]; |
| 1959 | 1959 | } |
| 1960 | - blob_appendf(pOut, "%10d %10d", nIns, nDel); | |
| 1960 | + g.diffCnt[1] += nIns; | |
| 1961 | + g.diffCnt[2] += nDel; | |
| 1962 | + if( nIns+nDel ){ | |
| 1963 | + g.diffCnt[0]++; | |
| 1964 | + blob_appendf(pOut, "%10d %10d", nIns, nDel); | |
| 1965 | + } | |
| 1961 | 1966 | }else if( diffFlags & DIFF_SIDEBYSIDE ){ |
| 1962 | 1967 | sbsDiff(&c, pOut, pRe, diffFlags); |
| 1963 | 1968 | }else{ |
| 1964 | 1969 | contextDiff(&c, pOut, pRe, diffFlags); |
| 1965 | 1970 | } |
| 1966 | 1971 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -1955,11 +1955,16 @@ | |
| 1955 | int nDel = 0, nIns = 0, i; |
| 1956 | for(i=0; c.aEdit[i] || c.aEdit[i+1] || c.aEdit[i+2]; i+=3){ |
| 1957 | nDel += c.aEdit[i+1]; |
| 1958 | nIns += c.aEdit[i+2]; |
| 1959 | } |
| 1960 | blob_appendf(pOut, "%10d %10d", nIns, nDel); |
| 1961 | }else if( diffFlags & DIFF_SIDEBYSIDE ){ |
| 1962 | sbsDiff(&c, pOut, pRe, diffFlags); |
| 1963 | }else{ |
| 1964 | contextDiff(&c, pOut, pRe, diffFlags); |
| 1965 | } |
| 1966 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -1955,11 +1955,16 @@ | |
| 1955 | int nDel = 0, nIns = 0, i; |
| 1956 | for(i=0; c.aEdit[i] || c.aEdit[i+1] || c.aEdit[i+2]; i+=3){ |
| 1957 | nDel += c.aEdit[i+1]; |
| 1958 | nIns += c.aEdit[i+2]; |
| 1959 | } |
| 1960 | g.diffCnt[1] += nIns; |
| 1961 | g.diffCnt[2] += nDel; |
| 1962 | if( nIns+nDel ){ |
| 1963 | g.diffCnt[0]++; |
| 1964 | blob_appendf(pOut, "%10d %10d", nIns, nDel); |
| 1965 | } |
| 1966 | }else if( diffFlags & DIFF_SIDEBYSIDE ){ |
| 1967 | sbsDiff(&c, pOut, pRe, diffFlags); |
| 1968 | }else{ |
| 1969 | contextDiff(&c, pOut, pRe, diffFlags); |
| 1970 | } |
| 1971 |
+5
| --- src/diffcmd.c | ||
| +++ src/diffcmd.c | ||
| @@ -887,10 +887,11 @@ | ||
| 887 | 887 | zFrom = mprintf("root:%s", zBranch); |
| 888 | 888 | } |
| 889 | 889 | if( zCheckin!=0 && ( zFrom!=0 || zTo!=0 ) ){ |
| 890 | 890 | fossil_fatal("cannot use --checkin together with --from or --to"); |
| 891 | 891 | } |
| 892 | + g.diffCnt[0] = g.diffCnt[1] = g.diffCnt[2] = 0; | |
| 892 | 893 | if( zTo==0 || againstUndo ){ |
| 893 | 894 | db_must_be_within_tree(); |
| 894 | 895 | }else if( zFrom==0 ){ |
| 895 | 896 | fossil_fatal("must use --from if --to is present"); |
| 896 | 897 | }else{ |
| @@ -958,10 +959,14 @@ | ||
| 958 | 959 | } |
| 959 | 960 | fossil_free(pFileDir[i].zName); |
| 960 | 961 | } |
| 961 | 962 | fossil_free(pFileDir); |
| 962 | 963 | } |
| 964 | + if ( diffFlags & DIFF_NUMSTAT ){ | |
| 965 | + fossil_print("%10d %10d TOTAL over %d changed files\n", | |
| 966 | + g.diffCnt[1], g.diffCnt[2], g.diffCnt[0]); | |
| 967 | + } | |
| 963 | 968 | } |
| 964 | 969 | |
| 965 | 970 | /* |
| 966 | 971 | ** WEBPAGE: vpatch |
| 967 | 972 | ** URL: /vpatch?from=FROM&to=TO |
| 968 | 973 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -887,10 +887,11 @@ | |
| 887 | zFrom = mprintf("root:%s", zBranch); |
| 888 | } |
| 889 | if( zCheckin!=0 && ( zFrom!=0 || zTo!=0 ) ){ |
| 890 | fossil_fatal("cannot use --checkin together with --from or --to"); |
| 891 | } |
| 892 | if( zTo==0 || againstUndo ){ |
| 893 | db_must_be_within_tree(); |
| 894 | }else if( zFrom==0 ){ |
| 895 | fossil_fatal("must use --from if --to is present"); |
| 896 | }else{ |
| @@ -958,10 +959,14 @@ | |
| 958 | } |
| 959 | fossil_free(pFileDir[i].zName); |
| 960 | } |
| 961 | fossil_free(pFileDir); |
| 962 | } |
| 963 | } |
| 964 | |
| 965 | /* |
| 966 | ** WEBPAGE: vpatch |
| 967 | ** URL: /vpatch?from=FROM&to=TO |
| 968 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -887,10 +887,11 @@ | |
| 887 | zFrom = mprintf("root:%s", zBranch); |
| 888 | } |
| 889 | if( zCheckin!=0 && ( zFrom!=0 || zTo!=0 ) ){ |
| 890 | fossil_fatal("cannot use --checkin together with --from or --to"); |
| 891 | } |
| 892 | g.diffCnt[0] = g.diffCnt[1] = g.diffCnt[2] = 0; |
| 893 | if( zTo==0 || againstUndo ){ |
| 894 | db_must_be_within_tree(); |
| 895 | }else if( zFrom==0 ){ |
| 896 | fossil_fatal("must use --from if --to is present"); |
| 897 | }else{ |
| @@ -958,10 +959,14 @@ | |
| 959 | } |
| 960 | fossil_free(pFileDir[i].zName); |
| 961 | } |
| 962 | fossil_free(pFileDir); |
| 963 | } |
| 964 | if ( diffFlags & DIFF_NUMSTAT ){ |
| 965 | fossil_print("%10d %10d TOTAL over %d changed files\n", |
| 966 | g.diffCnt[1], g.diffCnt[2], g.diffCnt[0]); |
| 967 | } |
| 968 | } |
| 969 | |
| 970 | /* |
| 971 | ** WEBPAGE: vpatch |
| 972 | ** URL: /vpatch?from=FROM&to=TO |
| 973 |
+5
| --- src/diffcmd.c | ||
| +++ src/diffcmd.c | ||
| @@ -887,10 +887,11 @@ | ||
| 887 | 887 | zFrom = mprintf("root:%s", zBranch); |
| 888 | 888 | } |
| 889 | 889 | if( zCheckin!=0 && ( zFrom!=0 || zTo!=0 ) ){ |
| 890 | 890 | fossil_fatal("cannot use --checkin together with --from or --to"); |
| 891 | 891 | } |
| 892 | + g.diffCnt[0] = g.diffCnt[1] = g.diffCnt[2] = 0; | |
| 892 | 893 | if( zTo==0 || againstUndo ){ |
| 893 | 894 | db_must_be_within_tree(); |
| 894 | 895 | }else if( zFrom==0 ){ |
| 895 | 896 | fossil_fatal("must use --from if --to is present"); |
| 896 | 897 | }else{ |
| @@ -958,10 +959,14 @@ | ||
| 958 | 959 | } |
| 959 | 960 | fossil_free(pFileDir[i].zName); |
| 960 | 961 | } |
| 961 | 962 | fossil_free(pFileDir); |
| 962 | 963 | } |
| 964 | + if ( diffFlags & DIFF_NUMSTAT ){ | |
| 965 | + fossil_print("%10d %10d TOTAL over %d changed files\n", | |
| 966 | + g.diffCnt[1], g.diffCnt[2], g.diffCnt[0]); | |
| 967 | + } | |
| 963 | 968 | } |
| 964 | 969 | |
| 965 | 970 | /* |
| 966 | 971 | ** WEBPAGE: vpatch |
| 967 | 972 | ** URL: /vpatch?from=FROM&to=TO |
| 968 | 973 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -887,10 +887,11 @@ | |
| 887 | zFrom = mprintf("root:%s", zBranch); |
| 888 | } |
| 889 | if( zCheckin!=0 && ( zFrom!=0 || zTo!=0 ) ){ |
| 890 | fossil_fatal("cannot use --checkin together with --from or --to"); |
| 891 | } |
| 892 | if( zTo==0 || againstUndo ){ |
| 893 | db_must_be_within_tree(); |
| 894 | }else if( zFrom==0 ){ |
| 895 | fossil_fatal("must use --from if --to is present"); |
| 896 | }else{ |
| @@ -958,10 +959,14 @@ | |
| 958 | } |
| 959 | fossil_free(pFileDir[i].zName); |
| 960 | } |
| 961 | fossil_free(pFileDir); |
| 962 | } |
| 963 | } |
| 964 | |
| 965 | /* |
| 966 | ** WEBPAGE: vpatch |
| 967 | ** URL: /vpatch?from=FROM&to=TO |
| 968 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -887,10 +887,11 @@ | |
| 887 | zFrom = mprintf("root:%s", zBranch); |
| 888 | } |
| 889 | if( zCheckin!=0 && ( zFrom!=0 || zTo!=0 ) ){ |
| 890 | fossil_fatal("cannot use --checkin together with --from or --to"); |
| 891 | } |
| 892 | g.diffCnt[0] = g.diffCnt[1] = g.diffCnt[2] = 0; |
| 893 | if( zTo==0 || againstUndo ){ |
| 894 | db_must_be_within_tree(); |
| 895 | }else if( zFrom==0 ){ |
| 896 | fossil_fatal("must use --from if --to is present"); |
| 897 | }else{ |
| @@ -958,10 +959,14 @@ | |
| 959 | } |
| 960 | fossil_free(pFileDir[i].zName); |
| 961 | } |
| 962 | fossil_free(pFileDir); |
| 963 | } |
| 964 | if ( diffFlags & DIFF_NUMSTAT ){ |
| 965 | fossil_print("%10d %10d TOTAL over %d changed files\n", |
| 966 | g.diffCnt[1], g.diffCnt[2], g.diffCnt[0]); |
| 967 | } |
| 968 | } |
| 969 | |
| 970 | /* |
| 971 | ** WEBPAGE: vpatch |
| 972 | ** URL: /vpatch?from=FROM&to=TO |
| 973 |
+1
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -321,10 +321,11 @@ | ||
| 321 | 321 | } reqPayload; /* request payload object (if any) */ |
| 322 | 322 | cson_array *warnings; /* response warnings */ |
| 323 | 323 | int timerId; /* fetched from fossil_timer_start() */ |
| 324 | 324 | } json; |
| 325 | 325 | #endif /* FOSSIL_ENABLE_JSON */ |
| 326 | + int diffCnt[3]; /* Counts for DIFF_NUMSTAT: files, ins, del */ | |
| 326 | 327 | }; |
| 327 | 328 | |
| 328 | 329 | /* |
| 329 | 330 | ** Macro for debugging: |
| 330 | 331 | */ |
| 331 | 332 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -321,10 +321,11 @@ | |
| 321 | } reqPayload; /* request payload object (if any) */ |
| 322 | cson_array *warnings; /* response warnings */ |
| 323 | int timerId; /* fetched from fossil_timer_start() */ |
| 324 | } json; |
| 325 | #endif /* FOSSIL_ENABLE_JSON */ |
| 326 | }; |
| 327 | |
| 328 | /* |
| 329 | ** Macro for debugging: |
| 330 | */ |
| 331 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -321,10 +321,11 @@ | |
| 321 | } reqPayload; /* request payload object (if any) */ |
| 322 | cson_array *warnings; /* response warnings */ |
| 323 | int timerId; /* fetched from fossil_timer_start() */ |
| 324 | } json; |
| 325 | #endif /* FOSSIL_ENABLE_JSON */ |
| 326 | int diffCnt[3]; /* Counts for DIFF_NUMSTAT: files, ins, del */ |
| 327 | }; |
| 328 | |
| 329 | /* |
| 330 | ** Macro for debugging: |
| 331 | */ |
| 332 |
+1
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -321,10 +321,11 @@ | ||
| 321 | 321 | } reqPayload; /* request payload object (if any) */ |
| 322 | 322 | cson_array *warnings; /* response warnings */ |
| 323 | 323 | int timerId; /* fetched from fossil_timer_start() */ |
| 324 | 324 | } json; |
| 325 | 325 | #endif /* FOSSIL_ENABLE_JSON */ |
| 326 | + int diffCnt[3]; /* Counts for DIFF_NUMSTAT: files, ins, del */ | |
| 326 | 327 | }; |
| 327 | 328 | |
| 328 | 329 | /* |
| 329 | 330 | ** Macro for debugging: |
| 330 | 331 | */ |
| 331 | 332 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -321,10 +321,11 @@ | |
| 321 | } reqPayload; /* request payload object (if any) */ |
| 322 | cson_array *warnings; /* response warnings */ |
| 323 | int timerId; /* fetched from fossil_timer_start() */ |
| 324 | } json; |
| 325 | #endif /* FOSSIL_ENABLE_JSON */ |
| 326 | }; |
| 327 | |
| 328 | /* |
| 329 | ** Macro for debugging: |
| 330 | */ |
| 331 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -321,10 +321,11 @@ | |
| 321 | } reqPayload; /* request payload object (if any) */ |
| 322 | cson_array *warnings; /* response warnings */ |
| 323 | int timerId; /* fetched from fossil_timer_start() */ |
| 324 | } json; |
| 325 | #endif /* FOSSIL_ENABLE_JSON */ |
| 326 | int diffCnt[3]; /* Counts for DIFF_NUMSTAT: files, ins, del */ |
| 327 | }; |
| 328 | |
| 329 | /* |
| 330 | ** Macro for debugging: |
| 331 | */ |
| 332 |