sapling/mercurial
Gregory Szorc 28b7db089e hgweb: add HTML elements to control whitespace settings for annotate
Building on top of the new URL query string arguments to control
whitespace settings for annotate, this commit adds HTML checkboxes
reflecting the values of these arguments to the paper and gitweb
themes.

The actual diff settings are now exported to the templating layer.
The HTML templates add these as data-* attributes so they are
accessible to the DOM.

A new <form> with various <input> elements is added. The <form>
is initially hidden via CSS. A shared JavaScript function (which
runs after the <form> has been rendered but before the annotate
HTML (because annotate HTML could take a while to load and we want
the form to render quickly) takes care of setting the checked state
of each box from the data-* attributes. It also registers an event
handler to modify the URL and refresh the page whenever the checkbox
state is changed.

I'm using the URLSearchParams interface to perform URL manipulation.
https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams tells
me this may not be supported on older web browsers. Yes, apparently
the web API didn't have a standard API to parse and format query
strings until recently. Hence the check for the presence of this
feature in the JavaScript. If the browser doesn't support the
feature, the <form> will remain hidden and behavior will like it
currently is. We could polyfill this feature or implement our own
query string parsing. But I'm lazy and this could be done as a
follow-up if people miss it.

We could certainly expand this feature to support more diff options
(such as lines of context). That's why the potentially reusable code
is stored in a reusable place. It is also certainly possible to
add diff controls to other pages that display diffs. But since
Mozillians are making noise about controlling which revisions
annotate shows, I figured I'd start there.

.. feature::

   Control whitespace settings for annotation on hgweb

   /annotate URLs on hgweb now accept query string arguments to
   influence how whitespace changes impact results.

   The arguments "ignorews," "ignorewsamount," "ignorewseol," and
   "ignoreblanklines" now have the same meaning as their [annotate]
   config section counterparts. Any provided setting overrides the
   server default.

   HTML checkboxes have been added to the paper and gitweb themes
   to expose current whitespace settings and to easily modify the
   current view.

Differential Revision: https://phab.mercurial-scm.org/D850
2017-09-30 09:01:36 +01:00
..
cext parsers: fix invariant bug in find_deepest (issue5623) 2017-07-14 13:48:17 +02:00
cffi policy: reroute proxy modules internally 2017-07-31 23:40:36 +09:00
default.d mergetools.rc: find OSX FileMerge in the new location inside Xcode 4.3 2015-10-16 11:37:34 +02:00
help sparse: add a requirement when a repository uses sparse (BC) 2017-07-17 11:45:38 -07:00
hgweb hgweb: add HTML elements to control whitespace settings for annotate 2017-09-30 09:01:36 +01:00
httpclient httpclient: update to 54868ef054d2 of httpplus 2016-06-27 11:53:50 -04:00
pure style: always use x is not None instead of not x is None 2017-09-29 15:49:43 +00:00
templates hgweb: add HTML elements to control whitespace settings for annotate 2017-09-30 09:01:36 +01:00
__init__.py selector2: vendor selector2 library 2017-07-14 20:19:46 -07:00
ancestor.py py3: add __bool__ to every class defining __nonzero__ 2017-03-13 12:40:14 -07:00
archival.py archive: add an experimental config to control the metadata file template 2017-07-17 00:49:29 -04:00
bdiff.c bdiff: split bdiff into cpy-aware and cpy-agnostic part 2016-07-13 10:46:26 +02:00
bdiff.h bdiff: split bdiff into cpy-aware and cpy-agnostic part 2016-07-13 10:46:26 +02:00
bitmanipulation.h internals: move the bitmanipulation routines into its own file 2016-06-06 13:08:13 +02:00
bookmarks.py bookmark: deprecate direct del of a bookmark value 2017-07-10 21:49:37 +02:00
branchmap.py branchmap: remove superfluous pass statements 2017-09-30 07:42:59 -04:00
bundle2.py transaction-summary: display the summary for all transactions 2017-07-16 02:20:06 +02:00
bundlerepo.py bundlerepo: update to use new deltaiter api 2017-09-20 09:39:03 -07:00
byterange.py byterange: remove superfluous pass statements 2017-09-30 07:43:11 -04:00
changegroup.py repair: preserve phase also when not using generaldelta (issue5678) 2017-09-14 11:16:57 -07:00
changelog.py revlog: add option to mmap revlog index 2017-09-13 17:26:26 +00:00
chgserver.py codemod: register core configitems using a script 2017-07-14 14:22:40 -07:00
cmdutil.py cmdutil: remove superfluous pass statements 2017-09-30 07:43:26 -04:00
color.py configitems: register the 'ui.color' config 2017-07-15 14:14:53 +02:00
commands.py py3: use '%d' instead of '%s' for integers 2017-09-30 18:02:53 +05:30
commandserver.py commandserver: remove superfluous pass statements 2017-09-30 07:43:40 -04:00
compat.h encoding: add function to test if a str consists of ASCII characters 2017-04-23 12:59:42 +09:00
config.py config: use copy-on-write to improve copy performance 2017-09-27 18:07:48 -07:00
configitems.py configitems: register the 'ui.color' config 2017-07-15 14:14:53 +02:00
context.py dirstate: use keyword arguments to clarify status()'s callers 2017-09-29 14:49:05 -07:00
copies.py py3: explicitly convert dict.keys() and dict.items() into a list 2017-09-30 15:45:15 +05:30
crecord.py editor: use an unambiguous path suffix for editor files 2017-08-30 20:25:56 +00:00
dagop.py revset: optimize "draft() & ::x" pattern 2017-08-28 14:49:00 -07:00
dagparser.py py3: iterate bytes as a byte string in dagparser.py 2017-09-03 15:32:45 +09:00
dagutil.py dagutil: use absolute_import 2015-08-08 19:04:09 -07:00
debugcommands.py debugssl: allow a URL to be specified without a local repository 2017-08-29 16:38:10 -04:00
destutil.py show: implement "stack" view 2017-07-01 22:38:42 -07:00
dirstate.py dirstate: move parents source of truth to dirstatemap 2017-09-26 03:56:20 -07:00
dirstateguard.py dirstate: update backup functions to take full backup filename 2017-07-12 15:24:07 -07:00
discovery.py discovery: prevent crash caused by prune marker having no parent data 2017-04-19 23:10:05 +09:00
dispatch.py ui: enable pager always for explicit --pager=on (issue5580) 2017-08-01 18:52:52 +09:00
dummycert.pem
encoding.py py3: use 'surrogatepass' error handler to process U+DCxx transparently 2017-09-16 22:55:48 +09:00
error.py error: move patch.PatchError so it can easily implement __bytes__ (API) 2017-09-03 16:45:33 +09:00
exchange.py exchange: remove superfluous pass statements 2017-09-30 07:43:53 -04:00
exewrapper.c exewrapper: add .dll to LoadLibrary() argument 2016-04-27 09:23:39 -07:00
extensions.py color: drop the now useless color extension 2017-07-15 14:17:35 +02:00
fancyopts.py py3: slice over bytes to prevent getting it's ascii value 2017-06-25 08:36:51 +05:30
filelog.py python3: replace sorted(<dict>.iterkeys()) with sorted(<dict>) 2017-08-22 20:06:58 -04:00
filemerge.py configitems: register the 'ui.mergemarkertemplate' config 2017-06-30 03:44:56 +02:00
fileset.py help: clarify quotes are needed for filesets.size expressions 2016-09-21 16:33:37 +00:00
formatter.py formatter: remove superfluous pass statements 2017-09-30 07:44:08 -04:00
graphmod.py log: add a "graphwidth" template variable 2017-08-15 10:15:31 -07:00
hbisect.py bisect: move check_state into the bisect module 2016-08-24 04:25:20 +02:00
help.py codemod: register core configitems using a script 2017-07-14 14:22:40 -07:00
hg.py doctest: bulk-replace string literals with b'' for Python 3 2017-09-03 14:32:11 +09:00
hook.py py3: convert keys of kwargs back to bytes using pycompat.byteskwargs() 2017-06-17 15:29:26 +05:30
httpconnection.py codemod: register core configitems using a script 2017-07-14 14:22:40 -07:00
httppeer.py codemod: register core configitems using a script 2017-07-14 14:22:40 -07:00
i18n.py i18n: make the locale directory name the same string type as the datapath 2016-10-08 05:26:18 -04:00
keepalive.py style: always use x is not None instead of not x is None 2017-09-29 15:49:43 +00:00
localrepo.py localrepo: remove superfluous pass statements 2017-09-30 07:44:34 -04:00
lock.py lock: avoid unintentional lock acquisition at failure of readlock 2017-05-01 19:59:13 +09:00
lsprof.py lsprof: use print function 2016-01-02 11:40:53 -08:00
lsprofcalltree.py lsprofcalltree: use print function 2016-01-02 11:45:29 -08:00
mail.py codemod: register core configitems using a script 2017-07-14 14:22:40 -07:00
manifest.py py3: return False early while checking whether None is a key in lazymanifest 2017-09-30 05:22:22 +05:30
match.py match: remove superfluous pass statements 2017-09-30 07:44:45 -04:00
mdiff.py mdiff: add a --ignore-space-at-eol option 2017-08-29 18:20:50 -07:00
merge.py py3: use pycompat.bytestr instead of str 2017-09-30 15:48:08 +05:30
mergeutil.py checkunresolved: move to new package to help avoid import cycles 2016-11-21 21:31:45 -05:00
minirst.py doctest: bulk-replace string literals with b'' for Python 3 2017-09-03 14:32:11 +09:00
mpatch.c internals: move the bitmanipulation routines into its own file 2016-06-06 13:08:13 +02:00
mpatch.h mpatch: raise MemoryError instead of mpatchError if lalloc() failed 2016-08-07 10:06:56 +09:00
namespaces.py namespaces: record and expose whether namespace is built-in 2017-06-24 14:52:15 -07:00
node.py node: use byte literals to construct nullid and wdirid 2016-03-12 14:04:57 -08:00
obsolete.py obsolete: remove superfluous pass statements 2017-09-30 07:44:55 -04:00
obsutil.py templates: introduce a obsfateoperation() function 2017-09-15 10:43:22 -07:00
parser.py doctest: use print_function and convert bytes to unicode where needed 2017-09-03 14:56:31 +09:00
patch.py patch: remove superfluous pass statements 2017-09-30 07:45:07 -04:00
pathutil.py pathauditor: disable cache of audited paths by default (issue5628) 2017-07-26 22:10:15 +09:00
peer.py wireproto: use new peer interface 2017-08-10 20:58:28 -07:00
phases.py bundle2: only grab a transaction when 'phase-heads' affect the repository 2017-09-20 18:29:10 +02:00
policy.py encoding: add fast path of jsonescape() (issue5533) 2017-04-23 14:47:52 +09:00
posix.py posix: replace superfluous pass statement with explicit return 2017-09-30 07:45:18 -04:00
profiling.py codemod: register core configitems using a script 2017-07-14 14:22:40 -07:00
progress.py codemod: register core configitems using a script 2017-07-14 14:22:40 -07:00
pushkey.py pushkey: use absolute_import 2015-08-08 19:57:27 -07:00
pvec.py pvec: use absolute_import 2015-12-21 21:32:58 -08:00
pycompat.py util: fix sortdict.update() to call __setitem__() on PyPy (issue5639) 2017-08-02 22:51:19 +09:00
rcutil.py pager: use less as a fallback on Unix 2017-04-28 20:51:14 +09:00
registrar.py registrar: remove superfluous pass statements 2017-09-30 07:45:41 -04:00
repair.py repair: preserve phase also when not using generaldelta (issue5678) 2017-09-14 11:16:57 -07:00
repository.py repository: formalize wire protocol interface 2017-08-13 11:04:42 -07:00
repoview.py cleanup: replace uses of util.(md5|sha1|sha256|sha512) with hashlib.\1 2016-06-10 00:12:33 -04:00
revlog.py revlog: add revmap back to revlog.addgroup 2017-09-20 09:22:22 -07:00
revset.py revset: move weight information to predicate 2017-09-01 19:42:09 -07:00
revsetlang.py revset: move weight information to predicate 2017-09-01 19:42:09 -07:00
scmposix.py pager: use less as a fallback on Unix 2017-04-28 20:51:14 +09:00
scmutil.py merge with stable 2017-09-30 07:52:48 -07:00
scmwindows.py pager: use less as a fallback on Unix 2017-04-28 20:51:14 +09:00
selectors2.py selector2: vendor selector2 library 2017-07-14 20:19:46 -07:00
server.py serve: add support for Mercurial subrepositories 2017-04-15 18:05:40 -04:00
setdiscovery.py setdiscovery: use iterbatch interface instead of batch 2016-03-01 17:44:41 -05:00
similar.py similar: remove caching from the module level 2017-01-13 11:42:36 -08:00
simplemerge.py simplemerge: remove unused repo parameter 2017-09-01 10:35:43 -07:00
smartset.py py3: fix type of attribute name in smartset.py 2017-09-03 17:14:53 +09:00
sparse.py sparse: add a requirement when a repository uses sparse (BC) 2017-07-17 11:45:38 -07:00
sshpeer.py ssh: fix flakey ssh errors on BSD systems 2017-09-11 15:59:18 -07:00
sshserver.py wireproto: compress data from a generator 2016-10-16 11:10:21 -07:00
sslutil.py sslutil: inform the user about how to fix an incomplete certificate chain 2017-07-12 18:37:13 -04:00
statichttprepo.py statichttprepo: implement wlock() (issue5613) 2017-07-29 12:50:56 -07:00
statprof.py statprof: require input file 2017-01-18 22:45:07 -08:00
store.py py3: iterate bytes as a byte string in store.lowerencode() 2017-09-03 17:28:47 +09:00
streamclone.py codemod: register core configitems using a script 2017-07-14 14:22:40 -07:00
subrepo.py subrepo: remove superfluous pass statements 2017-09-30 07:45:51 -04:00
tagmerge.py tagmerge: use workingfilectx to write merged tags 2017-07-11 16:48:15 -07:00
tags.py cachevfs: migration the tags fnode cache to 'cachevfs' 2017-07-15 23:30:25 +02:00
templatefilters.py doctest: bulk-replace string literals with b'' for Python 3 2017-09-03 14:32:11 +09:00
templatekw.py templatekw: choose {latesttag} by len(changes), not date (issue5659) 2017-08-15 23:23:55 -07:00
templater.py py3: use pycompat.strkwargs() before passing a dict as keyword argument 2017-09-30 15:46:36 +05:30
transaction.py util: add base class for transactional context managers 2017-07-28 22:42:10 -07:00
treediscovery.py error: get Abort from 'error' instead of 'util' 2015-10-08 12:55:45 -07:00
txnutil.py
ui.py merge with stable 2017-09-30 07:52:48 -07:00
unionrepo.py revlog: update signature of dummy addgroup() in bundlerepo and unionrepo 2017-09-15 23:58:45 +09:00
upgrade.py codemod: simplify nested withs 2017-07-13 18:31:35 -07:00
url.py codemod: register core configitems using a script 2017-07-14 14:22:40 -07:00
util.py py3: work around bytes/unicode divergence in parsedate() 2017-09-27 19:27:41 +09:00
verify.py codemod: register core configitems using a script 2017-07-14 14:22:40 -07:00
vfs.py pathauditor: disable cache of audited paths by default (issue5628) 2017-07-26 22:10:15 +09:00
win32.py win32: work around a WinError problem handling HRESULT types 2017-03-30 00:33:00 -04:00
windows.py doctest: bulk-replace string literals with b'' for Python 3 2017-09-03 14:32:11 +09:00
wireproto.py codemod: register core configitems using a script 2017-07-14 14:22:40 -07:00
worker.py worker: propagate exit code to main process 2017-04-15 13:27:44 +09:00