Fossil SCM
Add the test-line-hash command for use in debugging and analyzing the match_dline() functions.
Commit
6a2bfba43d58e0188e1849a098af6ab312367369c2c20ec4f8f89ac99d37131d
Parent
45c91a66701d5fc…
1 file changed
+22
+22
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -899,10 +899,32 @@ | ||
| 899 | 899 | #endif |
| 900 | 900 | |
| 901 | 901 | /* Return the result */ |
| 902 | 902 | return score; |
| 903 | 903 | } |
| 904 | + | |
| 905 | +/* | |
| 906 | +** COMMAND: test-line-match | |
| 907 | +** Usage: %fossil test-line-match STRING1 STRING2 | |
| 908 | +** | |
| 909 | +** Return a score from 0 to 100 that is how similar STRING1 is to | |
| 910 | +** STRING2. Smaller numbers mean more similar. 0 is an exact match. | |
| 911 | +** | |
| 912 | +** This command is used to test to match_dline() function in the | |
| 913 | +** internal Fossil diff logic. | |
| 914 | +*/ | |
| 915 | +void test_dline_match(void){ | |
| 916 | + DLine a, b; | |
| 917 | + int x; | |
| 918 | + if( g.argc!=4 ) usage("STRING1 STRING2"); | |
| 919 | + a.z = g.argv[2]; | |
| 920 | + a.n = (int)strlen(a.z); | |
| 921 | + b.z = g.argv[3]; | |
| 922 | + b.n = (int)strlen(b.z); | |
| 923 | + x = match_dline(&a, &b); | |
| 924 | + fossil_print("%d\n", x); | |
| 925 | +} | |
| 904 | 926 | |
| 905 | 927 | /* |
| 906 | 928 | ** There is a change block in which nLeft lines of text on the left are |
| 907 | 929 | ** converted into nRight lines of text on the right. This routine computes |
| 908 | 930 | ** how the lines on the left line up with the lines on the right. |
| 909 | 931 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -899,10 +899,32 @@ | |
| 899 | #endif |
| 900 | |
| 901 | /* Return the result */ |
| 902 | return score; |
| 903 | } |
| 904 | |
| 905 | /* |
| 906 | ** There is a change block in which nLeft lines of text on the left are |
| 907 | ** converted into nRight lines of text on the right. This routine computes |
| 908 | ** how the lines on the left line up with the lines on the right. |
| 909 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -899,10 +899,32 @@ | |
| 899 | #endif |
| 900 | |
| 901 | /* Return the result */ |
| 902 | return score; |
| 903 | } |
| 904 | |
| 905 | /* |
| 906 | ** COMMAND: test-line-match |
| 907 | ** Usage: %fossil test-line-match STRING1 STRING2 |
| 908 | ** |
| 909 | ** Return a score from 0 to 100 that is how similar STRING1 is to |
| 910 | ** STRING2. Smaller numbers mean more similar. 0 is an exact match. |
| 911 | ** |
| 912 | ** This command is used to test to match_dline() function in the |
| 913 | ** internal Fossil diff logic. |
| 914 | */ |
| 915 | void test_dline_match(void){ |
| 916 | DLine a, b; |
| 917 | int x; |
| 918 | if( g.argc!=4 ) usage("STRING1 STRING2"); |
| 919 | a.z = g.argv[2]; |
| 920 | a.n = (int)strlen(a.z); |
| 921 | b.z = g.argv[3]; |
| 922 | b.n = (int)strlen(b.z); |
| 923 | x = match_dline(&a, &b); |
| 924 | fossil_print("%d\n", x); |
| 925 | } |
| 926 | |
| 927 | /* |
| 928 | ** There is a change block in which nLeft lines of text on the left are |
| 929 | ** converted into nRight lines of text on the right. This routine computes |
| 930 | ** how the lines on the left line up with the lines on the right. |
| 931 |