Mercurial > hg
view contrib/hg-test-mode.el @ 22196:23fe278bde43
largefiles: keep largefiles from colliding with normal one during linear merge
Before this patch, linear merging of modified or newly added largefile
causes unexpected result, if (1) largefile collides with same name
normal one in the target revision and (2) "local" largefile is chosen,
even though branch merging between such revisions doesn't.
Expected result of such linear merging is:
(1) (not yet recorded) largefile is kept in the working directory
(2) largefile is marked as (re-)"added"
(3) colliding normal file is marked as "removed"
But actual result is:
(1) largefile in the working directory is unlinked
(2) largefile is marked as "normal" (so treated as "missing")
(3) the dirstate entry for colliding normal file is just dropped
(1) is very serious, because there is no way to restore temporarily
modified largefiles.
(3) prevents the next commit from adding the manifest with correct
"removal of (normal) file" information for newly created changeset.
The root cause of this problem is putting "lfile" into "actions['r']"
in linear-merging case. At liner merging, "actions['r']" causes:
- unlinking "target file" in the working directory, but "lfile" as
"target file" is also largefile itself in this case
- dropping the dirstate entry for target file
"actions['f']" (= "forget") does only the latter, and this is reason
why this patch doesn't choose putting "lfile" into it instead of
"actions['r']".
This patch newly introduces action "lfmr" (LargeFiles: Mark as
Removed) to mark colliding normal file as "removed" without unlinking
it.
This patch uses "hg debugdirstate" instead of "hg status" in test,
because:
- choosing "local largefile" hides "removed" status of "remote
normal file" in "hg status" output, and
- "hg status" for "large2" in this case has another problem fixed in
the subsequent patch
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Fri, 15 Aug 2014 20:28:51 +0900 |
parents | 7fce964be27d |
children | b6a757de2fff |
line wrap: on
line source
;; 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) '("^ \\([[][0-9]+[]]\\)$" 1 font-lock-warning-face) '("^ \\(.*?\\)\\(\\( [(][-a-z]+[)]\\)*\\)$" 1 font-lock-string-face) '("\\$?\\(HG\\|TEST\\)\\w+=?" . font-lock-variable-name-face) '("^ \\(.*?\\)\\(\\( [(][-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)) (provide 'hg-test-mode)