##// END OF EJS Templates
fix: add a -s option to format a revision and its descendants...
fix: add a -s option to format a revision and its descendants `hg fix -r abc123` will format that commit but not its descendants. That seems expected given the option name (`-r`), but it's very rarely what the user wants to do. The problem is that any descendants of that commit will not be formatted, leaving them as orphans that are hard to evolve. They are hard to evolve because the new parent will have formatting changes that the orphan doesn't have. I talked to Danny Hooper (who wrote most of the fix extension) about the problem and we agreed that deprecating `-r` in favor of a new `-s` argument (mimicing rebase's `-s`) would be a good way of reducing the risk that users end up with these hard-to-evolve orphans. So that's what this patch implements. Differential Revision: https://phab.mercurial-scm.org/D8287

File last commit:

r41954:19979b8b default
r45064:5205b46b default
Show More
hg-test-mode.el
97 lines | 3.6 KiB | text/x-common-lisp | EmacsLispLexer
Matt Mackall
contrib: add emacs mode for *.t files
r22081 ;; hg-test-mode.el - Major mode for editing Mercurial tests
;;
;; Copyright 2014 Matt Mackall <mpm@selenic.com>
;; "I have no idea what I'm doing"
;;
;; This software may be used and distributed according to the terms of the
;; GNU General Public License version 2 or any later version.
;;
;; To enable, add something like the following to your .emacs:
;;
;; (if (file-exists-p "~/hg/contrib/hg-test-mode.el")
;; (load "~/hg/contrib/hg-test-mode.el"))
(defvar hg-test-mode-hook nil)
(defvar hg-test-mode-map
(let ((map (make-keymap)))
(define-key map "\C-j" 'newline-and-indent)
map)
"Keymap for hg test major mode")
(add-to-list 'auto-mode-alist '("\\.t\\'" . hg-test-mode))
(defconst hg-test-font-lock-keywords-1
(list
'("^ \\(\\$\\|>>>\\) " 1 font-lock-builtin-face)
'("^ \\(>\\|\\.\\.\\.\\) " 1 font-lock-constant-face)
Matt Mackall
hg-test-mode: make exit code highlight work again
r22125 '("^ \\([[][0-9]+[]]\\)$" 1 font-lock-warning-face)
Matt Mackall
hg-test-mode: don't highlight variables in output...
r22109 '("^ \\(.*?\\)\\(\\( [(][-a-z]+[)]\\)*\\)$" 1 font-lock-string-face)
Matt Mackall
hg-test-mode: colorize HGFOO and TESTFOO environment variables
r22092 '("\\$?\\(HG\\|TEST\\)\\w+=?" . font-lock-variable-name-face)
Matt Mackall
contrib: add emacs mode for *.t files
r22081 '("^ \\(.*?\\)\\(\\( [(][-a-z]+[)]\\)+\\)$" 2 font-lock-type-face)
'("^#.*" . font-lock-preprocessor-face)
'("^\\([^ ].*\\)$" 1 font-lock-comment-face)
)
"Minimal highlighting expressions for hg-test mode")
(defvar hg-test-font-lock-keywords hg-test-font-lock-keywords-1
"Default highlighting expressions for hg-test mode")
(defvar hg-test-mode-syntax-table
(let ((st (make-syntax-table)))
(modify-syntax-entry ?\" "w" st) ;; disable standard quoting
st)
"Syntax table for hg-test mode")
(defun hg-test-mode ()
(interactive)
(kill-all-local-variables)
(use-local-map hg-test-mode-map)
(set-syntax-table hg-test-mode-syntax-table)
(set (make-local-variable 'font-lock-defaults) '(hg-test-font-lock-keywords))
(setq major-mode 'hg-test-mode)
(setq mode-name "hg-test")
(run-hooks 'hg-test-mode-hook))
Augie Fackler
contrib: add compilation-mode linking for our test output...
r41951 (with-eval-after-load "compile"
Augie Fackler
contrib: also linkify tracebacks in compilation output when using hg-test-mode...
r41952 ;; Link to Python sources in tracebacks in .t failures.
(add-to-list 'compilation-error-regexp-alist-alist
'(hg-test-output-python-tb
"^\\+ +File ['\"]\\([^'\"]+\\)['\"], line \\([0-9]+\\)," 1 2))
(add-to-list 'compilation-error-regexp-alist 'hg-test-output-python-tb)
Augie Fackler
contrib: add compilation-mode linking for our test output...
r41951 ;; Link to source files in test-check-code.t violations.
(add-to-list 'compilation-error-regexp-alist-alist
'(hg-test-check-code-output
"\\+ \\([^:\n]+\\):\\([0-9]+\\):$" 1 2))
(add-to-list 'compilation-error-regexp-alist 'hg-test-check-code-output))
Augie Fackler
tests: add test for hg-test-mode emacs code...
r41954 (defun hg-test-mode--test-one-error-line-regexp (test)
(erase-buffer)
(setq compilation-locs (make-hash-table))
(insert (car test))
(compilation-parse-errors (point-min) (point-max))
(let ((msg (get-text-property 1 'compilation-message)))
(should msg)
(let ((loc (compilation--message->loc msg))
(line (nth 1 test))
(file (nth 2 test)))
(should (equal (compilation--loc->line loc) line))
(should (equal (caar (compilation--loc->file-struct loc)) file)))
msg))
(require 'ert)
(ert-deftest hg-test-mode--compilation-mode-support ()
"Test hg-specific compilation-mode regular expressions"
(require 'compile)
(with-temp-buffer
(font-lock-mode -1)
(mapc 'hg-test-mode--test-one-error-line-regexp
'(
("+ contrib/debugshell.py:37:" 37 "contrib/debugshell.py")
("+ File \"/tmp/hg/mercurial/commands.py\", line 3115, in help_"
3115 "/tmp/hg/mercurial/commands.py")
("+ File \"mercurial/dispatch.py\", line 225, in dispatch"
225 "mercurial/dispatch.py")))))
Matt Mackall
contrib: add emacs mode for *.t files
r22081 (provide 'hg-test-mode)