aboutsummaryrefslogtreecommitdiff
path: root/devel/nmbug
AgeCommit message (Collapse)Author
2022-06-17nmbug: promote to user tool "notmuch-git"David Bremner
Initially just a rename, and drop the --version argument that clashes with the global notmuch --version argument.
2021-01-09nmbug: notmuch-report: set both background and foreground colorsTomi Ollila
Whenever setting background color, set also corresponding foreground color. Don't expect default foreground color to be #000 (or something close); user may have changed it.
2020-04-03nmbug: explicitly prefer python3Daniel Kahn Gillmor
nmbug and notmuch-report are developer tools. It's 2018, and all developers should have python3 available. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2018-06-14use #!/usr/bin/env python consistentlyDaniel Kahn Gillmor
2018-05-03move more http -> httpsDaniel Kahn Gillmor
Correct URLs that have crept into the notmuch codebase with http:// when https:// is possible. As part of this conversion, this changeset also indicates the current preferred upstream URLs for both gmime and sup. the new URLs are https-enabled, the old ones are not. This also fixes T310-emacs.sh, thanks to Bremner for catching it.
2017-12-29nmbug: Bump to version 0.3W. Trevor King
Changes since 0.2: * Accept failures to unset core.worktree in clone (0a155847, 2017-10-10, unreleased). * Use --no-renames in log (f9189a06, 2016-09-26, v0.24). * Auto-checkout in clone if it wouldn't clobber (7ef3b653, 2017-10-10, unreleased). * Add a 'help' command for folks who don't like --help (9d25c97d, 2014-10-03, v0.20). * Setup a 'config' branch on clone to track origin/config (244f8739, 2015-03-22, v0.20). This branch may be consumed by notmuch-report(1). * Only error for invalid diff lines in tags/ (57225988, 2017-10-16, unreleased). * Ignore # comments in 'notmuch dump ...' output (9bbc54bd, 2016-03-27, v0.22). * Respect 'expect' in _spawn(..., wait=True) (e263c5b1, 2017-10-10, unreleased). * Update URLs in documentation (554b90b5 and 6a833a6e8, 2016-06-02, v0.23).
2017-12-16nmbug: Only error for invalid diff lines in tags/W. Trevor King
Avoid: Traceback (most recent call last): File "/home/nmbug/bin/nmbug", line 834, in <module> args.func(**kwargs) File "/home/nmbug/bin/nmbug", line 385, in checkout status = get_status() File "/home/nmbug/bin/nmbug", line 580, in get_status maybe_deleted = _diff_index(index=index, filter='D') File "/home/nmbug/bin/nmbug", line 658, in _diff_index for id, tag in _unpack_diff_lines(stream=p.stdout): File "/home/nmbug/bin/nmbug", line 678, in _unpack_diff_lines 'Invalid line in diff: {!r}'.format(line.strip())) ValueError: Invalid line in diff: u'.mailmap' With this commit, folks can commit READMEs, .mailmap, etc. to their nmbug repositories, and 'nmbug diff' and 'status' won't choke on them. If you want to check for this sort of thing, you can set --log-level to info or greater. nmbug will still error if the unrecognized path is under tags/, since that's more likely to be a user error.
2017-12-11nmbug: Auto-checkout in clone if it wouldn't clobberW. Trevor King
We currently auto-checkout after pull and merge to make those more convenient. They're guarded against data-loss with a leading _insist_committed(). This commit adds the same convenience to clone, since in most cases users will have no NMBPREFIX-prefixed tags in their database when they clone. Users that *do* have NMBPREFIX-prefixed tags will get a warning (and I've bumped the default log level to warning so folks who don't set --log-level will see it) like: $ nmbug clone http://nmbug.notmuchmail.org/git/nmbug-tags.git Cloning into '/tmp/nmbug-clone.g9dvd0tv'... Checking connectivity: 16674, done. Branch config set up to track remote branch config from origin. Not checking out to avoid clobbering existing tags: notmuch::0.25, ...
2017-12-11nmbug: Accept failures to unset core.worktree in cloneW. Trevor King
Since 6311cfaf (init: do not set unnecessary core.worktree, 2016-09-25, 2.11.0 [1]), Git has no longer set core.worktree when --separate-git-dir is used. This broke clone with: $ nmbug clone http://nmbug.notmuchmail.org/git/nmbug-tags.git Cloning into '/tmp/nmbug-clone.33gg442e'... Checking connectivity: 16674, done. ['git', '--git-dir', '/home/wking/.nmbug', 'config', '--unset', 'core.worktree'] exited with 5 $ echo $? 1 The initial discussion that lead to the Git change is in [2], and there is some more discussion around this specific change in [3]. There is some useful background on working trees in this 2009 message [4]. There is also a git-worktree(1) since df0b6cfb (worktree: new place for "git prune --worktrees", 2015-06-29, 2.5.0 [5]) which grew the ability to add new worktrees in 799767cc (Merge branch 'es/worktree-add', 2015-07-13, 2.5.0 [6]). Folks relying on core.worktree in the --separate-git-dir case fall into the "former case" in [4], and as Junio pointed out in that message, Git operations like 'add' don't really work there. In nmbug we don't want core.worktree, because our effective working tree is the notmuch database. By accepting failed core.worktree unsets, clone will work with Gits older and younger than 2.11.0. [1]: https://github.com/git/git/commit/6311cfaf93716bcc43dd1151cb1763e3f80d8099 [2]: https://public-inbox.org/git/CALqjkKZO_y0DNcRJjooyZ7Eso7yBMGhvZ6fE92oO4Su7JeCeng@mail.gmail.com/ [3]: https://public-inbox.org/git/87h94d8cwi.fsf@kyleam.com/ [4]: https://public-inbox.org/git/7viqbsw2vn.fsf@alter.siamese.dyndns.org/ [5]: https://github.com/git/git/commit/df0b6cfbda88144714541664fb501146d6465a82 [6]: https://github.com/git/git/commit/799767cc98b2f8e6f82d0de4bef9b5e8fcc16e97 Reported-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2017-12-11nmbug: Respect 'expect' in _spawn(..., wait=True)W. Trevor King
Fixing a bug from 7f2cb3be (nmbug: Translate to Python, 2014-10-03). The bug had no direct impact though, because none of the wait=True callers were setting expect. Also add expected codes to the debug messages, to help log readers understand why nonzero exits are occasionally accepted.
2017-08-18Use rooted paths in .gitignore filesVladimir Panteleev
A leading / in paths in a .gitignore file matches the beginning of the path, meaning that for patterns without slashes, git will match files only in the current directory as opposed to in any subdirectory. Prefix relevant paths with / in .gitignore files, to prevent accidentally ignoring files in subdirectories and possibly slightly improve the performance of "git status".
2016-10-04nmbug: Add --no-renames to default log optionsW. Trevor King
Git has supported this since b68ea12e (diff.c: respect diff.renames config option, 2006-07-07, v1.4.2). All of our information is in the paths (the files are empty), so we don't want rename detection. By using --no-renames, we get entries like: $ nmbug log -- e473b453a2 commit e473b453a25c072b5df67d834d822121373321f5 Author: David Bremner <david@tethera.net> Date: Sun Sep 25 07:54:11 2016 -0300 D tags/1474196252-31700-1-git-send-email-markwalters1009@gmail.com/0.23 A tags/1474196252-31700-1-git-send-email-markwalters1009@gmail.com/pushed ... Instead of the old: $ nmbug log -- e473b453a2 commit e473b453a25c072b5df67d834d822121373321f5 Author: David Bremner <david@tethera.net> Date: Sun Sep 25 07:54:11 2016 -0300 R100 tags/1474196252-31700-1-git-send-email-markwalters1009@gmail.com/0.23 tags/1474196252-31700-1-git-send-email-markwalters1009@gmail.com/pushed
2016-06-05Use https instead of http where possibleDaniel Kahn Gillmor
Many of the external links found in the notmuch source can be resolved using https instead of http. This changeset addresses as many as i could find, without touching the e-mail corpus or expected outputs found in tests.
2016-06-05nmbug: updated to modern URL for PEP 343Daniel Kahn Gillmor
2016-03-28nmbug: ignore # commentsDavid Bremner
Lines starting with # have always (for a long time, anyway) been ignored by notmuch-restore, but have not been generated by notmuch-dump previously. In order to make nmbug robust against such output, ignore comment lines.
2016-03-24notmuch-report: Add notmuch-report(1) and notmuch-report.json(5) man pagesW. Trevor King
To describe the script and config file format, so folks don't have to dig through NEWS or the script's source to get that information. The Makefile and conf.py are excerpted from the main doc/ directory with minor simplifications and adjustments. The devel/nmbug/ scripts are largely independent of notmuch, and separating the docs here allows packagers to easily build the docs and install the scripts in a separate package, without complicating notmuch's core build/install process.
2016-03-24notmuch-report.json: Rename from status-config.jsonW. Trevor King
status-config.json wasn't obviously associated with the old nmubg-status, now notmuch-report. The new name is ${CONFIGURED_SCRIPT}.json, so the association should be clear.
2016-03-24notmuch-report: Rename from nmbug-statusW. Trevor King
This script generates reports based on notmuch queries, and doesn't really have anything to do with nmbug, except for sharing the NMBGIT environment variable.
2016-03-24status-config.json: Remove parens from query entryW. Trevor King
These are now added by nmbug-status.
2016-03-24nmbug-status: Wrap query phrases in parentheses when and-ing togetherW. Trevor King
For example: "query": ["tag:a", "tag:b or tag:c"] is now converted to: ( tag:a ) and ( tag:b or tag:c ) instead of the old: tag:a and tag:b or tag:c This helps us avoid confusion due to Xapian's higher-precedence AND [1], where the old query would be interpreted as: ( tag:a and tag:b ) or tag:c [1]: http://xapian.org/docs/queryparser.html
2016-03-24nmbug-status: Add meta.message-url config settingW. Trevor King
So you can link to archives other than Gmane. For example, I'm doing this in [1]. [1]: https://github.com/wking/nmbug-oci
2016-01-13nmbug-status: Fix unbalanced <p> tags in default header/footerW. Trevor King
These were broken by b70386a4 (Move the generated date from the top of the page to the footer, 2014-05-31), which moved 'Generated ...' to the footer with the opening tag, but didn't replace the blurb opening tag or add a closing tag after 'Generated ...'.
2016-01-13nmbug-status: Style headers with smaller fontsW. Trevor King
We only use h1 through h3, and David prefers smaller headers [1], so shift over to the font sizes usually used for h2 through h4 [2,3,4]. I haven't bothered with the W3C's default margins, since a bit of extra whitespace doesn't seem like a big deal. [1]: id:87k2nl8r0k.fsf@zancas.localnet http://article.gmane.org/gmane.mail.notmuch.general/21595 [2]: http://www.w3.org/TR/html-markup/h2.html [3]: http://www.w3.org/TR/html-markup/h3.html [4]: http://www.w3.org/TR/html-markup/h4.html
2016-01-13nmbug-status: Adjust headers to start with h1W. Trevor King
We've been leading off with h2s since 3e5fb88f (contrib/nmbug: add nmbug-status script, 2012-07-07), but the semantically-correct headers are: <h1>{title}</h1> ... <h2>Views</h2> ... <h3>View 1</h3> ... <h3>View 2</h3> ... We can always add additional CSS if the default h1 formatting is too intense.
2016-01-07nmbug-status: Avoid hard-coded filename in error messageW. Trevor King
We already have a 'filename' variable with the name, so stay DRY and use that variable here. Also fix a missing-whitespace error from bed8b674 (nmbug-status: Clarify errors for illegible configs, 2014-05-10), wrapping on the sentence to match similar error-generation earlier in this function.
2015-10-04nmbug-status: print config errors to stderrJani Nikula
Particularly scripted usage with stdout redirection can be confusing if errors are printed to stdout instead of stderr.
2015-09-29nmbug-status: add support for specifying sort order for each viewJani Nikula
Let each view have a "sort" key, typically used with values "oldest-first" or "newest-first" (although all values in Query.SORT are accepted), and sort the results accordingly. Oldest first remains the default. The dynamic approach of mapping sort values is as suggested by W. Trevor King <wking@tremily.us>.
2015-04-01nmbug-status: Use 'show-ref --heads' for loading configsW. Trevor King
When loading configs from Git, the bare branch name (without a refs/heads/ prefix or similar) matches all branches of that name (including remote-tracking branches): .nmbug $ git show-ref config 48f3bbf1d1492e5f3d2f01de6ea79a30d3840f20 refs/heads/config 48f3bbf1d1492e5f3d2f01de6ea79a30d3840f20 refs/remotes/origin/config 4b6dbd9ffd152e7476f5101eff26747f34497cee refs/remotes/wking/config Instead of relying on the ordering of the matching references, use --heads to ensure we only match local branches.
2015-03-15nmbug-status: Clarify errors for illegible configsW. Trevor King
Carl Worth pointed out that errors like: $ ./nmbug-status fatal: Not a git repository: '/home/cworth/.nmbug' fatal: Not a git repository: '/home/cworth/.nmbug' Traceback (most recent call last): File "./nmbug-status", line 254, in <module> config = read_config(path=args.config) File "./nmbug-status", line 73, in read_config return json.load(fp) File "/usr/lib/python2.7/json/__init__.py", line 290, in load **kw) File "/usr/lib/python2.7/json/__init__.py", line 338, in loads return _default_decoder.decode(s) File "/usr/lib/python2.7/json/decoder.py", line 366, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode raise ValueError("No JSON object could be decoded") ValueError: No JSON object could be decoded are not particularly clear. With this commit, we'll get output like: $ ./nmbug-status fatal: Not a git repository: '/home/wking/.nmbug' No local branch 'config' in /home/wking/.nmbug. Checkout a local config branch or explicitly set --config. which is much more accessible. I've also added user-friendly messages for a number of other config-parsing errors.
2015-01-18nmbug: Add a 'help' command for folks who don't like --helpW. Trevor King
The 'if args.func == help' block at the end avoids: AttributeError: 'functools.partial' object has no attribute '__code__'
2014-10-05nmbug: Translate to PythonW. Trevor King
This allows us to capture stdout and stderr separately, and do other explicit subprocess manipulation without resorting to external packages. It should be compatible with Python 2.7 and later (including the 3.x series). Most of the user-facing interface is the same, but there are a few changes, where reproducing the original interface was too difficult or I saw a change to make the underlying Git UI accessible: * 'nmbug help' has been split between the general 'nmbug --help' and the command-specific 'nmbug COMMAND --help'. * Commands are no longer split into "most common", "other useful", and "less common" sets. If we need something like this, I'd prefer workflow examples highlighting common commands in the module docstring (available with 'nmbug --help'). * 'nmbug commit' now only uses a single argument for the optional commit-message text. I wanted to expose more of the underlying 'git commit' UI, since I personally like to write my commit messages in an editor with the notes added by 'git commit -v' to jog my memory. Unfortunately, we're using 'git commit-tree' instead of 'git commit', and commit-tree is too low-level for editor-launching. I'd be interested in rewriting commit() to use 'git commit', but that seemed like it was outside the scope of this rewrite. So I'm not supporting all of Git's commit syntax in this patch, but I can at least match 'git commit -m MESSAGE' in requiring command-line commit messages to be a single argument. * The default repository for 'nmbug push' and 'nmbug fetch' is now the current branch's upstream (branch.<name>.remote) instead of 'origin'. When we have to, we extract this remote by hand, but where possible we just call the Git command without a repository argument, and leave it to Git to figure out the default. * 'nmbug push' accepts multiple refspecs if you want to explicitly specify what to push. Otherwise, the refspec(s) pushed depend on push.default. The Perl version hardcoded 'master' as the pushed refspec. * 'nmbug pull' defaults to the current branch's upstream (branch.<name>.remote and branch.<name>.merge) instead of hardcoding 'origin' and 'master'. It also supports multiple refspecs if for some crazy reason you need an octopus merge (but mostly to avoid breaking consistency with 'git pull'). * 'nmbug log' now execs 'git log', as there's no need to keep the Python process around once we've launched Git there. * 'nmbug status' now catches stderr, and doesn't print errors like: No upstream configured for branch 'master' The Perl implementation had just learned to avoid crashing on that case, but wasn't yet catching the dying subprocess's stderr. * 'nmbug archive' now accepts positional arguments for the tree-ish and additional 'git archive' options. For example, you can run: $ nmbug archive HEAD -- --format tar.gz I wish I could have preserved the argument order from 'git archive' (with the tree-ish at the end), but I'm not sure how to make argparse accept arbitrary possitional arguments (some of which take arguments). Flipping the order to put the tree-ish first seemed easiest. * 'nmbug merge' and 'pull' no longer checkout HEAD before running their command, because blindly clobbering the index seems overly risky. * In order to avoid creating a dirty index, 'nmbug commit' now uses the default index (instead of nmbug.index) for composing the commit. That way the index matches the committed tree. To avoid leaving a broken index after a failed commit, I've wrapped the whole thing in a try/except block that resets the index to match the pre-commit treeish on errors. That means that 'nmbug commit' will ignore anything you've cached in the index via direct Git calls, and you'll either end up with an index matching your notmuch tags and the new HEAD (after a successful commit) or an index matching the original HEAD (after a failed commit).
2014-07-16nmbug: Handle missing @upstream in is_unmergedW. Trevor King
If we don't have an upstream, there is nothing to merge, so nothing is unmerged. This avoids errors like: $ nmbug status error: No upstream configured for branch 'master' error: No upstream configured for branch 'master' fatal: ambiguous argument '@{upstream}': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]' 'git rev-parse @{upstream}' exited with nonzero value You might not have an upstream if you're only using nmbug locally to version-control your tags.
2014-07-16nmbug: Add a git_with_status helper functionW. Trevor King
Sometimes we want to catch Git errors and handle them, instead of dying with an error message. This lower-level version of git() allows us to get the error status when we want it.
2014-07-15nmbug-status: Optionally load the header and footer templates from the configW. Trevor King
For folks that don't like the default templates for whatever reason.
2014-07-15nmbug-status: Add the time to the footer's build-dateW. Trevor King
Our repository [1] has a post-update hook that rebuilds the status page after each push. Since that may happen several times a day, we might as well show the build time (as well as the date) in the footer. The trailing 'Z' is the ISO 8601 designator for UTC. Now that we're showing times, it's nice to be explicit about the timezone we're using. The rename from date -> datetime gives us backward-compatibility for folks that *do* only want the date. We keep the old date formatting to support those folks. [1]: http://nmbug.tethera.net/git/nmbug-tags.git
2014-07-15nmbug-status: Factor out header/footer context into a shared dictW. Trevor King
Rather than splitting this context into header-only and footer-only groups, just dump it all in a shared dict. This will make it easier to eventually split the header/footer templates out of this script (e.g. if we want to load them from the config file).
2014-07-15Move the generated date from the top of the page to the footer.Carl Worth
It's useful reference information, but anyone who wants it will look for and find it. We don't need this front-and-center. Follow the pattern set by our header template with a triple-quoted string. The gray <hr> styling is less agressive. IE uses 'color' for drawing the rule, while Gecko and Opera use the border or 'background-color' [1]. [1]: https://bugzilla.mozilla.org/show_bug.cgi?id=239386
2014-07-15Add a docstring describing the programCarl Worth
Prefer a docstring to a header comment so we can use it as the ArgumentParser description (formatted with 'nmbug-status --help'). Script readers still have it near the top of the file. Since it's a docstring, use PEP 257's summary-line-and-body format [1]. [1]: http://legacy.python.org/dev/peps/pep-0257/#multi-line-docstrings
2014-07-15Add explicit license informationCarl Worth
It's nice to have for situations where this script is found outside of the notmuch source repository (e.g. after being installed).
2014-04-15nmbug: mark repository as bare on cloneDavid Bremner
If a git repository is non-bare, and core.worktree is not set, git tries to deduce the worktree. This deduction is not always helpful, e.g. % git --git-dir=$HOME/.nmbug clean -f would likely delete most of the files in the current directory
2014-04-08nmbug: Add 'clone' and replace FETCH_HEAD with @{upstream}W. Trevor King
With two branches getting fetched (master and config), the branch referenced by FETCH_HEAD is ambiguous. For example, I have: $ cat FETCH_HEAD 41d7bfa7184cc93c9dac139d1674e9530799e3b0 \ not-for-merge branch 'config' of http://nmbug.tethera.net/git/nmbug-tags acd379ccb973c45713eee9db177efc530f921954 \ not-for-merge branch 'master' of http://nmbug.tethera.net/git/nmbug-tags (where I wrapped the line by hand). This means that FETCH_HEAD references the config branch: $ git rev-parse FETCH_HEAD 41d7bfa7184cc93c9dac139d1674e9530799e3b0 which breaks all of the FETCH_HEAD logic in nmbug (where FETCH_HEAD is assumed to point to the master branch). Instead of relying on FETCH_HEAD, use @{upstream} as the remote-tracking branch that should be merged/diffed/integrated into HEAD. @{upstream} was added in Git v1.7.0 (2010-02-12) [1], so relying on it should be fairly safe. One tricky bit is that bare repositories don't set upstream tracking branches by default: $ git clone --bare http://nmbug.tethera.net/git/nmbug-tags.git nmbug-bare $ cd nmbug-bare $ git remote show origin * remote origin Fetch URL: http://nmbug.tethera.net/git/nmbug-tags.git Push URL: http://nmbug.tethera.net/git/nmbug-tags.git HEAD branch: master Local refs configured for 'git push': config pushes to config (up to date) master pushes to master (up to date) While in a non-bare clone: $ git clone http://nmbug.tethera.net/git/nmbug-tags.git $ cd nmbug-tags $ git remote show origin * remote origin Fetch URL: http://nmbug.tethera.net/git/nmbug-tags.git Push URL: http://nmbug.tethera.net/git/nmbug-tags.git HEAD branch: master Remote branches: config tracked master tracked Local branch configured for 'git pull': master merges with remote master Local ref configured for 'git push': master pushes to master (up to date) From the clone docs [2]: --bare:: Make a 'bare' Git repository… Also the branch heads at the remote are copied directly to corresponding local branch heads, without mapping them to `refs/remotes/origin/`. When this option is used, neither remote-tracking branches nor the related configuration variables are created. To use @{upstream}, we need to the local vs. remote-tracking distinction, so this commit adds 'nmbug clone', replacing the previously suggested --bare clone with a non-bare --no-checkout --separate-git-dir clone into a temporary work directory. After which: $ git rev-parse @{upstream} acd379ccb973c45713eee9db177efc530f921954 gives us the master-branch commit. Existing nmbug users will have to run the configuration tweaks and re-fetch by hand. If you don't have any local commits, you could also blow away your NMBGIT repository and re-clone from scratch: $ nmbug clone http://nmbug.tethera.net/git/nmbug-tags.git Besides removing the ambiguity of FETCH_HEAD, this commit allows users to configure which upstream branch they want nmbug to track via 'git config', in case they want to change their upstream repository. [1]: http://git.kernel.org/cgit/git/git.git/tree/Documentation/RelNotes/1.7.0.txt [2]: http://git.kernel.org/cgit/git/git.git/tree/Documentation/git-clone.txt
2014-03-23nmbug-status: make output title and blurb configurableJani Nikula
Make nmbug-status more generally usable outside of nmbug by not hardcoding notmuch related things. This lets anyone publish html search views to mailing list messages with a custom config file, independent of nmbug.
2014-03-23nmbug-status: parameterize title and blurb in the page headerJani Nikula
Prepare for more general use.
2014-02-21nmbug-status: replace __values__() with values() in OrderedDict stubTomi Ollila
Python dict() object does not have __values__() function which OrderedDict().values() (the stub provided in nmbug-status) could call to provide ordered list of values. By renaming this thinko to values() will make our stub work as expected -- dict items listed out in order those were added to the dictionary.
2014-02-14nmbug-status: Hardcode UTF-8 instead of using the user's localeW. Trevor King
David [1] and Tomi [2] both feel that the user's choice of LANG is not explicit enough to have such a strong effect on nmbug-status. For example, cron jobs usually default to LANG=C, and that is going to give you ASCII output: $ LANG=C python -c 'import locale; print(locale.getpreferredencoding())' ANSI_X3.4-1968 Trying to print Unicode author names (and other strings) in that encoding would crash nmbug-status with a UnicodeEncodeError. To avoid that, this patch hardcodes UTF-8, which can handle generic Unicode, and is the preferred encoding (regardless of LANG settings) for everyone who has chimed in on the list so far. I'd prefer trusting LANG, but in the absence of any users that prefer non-UTF-8 encodings I'm fine with this approach. While we could achieve the same effect on the output content by dropping the previous patch (nmbug-status: Encode output using the user's locale), Tomi also wanted UTF-8 hardcoded as the config-file encoding [2]. Keeping the output encoding patch and then adding this to hardcode both the config-file and output encodings at once seems the easiest route, now that fd29d3f (nmbug-status: Decode Popen output using the user's locale, 2014-02-10) has landed in master. [1]: id="877g8z4v4x.fsf@zancas.localnet" http://article.gmane.org/gmane.mail.notmuch.general/17202 [2]: id="m2vbwj79lu.fsf@guru.guru-group.fi" http://article.gmane.org/gmane.mail.notmuch.general/17209
2014-02-14nmbug-status: Encode output using the user's localeW. Trevor King
Instead of always writing UTF-8, allow the user to configure the output encoding using their locale. This is useful for previewing output in the terminal, for poor souls that don't use UTF-8 locales ;).
2014-02-14nmbug-status: Add inter-message paddingW. Trevor King
We already had the tbody with a blank row separating threads (which is not colored); this commit adds a bit of spacing to separate messages within a thread. It will also add a bit of colored padding above the first message and below the final message, but the main goal is to add padding *between* two-row message blocks. <--- new padding thread-1, message-1, row-1 (class="message-first") thread-1, message-1, row-2 (class="message-last") <--- new padding spacer tbody with a blank row <--- new padding thread-2, message-1, row-1 (class="message-first") thread-2, message-1, row-2 (class="message-last") <--- new padding <--- new padding thread-2, message-2, row-1 (class="message-first") thread-2, message-2, row-2 (class="message-last") <--- new padding
2014-02-14nmbug-status: Color threads in HTML outputW. Trevor King
Add tbody sections so we don't have to color every row. Multiple tbody sections are allowed [1]. Use CSS 3's nth-child to handle even/odd coloring (skipping the spacer rows) [2], which is supported on the major browsers [3]. border-spacing is from CCS 2.1 [4,5]. I'm using it to avoid whitespace between td cells. border-radius is from CCS 3 [6,7]. I'm using it to make the colored sections a bit less harsh. I tried adding rounded borders to the tbody itself doesn't work, but I couldn't get that to work without setting the tbody's display to 'block'. That rounded the corners, but collapsed the cell spacing (e.g. columns were no longer aligned). This commit's by-corner-td approach is not particularly elegant, but it works. The td padding entries just ensure that the cell body is suitably far from the edges that it doesn't fall outside of the rounded corners. The doubled-braces are escapes from Python's str.format. [1]: http://www.w3.org/TR/html5/tabular-data.html#the-table-element [2]: http://www.w3.org/TR/css3-selectors/#nth-child-pseudo [3]: https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-child#Browser_compatibility [4]: http://www.w3.org/TR/CSS2/tables.html#propdef-border-spacing [5]: https://developer.mozilla.org/en-US/docs/Web/CSS/border-spacing#Browser_compatibility [6]: http://www.w3.org/TR/css3-background/#the-border-radius [7]: https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius#Browser_compatibility
2014-02-14nmbug-status: Escape &, <, and > in HTML display dataW. Trevor King
'message-id' and 'from' now have sensitive characters escaped using xml.sax.saxutils.escape [1]. The 'subject' data was already being converted to a link into Gmane; I've escape()d that too, so it doesn't need to be handled ain the same block as 'message-id' and 'from'. This prevents broken HTML by if subjects etc. contain characters that would otherwise be interpreted as HTML markup. [1]: http://docs.python.org/3/library/xml.sax.utils.html#xml.sax.saxutils.escape
2014-02-13nmbug-status: Use <code> and <p> markup where appropriateW. Trevor King
* Wrap free text in <p> tags. * Convert <blockquote> to <p><code> for query strings. * Wrap message-id-term (id:"...") in <code>. The <code> tags get nicer default markup (smaller monospace font) for notmuch query terms [1]. The <p> tags don't have much effect without attached CSS, but bare text (phrasing content [2]) in <body> (which expects flow content [3,4]) feels wrong. [1]: http://www.w3.org/TR/html5/text-level-semantics.html#the-code-element [2]: http://www.w3.org/TR/html5/dom.html#phrasing-content-1 [3]: http://www.w3.org/TR/html5/dom.html#flow-content-1 [4]: http://www.w3.org/TR/html5/sections.html#the-body-element