diff --git a/docs/uri-scheme-browse-content.rst b/docs/uri-scheme-browse-content.rst index 1a5cac66..d81fbc7d 100644 --- a/docs/uri-scheme-browse-content.rst +++ b/docs/uri-scheme-browse-content.rst @@ -1,83 +1,92 @@ Content ^^^^^^^ .. http:get:: /browse/content/[(algo_hash):](hash)/ HTML view that displays a SWH content identified by its hash value. If the content to display is textual, it will be highlighted client-side if possible using highlightjs_. In order for that operation to be performed, a programming language must first be associated to the content. The following procedure is used in order to find the language: 1) First try to find a language from the content filename (provided as query parameter when navigating from a directory view). 2) If no language has been found from the filename, try to find one from the content mime type. The mime type is retrieved from the content metadata stored in the SWH archive or is computed server-side using Python magic module. + It is also possible to highlight specific lines of a textual + content (not in terms of syntax highlighting but to emphasize + some relevant content part) by either: + + * clicking on line numbers (holding shift to highlight a lines range) + + * using an url fragment in the form '#Ln' or '#Lm-Ln' + When that view is called in the context of a navigation coming from a directory view, a breadcrumb will be displayed on top of the rendered content in order to easily navigate up to the associated root directory. In that case, the path query parameter will be used and filled with the path of the file relative to the root directory. - :param string algo_hash: optional parameter to indicate the algorithm used - to compute the content checksum (can be either *sha1*, + :param string algo_hash: optional parameter to indicate the algorithm used + to compute the content checksum (can be either *sha1*, *sha1_git*, *sha256* or *blake2s256*, default to *sha1*) :param string hash: hexadecimal representation for the checksum from which to retrieve the associated content in the SWH archive - :query string path: describe the path of the content relative to a root - directory (used to add context aware navigation links when navigating + :query string path: describe the path of the content relative to a root + directory (used to add context aware navigation links when navigating from a directory view) :statuscode 200: no error :statuscode 400: an invalid query string has been provided :statuscode 404: requested content can not be found in the SWH archive **Examples:** .. parsed-literal:: :swh_web_browse:`content/sha1_git:f5d0b39a0cdddb91a31a537052b7d8d31a4aa79f/` + :swh_web_browse:`content/sha1_git:f5d0b39a0cdddb91a31a537052b7d8d31a4aa79f/#L23-L41` :swh_web_browse:`content/blake2s256:1cc1e3124957c9be8a454c58e92eb925cf4aa9823984bd01451c5b7e0fee99d1/` :swh_web_browse:`content/sha1:1cb1447c1c7ddc1b03eac88398e40bd914d46b62/` :swh_web_browse:`content/sha256:8ceb4b9ee5adedde47b31e975c1d90c73ad27b6b165a1dcd80c7c545eb65b903/` .. http:get:: /browse/content/[(algo_hash):](hash)/raw/ HTML view that produces a raw display of a SWH content identified by its hash value. The behaviour of that view depends on the mime type of the requested content. If the mime type is from the text family, the view will return a response whose content type is 'text/plain' that will be rendered by the browser. Otherwise, the view will return a response whose content type is 'application/octet-stream' and the browser will then offer to download the file. In the context of a navigation coming from a directory view, the filename query parameter will be used in order to provide the real name of the file when one wants to save it locally. - :param string algo_hash: optionnal parameter to indicate the algorithm used - to compute the content checksum (can be either *sha1*, + :param string algo_hash: optionnal parameter to indicate the algorithm used + to compute the content checksum (can be either *sha1*, *sha1_git*, *sha256* or *blake2s256*, default to *sha1*) :param string hash: hexadecimal representation for the checksum from which to retrieve the associated content in the SWH archive - :query string filename: indicate the name of the file holding the requested + :query string filename: indicate the name of the file holding the requested content (used when one wants to save the content to a local file) :statuscode 200: no error :statuscode 400: an invalid query string has been provided :statuscode 404: requested content can not be found in the SWH archive **Examples:** .. parsed-literal:: :swh_web_browse:`content/sha1_git:f5d0b39a0cdddb91a31a537052b7d8d31a4aa79f/raw/?filename=LICENSE` :swh_web_browse:`content/blake2s256:1cc1e3124957c9be8a454c58e92eb925cf4aa9823984bd01451c5b7e0fee99d1/raw/?filename=MAINTAINERS` :swh_web_browse:`content/sha1:1cb1447c1c7ddc1b03eac88398e40bd914d46b62/raw/` :swh_web_browse:`content/sha256:8ceb4b9ee5adedde47b31e975c1d90c73ad27b6b165a1dcd80c7c545eb65b903/raw/?filename=COPYING` .. _highlightjs: https://highlightjs.org/ \ No newline at end of file diff --git a/docs/uri-scheme-browse-origin.rst b/docs/uri-scheme-browse-origin.rst index 4b7af555..337116ad 100644 --- a/docs/uri-scheme-browse-origin.rst +++ b/docs/uri-scheme-browse-origin.rst @@ -1,460 +1,488 @@ Origin ^^^^^^ Origin metadata """"""""""""""" .. http:get:: /browse/origin/(origin_id)/ HTML view that displays a SWH origin identified by its id. The view displays the origin metadata and contains links for browsing its directories and contents for each SWH visit. :param int origin_id: the id of a SWH origin :statuscode 200: no error :statuscode 404: requested origin can not be found in the SWH archive **Examples:** .. parsed-literal:: :swh_web_browse:`origin/2/` :swh_web_browse:`origin/13706355/` .. http:get:: /browse/origin/(origin_type)/url/(origin_url)/ - + HTML view that displays a SWH origin identified by its type and url. The view displays the origin metadata and contains links for browsing its directories and contents for each SWH visit. :param string origin_type: the type of the SWH origin (*git*, *svn*, ...) :param string origin_url: the url of the origin (e.g. https://github.com///) :statuscode 200: no error :statuscode 404: requested origin can not be found in the SWH archive **Examples:** .. parsed-literal:: :swh_web_browse:`origin/git/url/https://github.com/torvalds/linux/` :swh_web_browse:`origin/git/url/https://github.com/python/cpython/` Origin directory """""""""""""""" .. http:get:: /browse/origin/(origin_id)/directory/[(path)/] HTML view for browsing the content of a directory reachable from the root directory (including itself) associated to the latest visit of a SWH origin. The content of the directory is first sorted in lexicographical order and the sub-directories are displayed before the regular files. The view enables to navigate from the requested directory to directories reachable from it in a recursive way but also up to the origin root directory. A breadcrumb located in the top part of the view allows to keep track of the paths navigated so far. The view also enables to easily switch between the origin branches through a dropdown menu. - The origin branch (default to master) from which to retrieve the directory + The origin branch (default to master) from which to retrieve the directory content can also be specified by using the branch query parameter. :param int origin_id: the id of a SWH origin - :param string path: optional parameter used to specify the path of a directory + :param string path: optional parameter used to specify the path of a directory reachable from the origin root one - :query string branch: specify the origin branch from which + :query string branch: specify the origin branch from which to retrieve the directory - :query string revision: specify the origin revision, identified by the hexadecimal + :query string revision: specify the origin revision, identified by the hexadecimal representation of its *sha1_git* value, from which to retrieve the directory :statuscode 200: no error :statuscode 404: requested origin can not be found in the SWH archive or the provided path does not exist from the origin root directory **Examples:** .. parsed-literal:: :swh_web_browse:`origin/2/directory/` :swh_web_browse:`origin/2/directory/net/ethernet/` :swh_web_browse:`origin/13706355/directory/` :swh_web_browse:`origin/13706355/directory/Python/` :swh_web_browse:`origin/13706355/directory/?branch=refs/heads/2.7` .. http:get:: /browse/origin/(origin_id)/visit/(visit_id)/directory/[(path)/] HTML view for browsing the content of a directory reachable from the root directory - (including itself) associated to a specific visit (identified by its id) of a SWH origin. + (including itself) associated to a specific visit (identified by its id) of a SWH origin. The content of the directory is first sorted in lexicographical order and the sub-directories are displayed before the regular files. The view enables to navigate from the requested directory to directories reachable from it in a recursive way but also up to the origin root directory. A breadcrumb located in the top part of the view allows to keep track of the paths navigated so far. The view also enables to easily switch between the origin branches through a dropdown menu. - The origin branch (default to master) from which to retrieve the directory + The origin branch (default to master) from which to retrieve the directory content can also be specified by using the branch query parameter. :param int origin_id: the id of a SWH origin :param int visit_id: the id of the origin visit - :param string path: optional parameter used to specify the path of a directory + :param string path: optional parameter used to specify the path of a directory reachable from the origin root one :query string branch: specify the origin branch from which to retrieve the directory - :query string revision: specify the origin revision, identified by the hexadecimal + :query string revision: specify the origin revision, identified by the hexadecimal representation of its *sha1_git* value, from which to retrieve the directory :statuscode 200: no error :statuscode 404: requested origin can not be found in the SWH archive, - requested visit id does not exist or the provided path does + requested visit id does not exist or the provided path does not exist from the origin root directory **Examples:** .. parsed-literal:: :swh_web_browse:`origin/2/visit/2/directory/` :swh_web_browse:`origin/2/visit/2/directory/net/ethernet/` :swh_web_browse:`origin/13706355/visit/1/directory/` :swh_web_browse:`origin/13706355/visit/1/directory/Python/` :swh_web_browse:`origin/13706355/visit/1/directory/?branch=refs/heads/2.7` .. http:get:: /browse/origin/(origin_id)/ts/(timestamp)/directory/[(path)/] - HTML view for browsing the content of a directory reachable from - the root directory (including itself) associated to a visitof a SWH - origin closest to a provided timestamp. + HTML view for browsing the content of a directory reachable from + the root directory (including itself) associated to a visitof a SWH + origin closest to a provided timestamp. The content of the directory is first sorted in lexicographical order and the sub-directories are displayed before the regular files. The view enables to navigate from the requested directory to directories reachable from it in a recursive way but also up to the origin root directory. A breadcrumb located in the top part of the view allows to keep track of the paths navigated so far. The view also enables to easily switch between the origin branches through a dropdown menu. - The origin branch (default to master) from which to retrieve the directory + The origin branch (default to master) from which to retrieve the directory content can also be specified by using the branch query parameter. :param int origin_id: the id of a SWH origin :param string timestamp: an ISO date string or Unix timestamp to parse in order to find the closest SWH visit. - :param path: optional parameter used to specify the path of a directory + :param path: optional parameter used to specify the path of a directory reachable from the origin root one :type path: string - :query string branch: specify the origin branch from which + :query string branch: specify the origin branch from which to retrieve the directory - :query string revision: specify the origin revision, identified by the hexadecimal + :query string revision: specify the origin revision, identified by the hexadecimal representation of its *sha1_git* value, from which to retrieve the directory :statuscode 200: no error :statuscode 404: requested origin can not be found in the SWH archive, - requested visit timestamp does not exist or the provided path does + requested visit timestamp does not exist or the provided path does not exist from the origin root directory **Examples:** .. parsed-literal:: :swh_web_browse:`origin/2/ts/1493926809/directory/` :swh_web_browse:`origin/2/ts/2016-09-14T10:36:21+00:00/directory/net/ethernet/` :swh_web_browse:`origin/13706355/ts/1474620651/directory/` :swh_web_browse:`origin/13706355/ts/1474620651/directory/Python/` :swh_web_browse:`origin/13706355/ts/1474620651/directory/?branch=refs/heads/2.7` - + Origin content """""""""""""" .. http:get:: /browse/origin/(origin_id)/content/(path)/ HTML view that produces a display of a SWH content associated to the latest visit of a SWH origin. If the content to display is textual, it will be highlighted client-side if possible using highlightjs_. The procedure to perform that task is described in :http:get:`/browse/content/[(algo_hash):](hash)/`. + It is also possible to highlight specific lines of a textual + content (not in terms of syntax highlighting but to emphasize + some relevant content part) by either: + + * clicking on line numbers (holding shift to highlight a lines range) + + * using an url fragment in the form '#Ln' or '#Lm-Ln' + The view displays a breadcrumb on top of the rendered content in order to easily navigate up to the origin root directory. The view also enables to easily switch between the origin branches through a dropdown menu. The origin branch (default to master) from which to retrieve the content can also be specified by using the branch query parameter. :param int origin_id: the id of a SWH origin :param string path: path of a content reachable from the origin root directory - :query string branch: specify the origin branch from which + :query string branch: specify the origin branch from which to retrieve the content - :query string revision: specify the origin revision, identified by the hexadecimal + :query string revision: specify the origin revision, identified by the hexadecimal representation of its *sha1_git* value, from which to retrieve the content :statuscode 200: no error :statuscode 404: requested origin can not be found in the SWH archive, or the provided content path does not exist from the origin root directory **Examples:** .. parsed-literal:: + :swh_web_browse:`origin/723566/content/git.c/` :swh_web_browse:`origin/723566/content/git.c/` :swh_web_browse:`origin/16297443/content/js/src/json.cpp/` :swh_web_browse:`origin/723566/content/git.c/?branch=refs/heads/next` .. http:get:: /browse/origin/(origin_id)/visit/(visit_id)/content/(path)/ HTML view that produces a display of a SWH content associated to a specific visit (identified by its id) of a SWH origin. If the content to display is textual, it will be highlighted client-side if possible using highlightjs_. The procedure to perform that task is described in :http:get:`/browse/content/[(algo_hash):](hash)/`. + It is also possible to highlight specific lines of a textual + content (not in terms of syntax highlighting but to emphasize + some relevant content part) by either: + + * clicking on line numbers (holding shift to highlight a lines range) + + * using an url fragment in the form '#Ln' or '#Lm-Ln' + The view displays a breadcrumb on top of the rendered content in order to easily navigate up to the origin root directory. The view also enables to easily switch between the origin branches through a dropdown menu. The origin branch (default to master) from which to retrieve the content can also be specified by using the branch query parameter. :param int origin_id: the id of a SWH origin :param int visit_id: the id of the origin visit :param string path: path of a content reachable from the origin root directory - :query string branch: specify the origin branch from which + :query string branch: specify the origin branch from which to retrieve the content - :query string revision: specify the origin revision, identified by the hexadecimal + :query string revision: specify the origin revision, identified by the hexadecimal representation of its *sha1_git* value, from which to retrieve the content :statuscode 200: no error :statuscode 404: requested origin can not be found in the SWH archive, - requested visit id does not exist or the provided content path does + requested visit id does not exist or the provided content path does not exist from the origin root directory **Examples:** .. parsed-literal:: :swh_web_browse:`origin/723566/visit/1/content/git.c/` + :swh_web_browse:`origin/723566/visit/13/content/git.c/#L334-L390` :swh_web_browse:`origin/16297443/visit/3/content/js/src/json.cpp/` :swh_web_browse:`origin/723566/visit/1/content/git.c/?branch=refs/heads/next` .. http:get:: /browse/origin/(origin_id)/ts/(timestamp)/content/(path)/ HTML view that produces a display of a SWH content associated to a visit of a SWH origin closest to a provided timestamp. If the content to display is textual, it will be highlighted client-side if possible using highlightjs_. The procedure to perform that task is described in :http:get:`/browse/content/[(algo_hash):](hash)/`. + It is also possible to highlight specific lines of a textual + content (not in terms of syntax highlighting but to emphasize + some relevant content part) by either: + + * clicking on line numbers (holding shift to highlight a lines range) + + * using an url fragment in the form '#Ln' or '#Lm-Ln' + + The view displays a breadcrumb on top of the rendered content in order to easily navigate up to the origin root directory. The view also enables to easily switch between the origin branches through a dropdown menu. The origin branch (default to master) from which to retrieve the content can also be specified by using the branch query parameter. :param int origin_id: the id of a SWH origin - :param string timestamp: an ISO date string or Unix timestamp to parse in + :param string timestamp: an ISO date string or Unix timestamp to parse in order to find the closest SWH visit. :param string path: path of a content reachable from the origin root directory - :query string branch: specify the origin branch from which + :query string branch: specify the origin branch from which to retrieve the content - :query string revision: specify the origin revision, identified by the hexadecimal + :query string revision: specify the origin revision, identified by the hexadecimal representation of its *sha1_git* value, from which to retrieve the content :statuscode 200: no error :statuscode 404: requested origin can not be found in the SWH archive, - requested visit timestamp does not exist or the provided content path does + requested visit timestamp does not exist or the provided content path does not exist from the origin root directory **Examples:** .. parsed-literal:: :swh_web_browse:`origin/723566/ts/1473933564/content/git.c/` :swh_web_browse:`origin/723566/ts/2016-05-05T00:0:00+00:00/content/git.c/` :swh_web_browse:`origin/16297443/ts/1490126182/content/js/src/json.cpp/` + :swh_web_browse:`origin/16297443/ts/2017-03-21/content/js/src/json.cpp/#L904-L931` :swh_web_browse:`origin/723566/ts/2017-09-15/content/git.c/?branch=refs/heads/next` Origin history """""""""""""" .. http:get:: /browse/origin/(origin_id)/log/ HTML view that produces a display of revisions history heading to the last revision found during the latest visit of a SWH origin. In other words, it shows the commit log associated to the latest visit of a SWH origin. The following data are displayed for each log entry: * author of the revision * link to the revision metadata * message associated the revision * date of the revision * link to browse the associated source tree in the origin context N log entries are displayed per page (default is 20). In order to navigate in a large history, two buttons are present at the bottom of the view: * *Newer*: fetch and display if available the N more recent log entries than the ones currently displayed * *Older*: fetch and display if available the N older log entries than the ones currently displayed The view also enables to easily switch between the origin branches through a dropdown menu. The origin branch (default to master) from which to retrieve the content can also be specified by using the branch query parameter. :param int origin_id: the id of a SWH origin - :query string revs_breadcrumb: used internally to store + :query string revs_breadcrumb: used internally to store the navigation breadcrumbs (i.e. the list of descendant revisions - visited so far). It must be a string in the form + visited so far). It must be a string in the form "[//.../]" where rev_i corresponds to a revision sha1_git. - :query int per_page: the number of log entries to display per page + :query int per_page: the number of log entries to display per page (default is 20, max is 50) - :query string branch: specify the origin branch from which + :query string branch: specify the origin branch from which to retrieve the commit log - :query string revision: specify the origin revision, identified by the hexadecimal + :query string revision: specify the origin revision, identified by the hexadecimal representation of its *sha1_git* value, from which to retrieve the commit log :statuscode 200: no error :statuscode 404: requested origin can not be found in the SWH archive **Examples:** .. parsed-literal:: :swh_web_browse:`origin/12215444/log/` :swh_web_browse:`origin/2081083/log/` :swh_web_browse:`origin/12081083/log/?branch=refs/heads/release` - + .. http:get:: /browse/origin/(origin_id)/visit/(visit_id)/log/ HTML view that produces a display of revisions history heading to the last revision found during a specific visit of a SWH origin. In other words, it shows the commit log associated to a specific visit of a SWH origin. The following data are displayed for each log entry: * author of the revision * link to the revision metadata * message associated the revision * date of the revision * link to browse the associated source tree in the origin context N log entries are displayed per page (default is 20). In order to navigate in a large history, two buttons are present at the bottom of the view: * *Newer*: fetch and display if available the N more recent log entries than the ones currently displayed * *Older*: fetch and display if available the N older log entries than the ones currently displayed The view also enables to easily switch between the origin branches through a dropdown menu. The origin branch (default to master) from which to retrieve the content can also be specified by using the branch query parameter. :param int origin_id: the id of a SWH origin :param int visit_id: the id of the origin visit - :query string revs_breadcrumb: used internally to store + :query string revs_breadcrumb: used internally to store the navigation breadcrumbs (i.e. the list of descendant revisions - visited so far). It must be a string in the form + visited so far). It must be a string in the form "[//.../]" where rev_i corresponds to a revision sha1_git. - :query int per_page: the number of log entries to display per page + :query int per_page: the number of log entries to display per page (default is 20, max is 50) - :query string branch: specify the origin branch from which + :query string branch: specify the origin branch from which to retrieve the commit log - :query string revision: specify the origin revision, identified by the hexadecimal + :query string revision: specify the origin revision, identified by the hexadecimal representation of its *sha1_git* value, from which to retrieve the commit log :statuscode 200: no error :statuscode 404: requested origin can not be found in the SWH archive **Examples:** .. parsed-literal:: :swh_web_browse:`origin/12215444/visit/2/log/` :swh_web_browse:`origin/12081083/visit/10/log/` :swh_web_browse:`origin/12081083/visit/10/log/?branch=refs/heads/release` .. http:get:: /browse/origin/(origin_id)/ts/(timestamp)/log/ HTML view that produces a display of revisions history heading to the last revision found during a visit of a SWH origin closest to the provided timestamp. In other words, it shows the commit log associated to a visit of a SWH origin. closest to a provided timestamp. The following data are displayed for each log entry: * author of the revision * link to the revision metadata * message associated the revision * date of the revision * link to browse the associated source tree in the origin context N log entries are displayed per page (default is 20). In order to navigate in a large history, two buttons are present at the bottom of the view: * *Newer*: fetch and display if available the N more recent log entries than the ones currently displayed * *Older*: fetch and display if available the N older log entries than the ones currently displayed The view also enables to easily switch between the origin branches through a dropdown menu. The origin branch (default to master) from which to retrieve the content can also be specified by using the branch query parameter. :param int origin_id: the id of a SWH origin :param string timestamp: an ISO date string or Unix timestamp to parse in order to find the closest SWH visit. - :query string revs_breadcrumb: used internally to store + :query string revs_breadcrumb: used internally to store the navigation breadcrumbs (i.e. the list of descendant revisions - visited so far). It must be a string in the form + visited so far). It must be a string in the form "[//.../]" where rev_i corresponds to a revision sha1_git. - :query int per_page: the number of log entries to display per page + :query int per_page: the number of log entries to display per page (default is 20, max is 50) - :query string branch: specify the origin branch from which + :query string branch: specify the origin branch from which to retrieve the commit log - :query string revision: specify the origin revision, identified by the hexadecimal + :query string revision: specify the origin revision, identified by the hexadecimal representation of its *sha1_git* value, from which to retrieve the commit log :statuscode 200: no error :statuscode 404: requested origin can not be found in the SWH archive **Examples:** .. parsed-literal:: :swh_web_browse:`origin/12215444/ts/1459651262/log/` :swh_web_browse:`origin/12081083/ts/2016-04-01/log/` :swh_web_browse:`origin/12081083/ts/1438116814/log/?branch=refs/heads/release` :swh_web_browse:`origin/12081083/ts/2017-05-05T03:14:23/log/?branch=refs/heads/release` .. _highlightjs: https://highlightjs.org/