Commit 5d337c4159aafea99132ed379d8507ff68f8f024
Render updates in old schema the same as current
Charles Lehner committed on 4/21/2016, 2:33:01 AMParent: aaef5b5d2d7ccda76e171130105d706fe7f9d49e
Files changed
index.js | changed |
locale/en.json | changed |
locale/eo.json | changed |
index.js | ||
---|---|---|
@@ -1464,9 +1464,8 @@ | ||
1464 | 1464 | |
1465 | 1465 | var dateStr = new Date(msg.value.timestamp).toLocaleString(req._locale) |
1466 | 1466 | return '<section class="collapse">' + |
1467 | 1467 | link([msg.key], dateStr) + '<br>' + |
1468 | - (numObjects ? req._t('PushedObjects', numObjects) + '<br/>': '') + | |
1469 | 1468 | refs.map(function (update) { |
1470 | 1469 | var name = escapeHTML(update.name) |
1471 | 1470 | if (!update.value) { |
1472 | 1471 | return req._t('DeletedBranch', {branch: name}) |
@@ -1862,66 +1861,54 @@ | ||
1862 | 1861 | } |
1863 | 1862 | } |
1864 | 1863 | } |
1865 | 1864 | |
1865 | + var commits = cat([ | |
1866 | + msg.content.objects && pull( | |
1867 | + pull.values(msg.content.objects), | |
1868 | + pull.filter(function (obj) { return obj.type == 'commit' }), | |
1869 | + paramap(function (obj, cb) { | |
1870 | + getBlob(req, obj.link || obj.key, function (err, readObject) { | |
1871 | + if (err) return cb(err) | |
1872 | + Repo.getCommitParsed({read: readObject}, cb) | |
1873 | + }) | |
1874 | + }, 8) | |
1875 | + ), | |
1876 | + msg.content.packs && pull( | |
1877 | + pull.values(msg.content.packs), | |
1878 | + paramap(function (pack, cb) { | |
1879 | + var done = multicb({ pluck: 1, spread: true }) | |
1880 | + getBlob(req, pack.pack.link, done()) | |
1881 | + getBlob(req, pack.idx.link, done()) | |
1882 | + done(function (err, readPack, readIdx) { | |
1883 | + if (err) return cb(renderError(err)) | |
1884 | + cb(null, gitPack.decodeWithIndex(repo, readPack, readIdx)) | |
1885 | + }) | |
1886 | + }, 4), | |
1887 | + pull.flatten(), | |
1888 | + pull.asyncMap(function (obj, cb) { | |
1889 | + if (obj.type == 'commit') | |
1890 | + Repo.getCommitParsed(obj, cb) | |
1891 | + else | |
1892 | + pull(obj.read, pull.drain(null, cb)) | |
1893 | + }), | |
1894 | + pull.filter() | |
1895 | + ) | |
1896 | + ]) | |
1897 | + | |
1866 | 1898 | return renderRepoPage(req, repo, 'activity', null, cat([ |
1867 | - pull.values([ | |
1868 | - '<a href="?raw" class="raw-link header-align">' + | |
1869 | - req._t('Data') + '</a>', | |
1870 | - '<h3>' + req._t('Update') + '</h3>', | |
1871 | - renderRepoUpdate(req, repo, {key: id, value: msg}, true) | |
1872 | - ].concat(msg.content.objects ? | |
1873 | - ['<h3>' + req._t('Objects') + '</h3>'].concat( | |
1874 | - objsArr(msg.content.objects).map(renderObject.bind(null, req))) | |
1875 | - : [], | |
1876 | - msg.content.packs ? [ | |
1877 | - '<h3>' + req._t('Packs') + '</h3>' | |
1878 | - ].concat(msg.content.packs.map(renderPack.bind(null, req))) | |
1879 | - : [])), | |
1880 | - msg.content.packs && cat([ | |
1899 | + pull.once('<a href="?raw" class="raw-link header-align">' + | |
1900 | + req._t('Data') + '</a>' + | |
1901 | + '<h3>' + req._t('Update') + '</h3>' + | |
1902 | + renderRepoUpdate(req, repo, {key: id, value: msg}, true)), | |
1903 | + (msg.content.objects || msg.content.packs) && | |
1881 | 1904 | pull.once('<h3>' + req._t('Commits') + '</h3>'), |
1882 | - pull( | |
1883 | - pull.values(msg.content.packs), | |
1884 | - pull.asyncMap(function (pack, cb) { | |
1885 | - var done = multicb({ pluck: 1, spread: true }) | |
1886 | - getBlob(req, pack.pack.link, done()) | |
1887 | - getBlob(req, pack.idx.link, done()) | |
1888 | - done(function (err, readPack, readIdx) { | |
1889 | - if (err) return cb(renderError(err)) | |
1890 | - cb(null, gitPack.decodeWithIndex(repo, readPack, readIdx)) | |
1891 | - }) | |
1892 | - }), | |
1893 | - pull.flatten(), | |
1894 | - pull.asyncMap(function (obj, cb) { | |
1895 | - if (obj.type == 'commit') | |
1896 | - Repo.getCommitParsed(obj, cb) | |
1897 | - else | |
1898 | - pull(obj.read, pull.drain(null, cb)) | |
1899 | - }), | |
1900 | - pull.filter(), | |
1901 | - pull.map(function (commit) { | |
1902 | - return renderCommit(req, repo, commit) | |
1903 | - }) | |
1904 | - ) | |
1905 | - ]) | |
1905 | + pull(commits, pull.map(function (commit) { | |
1906 | + return renderCommit(req, repo, commit) | |
1907 | + })) | |
1906 | 1908 | ])) |
1907 | 1909 | } |
1908 | 1910 | |
1909 | - function renderObject(req, obj) { | |
1910 | - return '<section class="collapse">' + | |
1911 | - obj.type + ' ' + link([obj.link], obj.sha1) + '<br>' + | |
1912 | - req._t('NumBytes', obj.length) + | |
1913 | - '</section>' | |
1914 | - } | |
1915 | - | |
1916 | - function renderPack(req, info) { | |
1917 | - return '<section class="collapse">' + | |
1918 | - (info.pack ? req._t('Pack') + ': ' + | |
1919 | - link([info.pack.link]) + '<br>' : '') + | |
1920 | - (info.idx ? req._t('Index') + ': ' + | |
1921 | - link([info.idx.link]) : '') + '</section>' | |
1922 | - } | |
1923 | - | |
1924 | 1911 | /* Blob */ |
1925 | 1912 | |
1926 | 1913 | function serveRepoBlob(req, repo, rev, path) { |
1927 | 1914 | return readNext(function (cb) { |
Built with git-ssb-web