Fossil SCM
Internally rearranged how diff flags are passed around, in anticipation of having to refactor for wiki/forum diffs. Added annotate/blame links to /fileedit's first tab.
Commit
39a5241b6f7e1035e2d7bdb373e49cf830e85970cfac4d4a248278745ded4905
Parent
d9fffa4c58686fa…
2 files changed
+45
-11
+18
-6
+45
-11
| --- src/fileedit.c | ||
| +++ src/fileedit.c | ||
| @@ -1004,18 +1004,19 @@ | ||
| 1004 | 1004 | ** to which RID belongs - it is purely informational, for labeling the |
| 1005 | 1005 | ** diff view. isSbs is true for side-by-side diffs, false for unified. |
| 1006 | 1006 | */ |
| 1007 | 1007 | static void fileedit_render_diff(Blob * pContent, int frid, |
| 1008 | 1008 | const char * zManifestUuid, |
| 1009 | - int isSbs){ | |
| 1009 | + u64 diffFlags){ | |
| 1010 | 1010 | Blob orig = empty_blob; |
| 1011 | 1011 | Blob out = empty_blob; |
| 1012 | - u64 diffFlags = DIFF_HTML | DIFF_NOTTOOBIG | DIFF_STRIP_EOLCR | |
| 1013 | - | (isSbs ? DIFF_SIDEBYSIDE : DIFF_LINENO); | |
| 1012 | + | |
| 1014 | 1013 | content_get(frid, &orig); |
| 1015 | 1014 | text_diff(&orig, pContent, &out, 0, diffFlags); |
| 1016 | - if(isSbs || blob_size(&out)==0){ | |
| 1015 | + if(blob_size(&out)==0){ | |
| 1016 | + /* nothing to do */ | |
| 1017 | + }else if(DIFF_SIDEBYSIDE & diffFlags){ | |
| 1017 | 1018 | CX("%b",&out); |
| 1018 | 1019 | }else{ |
| 1019 | 1020 | CX("<pre class='udiff'>%b</pre>",&out); |
| 1020 | 1021 | } |
| 1021 | 1022 | blob_reset(&orig); |
| @@ -1308,10 +1309,15 @@ | ||
| 1308 | 1309 | ** checkin=checkin version |
| 1309 | 1310 | ** |
| 1310 | 1311 | ** Optional parameters: |
| 1311 | 1312 | ** |
| 1312 | 1313 | ** sbs=integer (1=side-by-side or 0=unified, default=0) |
| 1314 | +** | |
| 1315 | +** ws=integer (0=diff whitespace, 1=ignore EOL ws, 2=ignore all ws) | |
| 1316 | +** | |
| 1317 | +** Reminder to self: search info.c for isPatch to see how a | |
| 1318 | +** patch-style siff can be produced. | |
| 1313 | 1319 | ** |
| 1314 | 1320 | ** User must have Write access to use this page. |
| 1315 | 1321 | ** |
| 1316 | 1322 | ** Responds with the HTML content of the diff. On error it produces a |
| 1317 | 1323 | ** JSON response as documented for fileedit_ajax_error(). |
| @@ -1325,14 +1331,27 @@ | ||
| 1325 | 1331 | */ |
| 1326 | 1332 | const char * zFilename = 0; |
| 1327 | 1333 | const char * zRev = 0; |
| 1328 | 1334 | const char * zContent = P("content"); |
| 1329 | 1335 | char * zRevUuid = 0; |
| 1330 | - int isSbs = atoi(PD("sbs","0")); | |
| 1331 | - int vid, frid; | |
| 1336 | + int vid, frid, iFlag; | |
| 1337 | + u64 diffFlags = DIFF_HTML | DIFF_NOTTOOBIG; | |
| 1332 | 1338 | Blob content = empty_blob; |
| 1333 | 1339 | |
| 1340 | + iFlag = atoi(PD("sbs","0")); | |
| 1341 | + if(0==iFlag){ | |
| 1342 | + diffFlags |= DIFF_LINENO; | |
| 1343 | + }else{ | |
| 1344 | + diffFlags |= DIFF_SIDEBYSIDE; | |
| 1345 | + } | |
| 1346 | + iFlag = atoi(PD("ws","2")); | |
| 1347 | + if(2==iFlag){ | |
| 1348 | + diffFlags |= DIFF_IGNORE_ALLWS; | |
| 1349 | + }else if(1==iFlag){ | |
| 1350 | + diffFlags |= DIFF_IGNORE_EOLWS; | |
| 1351 | + } | |
| 1352 | + diffFlags |= DIFF_STRIP_EOLCR; | |
| 1334 | 1353 | fileedit_get_fnci_args( &zFilename, &zRev ); |
| 1335 | 1354 | if(!fileedit_ajax_boostrap() |
| 1336 | 1355 | || !fileedit_ajax_setup_filerev(zRev, &zRevUuid, &vid, |
| 1337 | 1356 | zFilename, &frid)){ |
| 1338 | 1357 | return; |
| @@ -1340,11 +1359,11 @@ | ||
| 1340 | 1359 | if(!zContent){ |
| 1341 | 1360 | zContent = ""; |
| 1342 | 1361 | } |
| 1343 | 1362 | cgi_set_content_type("text/html"); |
| 1344 | 1363 | blob_init(&content, zContent, -1); |
| 1345 | - fileedit_render_diff(&content, frid, zRevUuid, isSbs); | |
| 1364 | + fileedit_render_diff(&content, frid, zRevUuid, diffFlags); | |
| 1346 | 1365 | fossil_free(zRevUuid); |
| 1347 | 1366 | blob_reset(&content); |
| 1348 | 1367 | } |
| 1349 | 1368 | |
| 1350 | 1369 | /* |
| @@ -1898,14 +1917,29 @@ | ||
| 1898 | 1917 | "data-tab-parent='fileedit-tabs' " |
| 1899 | 1918 | "data-tab-label='Diff'" |
| 1900 | 1919 | ">"); |
| 1901 | 1920 | |
| 1902 | 1921 | CX("<div class='fileedit-options flex-container flex-row' " |
| 1903 | - "id='fileedit-tab-diff-buttons'>" | |
| 1904 | - "<button class='sbs'>Side-by-side</button>" | |
| 1905 | - "<button class='unified'>Unified</button>" | |
| 1906 | - "</div>"); | |
| 1922 | + "id='fileedit-tab-diff-buttons'>"); | |
| 1923 | + CX("<button class='sbs'>Side-by-side</button>" | |
| 1924 | + "<button class='unified'>Unified</button>"); | |
| 1925 | + if(0){ | |
| 1926 | + /* For the time being let's just ignore all whitespace | |
| 1927 | + ** changes, as files with Windows-style EOLs always show | |
| 1928 | + ** more diffs than we want then they're submitted to | |
| 1929 | + ** ?ajax=diff because JS normalizes them to Unix EOLs. | |
| 1930 | + ** We can revisit this decision later. */ | |
| 1931 | + style_select_list_int("diff-ws-policy", | |
| 1932 | + "diff_ws", "Whitespace", | |
| 1933 | + "Whitespace handling policy.", | |
| 1934 | + 2, | |
| 1935 | + "Diff all whitespace", 0, | |
| 1936 | + "Ignore EOL whitespace", 1, | |
| 1937 | + "Ignore all whitespace", 2, | |
| 1938 | + NULL); | |
| 1939 | + } | |
| 1940 | + CX("</div>"); | |
| 1907 | 1941 | CX("<div id='fileedit-tab-diff-wrapper'>" |
| 1908 | 1942 | "Diffs will be shown here." |
| 1909 | 1943 | "</div>"); |
| 1910 | 1944 | CX("</div>"/*#fileedit-tab-diff*/); |
| 1911 | 1945 | } |
| 1912 | 1946 |
| --- src/fileedit.c | |
| +++ src/fileedit.c | |
| @@ -1004,18 +1004,19 @@ | |
| 1004 | ** to which RID belongs - it is purely informational, for labeling the |
| 1005 | ** diff view. isSbs is true for side-by-side diffs, false for unified. |
| 1006 | */ |
| 1007 | static void fileedit_render_diff(Blob * pContent, int frid, |
| 1008 | const char * zManifestUuid, |
| 1009 | int isSbs){ |
| 1010 | Blob orig = empty_blob; |
| 1011 | Blob out = empty_blob; |
| 1012 | u64 diffFlags = DIFF_HTML | DIFF_NOTTOOBIG | DIFF_STRIP_EOLCR |
| 1013 | | (isSbs ? DIFF_SIDEBYSIDE : DIFF_LINENO); |
| 1014 | content_get(frid, &orig); |
| 1015 | text_diff(&orig, pContent, &out, 0, diffFlags); |
| 1016 | if(isSbs || blob_size(&out)==0){ |
| 1017 | CX("%b",&out); |
| 1018 | }else{ |
| 1019 | CX("<pre class='udiff'>%b</pre>",&out); |
| 1020 | } |
| 1021 | blob_reset(&orig); |
| @@ -1308,10 +1309,15 @@ | |
| 1308 | ** checkin=checkin version |
| 1309 | ** |
| 1310 | ** Optional parameters: |
| 1311 | ** |
| 1312 | ** sbs=integer (1=side-by-side or 0=unified, default=0) |
| 1313 | ** |
| 1314 | ** User must have Write access to use this page. |
| 1315 | ** |
| 1316 | ** Responds with the HTML content of the diff. On error it produces a |
| 1317 | ** JSON response as documented for fileedit_ajax_error(). |
| @@ -1325,14 +1331,27 @@ | |
| 1325 | */ |
| 1326 | const char * zFilename = 0; |
| 1327 | const char * zRev = 0; |
| 1328 | const char * zContent = P("content"); |
| 1329 | char * zRevUuid = 0; |
| 1330 | int isSbs = atoi(PD("sbs","0")); |
| 1331 | int vid, frid; |
| 1332 | Blob content = empty_blob; |
| 1333 | |
| 1334 | fileedit_get_fnci_args( &zFilename, &zRev ); |
| 1335 | if(!fileedit_ajax_boostrap() |
| 1336 | || !fileedit_ajax_setup_filerev(zRev, &zRevUuid, &vid, |
| 1337 | zFilename, &frid)){ |
| 1338 | return; |
| @@ -1340,11 +1359,11 @@ | |
| 1340 | if(!zContent){ |
| 1341 | zContent = ""; |
| 1342 | } |
| 1343 | cgi_set_content_type("text/html"); |
| 1344 | blob_init(&content, zContent, -1); |
| 1345 | fileedit_render_diff(&content, frid, zRevUuid, isSbs); |
| 1346 | fossil_free(zRevUuid); |
| 1347 | blob_reset(&content); |
| 1348 | } |
| 1349 | |
| 1350 | /* |
| @@ -1898,14 +1917,29 @@ | |
| 1898 | "data-tab-parent='fileedit-tabs' " |
| 1899 | "data-tab-label='Diff'" |
| 1900 | ">"); |
| 1901 | |
| 1902 | CX("<div class='fileedit-options flex-container flex-row' " |
| 1903 | "id='fileedit-tab-diff-buttons'>" |
| 1904 | "<button class='sbs'>Side-by-side</button>" |
| 1905 | "<button class='unified'>Unified</button>" |
| 1906 | "</div>"); |
| 1907 | CX("<div id='fileedit-tab-diff-wrapper'>" |
| 1908 | "Diffs will be shown here." |
| 1909 | "</div>"); |
| 1910 | CX("</div>"/*#fileedit-tab-diff*/); |
| 1911 | } |
| 1912 |
| --- src/fileedit.c | |
| +++ src/fileedit.c | |
| @@ -1004,18 +1004,19 @@ | |
| 1004 | ** to which RID belongs - it is purely informational, for labeling the |
| 1005 | ** diff view. isSbs is true for side-by-side diffs, false for unified. |
| 1006 | */ |
| 1007 | static void fileedit_render_diff(Blob * pContent, int frid, |
| 1008 | const char * zManifestUuid, |
| 1009 | u64 diffFlags){ |
| 1010 | Blob orig = empty_blob; |
| 1011 | Blob out = empty_blob; |
| 1012 | |
| 1013 | content_get(frid, &orig); |
| 1014 | text_diff(&orig, pContent, &out, 0, diffFlags); |
| 1015 | if(blob_size(&out)==0){ |
| 1016 | /* nothing to do */ |
| 1017 | }else if(DIFF_SIDEBYSIDE & diffFlags){ |
| 1018 | CX("%b",&out); |
| 1019 | }else{ |
| 1020 | CX("<pre class='udiff'>%b</pre>",&out); |
| 1021 | } |
| 1022 | blob_reset(&orig); |
| @@ -1308,10 +1309,15 @@ | |
| 1309 | ** checkin=checkin version |
| 1310 | ** |
| 1311 | ** Optional parameters: |
| 1312 | ** |
| 1313 | ** sbs=integer (1=side-by-side or 0=unified, default=0) |
| 1314 | ** |
| 1315 | ** ws=integer (0=diff whitespace, 1=ignore EOL ws, 2=ignore all ws) |
| 1316 | ** |
| 1317 | ** Reminder to self: search info.c for isPatch to see how a |
| 1318 | ** patch-style siff can be produced. |
| 1319 | ** |
| 1320 | ** User must have Write access to use this page. |
| 1321 | ** |
| 1322 | ** Responds with the HTML content of the diff. On error it produces a |
| 1323 | ** JSON response as documented for fileedit_ajax_error(). |
| @@ -1325,14 +1331,27 @@ | |
| 1331 | */ |
| 1332 | const char * zFilename = 0; |
| 1333 | const char * zRev = 0; |
| 1334 | const char * zContent = P("content"); |
| 1335 | char * zRevUuid = 0; |
| 1336 | int vid, frid, iFlag; |
| 1337 | u64 diffFlags = DIFF_HTML | DIFF_NOTTOOBIG; |
| 1338 | Blob content = empty_blob; |
| 1339 | |
| 1340 | iFlag = atoi(PD("sbs","0")); |
| 1341 | if(0==iFlag){ |
| 1342 | diffFlags |= DIFF_LINENO; |
| 1343 | }else{ |
| 1344 | diffFlags |= DIFF_SIDEBYSIDE; |
| 1345 | } |
| 1346 | iFlag = atoi(PD("ws","2")); |
| 1347 | if(2==iFlag){ |
| 1348 | diffFlags |= DIFF_IGNORE_ALLWS; |
| 1349 | }else if(1==iFlag){ |
| 1350 | diffFlags |= DIFF_IGNORE_EOLWS; |
| 1351 | } |
| 1352 | diffFlags |= DIFF_STRIP_EOLCR; |
| 1353 | fileedit_get_fnci_args( &zFilename, &zRev ); |
| 1354 | if(!fileedit_ajax_boostrap() |
| 1355 | || !fileedit_ajax_setup_filerev(zRev, &zRevUuid, &vid, |
| 1356 | zFilename, &frid)){ |
| 1357 | return; |
| @@ -1340,11 +1359,11 @@ | |
| 1359 | if(!zContent){ |
| 1360 | zContent = ""; |
| 1361 | } |
| 1362 | cgi_set_content_type("text/html"); |
| 1363 | blob_init(&content, zContent, -1); |
| 1364 | fileedit_render_diff(&content, frid, zRevUuid, diffFlags); |
| 1365 | fossil_free(zRevUuid); |
| 1366 | blob_reset(&content); |
| 1367 | } |
| 1368 | |
| 1369 | /* |
| @@ -1898,14 +1917,29 @@ | |
| 1917 | "data-tab-parent='fileedit-tabs' " |
| 1918 | "data-tab-label='Diff'" |
| 1919 | ">"); |
| 1920 | |
| 1921 | CX("<div class='fileedit-options flex-container flex-row' " |
| 1922 | "id='fileedit-tab-diff-buttons'>"); |
| 1923 | CX("<button class='sbs'>Side-by-side</button>" |
| 1924 | "<button class='unified'>Unified</button>"); |
| 1925 | if(0){ |
| 1926 | /* For the time being let's just ignore all whitespace |
| 1927 | ** changes, as files with Windows-style EOLs always show |
| 1928 | ** more diffs than we want then they're submitted to |
| 1929 | ** ?ajax=diff because JS normalizes them to Unix EOLs. |
| 1930 | ** We can revisit this decision later. */ |
| 1931 | style_select_list_int("diff-ws-policy", |
| 1932 | "diff_ws", "Whitespace", |
| 1933 | "Whitespace handling policy.", |
| 1934 | 2, |
| 1935 | "Diff all whitespace", 0, |
| 1936 | "Ignore EOL whitespace", 1, |
| 1937 | "Ignore all whitespace", 2, |
| 1938 | NULL); |
| 1939 | } |
| 1940 | CX("</div>"); |
| 1941 | CX("<div id='fileedit-tab-diff-wrapper'>" |
| 1942 | "Diffs will be shown here." |
| 1943 | "</div>"); |
| 1944 | CX("</div>"/*#fileedit-tab-diff*/); |
| 1945 | } |
| 1946 |
+18
-6
| --- src/fossil.page.fileedit.js | ||
| +++ src/fossil.page.fileedit.js | ||
| @@ -119,16 +119,15 @@ | ||
| 119 | 119 | D.clearElement(selFiles, this.e.btnLoadFile); |
| 120 | 120 | D.append( |
| 121 | 121 | D.clearElement(this.e.fileListLabel), |
| 122 | 122 | "Editable files for ", |
| 123 | 123 | D.append( |
| 124 | - D.code(), | |
| 124 | + D.code(), "[", | |
| 125 | 125 | D.a(F.repoUrl('timeline',{ |
| 126 | 126 | c: ciUuid |
| 127 | - }), F.hashDigits(ciUuid)), | |
| 128 | - ), | |
| 129 | - ":" | |
| 127 | + }), F.hashDigits(ciUuid)),"]" | |
| 128 | + ), ":" | |
| 130 | 129 | ); |
| 131 | 130 | this.cache.files[response.checkin] = response; |
| 132 | 131 | response.editableFiles.forEach(function(fn,n){ |
| 133 | 132 | D.option(selFiles, fn); |
| 134 | 133 | }); |
| @@ -242,10 +241,11 @@ | ||
| 242 | 241 | selectPreviewMode: E('#select-preview-mode select'), |
| 243 | 242 | selectHtmlEmsWrap: E('#select-preview-html-ems'), |
| 244 | 243 | selectEolWrap: E('#select-eol-style'), |
| 245 | 244 | selectEol: E('#select-eol-style select[name=eol]'), |
| 246 | 245 | selectFontSizeWrap: E('#select-font-size'), |
| 246 | + selectDiffWS: E('select[name=diff_ws]'), | |
| 247 | 247 | cbLineNumbersWrap: E('#cb-line-numbers'), |
| 248 | 248 | cbAutoPreview: E('#cb-preview-autoupdate > input[type=checkbox]'), |
| 249 | 249 | previewTarget: E('#fileedit-tab-preview-wrapper'), |
| 250 | 250 | cbIsExe: E('input[type=checkbox][name=exec_bit]'), |
| 251 | 251 | fsFileVersionDetails: E('#file-version-details'), |
| @@ -498,27 +498,38 @@ | ||
| 498 | 498 | D.append(D.code(), |
| 499 | 499 | D.a(F.repoUrl('finfo',{name:file, m:rUrl}), file)), |
| 500 | 500 | D.br() |
| 501 | 501 | ); |
| 502 | 502 | D.append( |
| 503 | - eTgt, "Checkin Version: ", | |
| 503 | + eTgt, "Checkin: ", | |
| 504 | 504 | D.append(D.code(), D.a(F.repoUrl('info/'+rUrl), rHuman)), |
| 505 | 505 | " [",D.a(F.repoUrl('timeline',{m:rUrl}), "timeline"),"]", |
| 506 | 506 | D.br() |
| 507 | 507 | ); |
| 508 | 508 | D.append( |
| 509 | 509 | eTgt, "Mimetype: ", |
| 510 | 510 | D.append(D.code(), this.finfo.mimetype||'???'), |
| 511 | 511 | D.br() |
| 512 | 512 | ); |
| 513 | + D.append( | |
| 514 | + eTgt, | |
| 515 | + D.append(D.code(), "[", | |
| 516 | + D.a(F.repoUrl('annotate',{filename:file, checkin:rUrl}), | |
| 517 | + 'annotate'), "]"), | |
| 518 | + D.append(D.code(), "[", | |
| 519 | + D.a(F.repoUrl('blame',{filename:file, checkin:rUrl}), | |
| 520 | + 'blame'), "]") | |
| 521 | + ); | |
| 513 | 522 | const purlArgs = F.encodeUrlArgs({ |
| 514 | 523 | filename: this.finfo.filename, |
| 515 | 524 | checkin: rUrl |
| 516 | 525 | },false,true); |
| 517 | 526 | const purl = F.repoUrl('fileedit',purlArgs); |
| 518 | 527 | D.append( |
| 519 | - eTgt,"[",D.a(purl,"Editor permalink"),"]" | |
| 528 | + eTgt, | |
| 529 | + D.append(D.code(), | |
| 530 | + "[",D.a(purl,"Editor permalink"),"]") | |
| 520 | 531 | ); |
| 521 | 532 | this.setPageTitle("Edit: "+this.finfo.filename); |
| 522 | 533 | return this; |
| 523 | 534 | }; |
| 524 | 535 | |
| @@ -659,10 +670,11 @@ | ||
| 659 | 670 | const fd = new FormData(); |
| 660 | 671 | fd.append('filename',this.finfo.filename); |
| 661 | 672 | fd.append('checkin', this.finfo.checkin); |
| 662 | 673 | fd.append('sbs', sbs ? 1 : 0); |
| 663 | 674 | fd.append('content',content); |
| 675 | + if(this.e.selectDiffWS) fd.append('ws',this.e.selectDiffWS.value); | |
| 664 | 676 | F.message( |
| 665 | 677 | "Fetching diff..." |
| 666 | 678 | ).fetch('fileedit',{ |
| 667 | 679 | urlParams: {ajax: 'diff'}, |
| 668 | 680 | payload: fd, |
| 669 | 681 |
| --- src/fossil.page.fileedit.js | |
| +++ src/fossil.page.fileedit.js | |
| @@ -119,16 +119,15 @@ | |
| 119 | D.clearElement(selFiles, this.e.btnLoadFile); |
| 120 | D.append( |
| 121 | D.clearElement(this.e.fileListLabel), |
| 122 | "Editable files for ", |
| 123 | D.append( |
| 124 | D.code(), |
| 125 | D.a(F.repoUrl('timeline',{ |
| 126 | c: ciUuid |
| 127 | }), F.hashDigits(ciUuid)), |
| 128 | ), |
| 129 | ":" |
| 130 | ); |
| 131 | this.cache.files[response.checkin] = response; |
| 132 | response.editableFiles.forEach(function(fn,n){ |
| 133 | D.option(selFiles, fn); |
| 134 | }); |
| @@ -242,10 +241,11 @@ | |
| 242 | selectPreviewMode: E('#select-preview-mode select'), |
| 243 | selectHtmlEmsWrap: E('#select-preview-html-ems'), |
| 244 | selectEolWrap: E('#select-eol-style'), |
| 245 | selectEol: E('#select-eol-style select[name=eol]'), |
| 246 | selectFontSizeWrap: E('#select-font-size'), |
| 247 | cbLineNumbersWrap: E('#cb-line-numbers'), |
| 248 | cbAutoPreview: E('#cb-preview-autoupdate > input[type=checkbox]'), |
| 249 | previewTarget: E('#fileedit-tab-preview-wrapper'), |
| 250 | cbIsExe: E('input[type=checkbox][name=exec_bit]'), |
| 251 | fsFileVersionDetails: E('#file-version-details'), |
| @@ -498,27 +498,38 @@ | |
| 498 | D.append(D.code(), |
| 499 | D.a(F.repoUrl('finfo',{name:file, m:rUrl}), file)), |
| 500 | D.br() |
| 501 | ); |
| 502 | D.append( |
| 503 | eTgt, "Checkin Version: ", |
| 504 | D.append(D.code(), D.a(F.repoUrl('info/'+rUrl), rHuman)), |
| 505 | " [",D.a(F.repoUrl('timeline',{m:rUrl}), "timeline"),"]", |
| 506 | D.br() |
| 507 | ); |
| 508 | D.append( |
| 509 | eTgt, "Mimetype: ", |
| 510 | D.append(D.code(), this.finfo.mimetype||'???'), |
| 511 | D.br() |
| 512 | ); |
| 513 | const purlArgs = F.encodeUrlArgs({ |
| 514 | filename: this.finfo.filename, |
| 515 | checkin: rUrl |
| 516 | },false,true); |
| 517 | const purl = F.repoUrl('fileedit',purlArgs); |
| 518 | D.append( |
| 519 | eTgt,"[",D.a(purl,"Editor permalink"),"]" |
| 520 | ); |
| 521 | this.setPageTitle("Edit: "+this.finfo.filename); |
| 522 | return this; |
| 523 | }; |
| 524 | |
| @@ -659,10 +670,11 @@ | |
| 659 | const fd = new FormData(); |
| 660 | fd.append('filename',this.finfo.filename); |
| 661 | fd.append('checkin', this.finfo.checkin); |
| 662 | fd.append('sbs', sbs ? 1 : 0); |
| 663 | fd.append('content',content); |
| 664 | F.message( |
| 665 | "Fetching diff..." |
| 666 | ).fetch('fileedit',{ |
| 667 | urlParams: {ajax: 'diff'}, |
| 668 | payload: fd, |
| 669 |
| --- src/fossil.page.fileedit.js | |
| +++ src/fossil.page.fileedit.js | |
| @@ -119,16 +119,15 @@ | |
| 119 | D.clearElement(selFiles, this.e.btnLoadFile); |
| 120 | D.append( |
| 121 | D.clearElement(this.e.fileListLabel), |
| 122 | "Editable files for ", |
| 123 | D.append( |
| 124 | D.code(), "[", |
| 125 | D.a(F.repoUrl('timeline',{ |
| 126 | c: ciUuid |
| 127 | }), F.hashDigits(ciUuid)),"]" |
| 128 | ), ":" |
| 129 | ); |
| 130 | this.cache.files[response.checkin] = response; |
| 131 | response.editableFiles.forEach(function(fn,n){ |
| 132 | D.option(selFiles, fn); |
| 133 | }); |
| @@ -242,10 +241,11 @@ | |
| 241 | selectPreviewMode: E('#select-preview-mode select'), |
| 242 | selectHtmlEmsWrap: E('#select-preview-html-ems'), |
| 243 | selectEolWrap: E('#select-eol-style'), |
| 244 | selectEol: E('#select-eol-style select[name=eol]'), |
| 245 | selectFontSizeWrap: E('#select-font-size'), |
| 246 | selectDiffWS: E('select[name=diff_ws]'), |
| 247 | cbLineNumbersWrap: E('#cb-line-numbers'), |
| 248 | cbAutoPreview: E('#cb-preview-autoupdate > input[type=checkbox]'), |
| 249 | previewTarget: E('#fileedit-tab-preview-wrapper'), |
| 250 | cbIsExe: E('input[type=checkbox][name=exec_bit]'), |
| 251 | fsFileVersionDetails: E('#file-version-details'), |
| @@ -498,27 +498,38 @@ | |
| 498 | D.append(D.code(), |
| 499 | D.a(F.repoUrl('finfo',{name:file, m:rUrl}), file)), |
| 500 | D.br() |
| 501 | ); |
| 502 | D.append( |
| 503 | eTgt, "Checkin: ", |
| 504 | D.append(D.code(), D.a(F.repoUrl('info/'+rUrl), rHuman)), |
| 505 | " [",D.a(F.repoUrl('timeline',{m:rUrl}), "timeline"),"]", |
| 506 | D.br() |
| 507 | ); |
| 508 | D.append( |
| 509 | eTgt, "Mimetype: ", |
| 510 | D.append(D.code(), this.finfo.mimetype||'???'), |
| 511 | D.br() |
| 512 | ); |
| 513 | D.append( |
| 514 | eTgt, |
| 515 | D.append(D.code(), "[", |
| 516 | D.a(F.repoUrl('annotate',{filename:file, checkin:rUrl}), |
| 517 | 'annotate'), "]"), |
| 518 | D.append(D.code(), "[", |
| 519 | D.a(F.repoUrl('blame',{filename:file, checkin:rUrl}), |
| 520 | 'blame'), "]") |
| 521 | ); |
| 522 | const purlArgs = F.encodeUrlArgs({ |
| 523 | filename: this.finfo.filename, |
| 524 | checkin: rUrl |
| 525 | },false,true); |
| 526 | const purl = F.repoUrl('fileedit',purlArgs); |
| 527 | D.append( |
| 528 | eTgt, |
| 529 | D.append(D.code(), |
| 530 | "[",D.a(purl,"Editor permalink"),"]") |
| 531 | ); |
| 532 | this.setPageTitle("Edit: "+this.finfo.filename); |
| 533 | return this; |
| 534 | }; |
| 535 | |
| @@ -659,10 +670,11 @@ | |
| 670 | const fd = new FormData(); |
| 671 | fd.append('filename',this.finfo.filename); |
| 672 | fd.append('checkin', this.finfo.checkin); |
| 673 | fd.append('sbs', sbs ? 1 : 0); |
| 674 | fd.append('content',content); |
| 675 | if(this.e.selectDiffWS) fd.append('ws',this.e.selectDiffWS.value); |
| 676 | F.message( |
| 677 | "Fetching diff..." |
| 678 | ).fetch('fileedit',{ |
| 679 | urlParams: {ajax: 'diff'}, |
| 680 | payload: fd, |
| 681 |