Mercurial > hg
view contrib/hg-test-mode.el @ 25774:4f8c20fe66f0
shelve: keep old backups if timestamp can't decide exact order of them
Before this patch, backups to be discarded are decided by steps below
at 'hg unshelve' or so:
1. list '(st_mtime, filename)' tuples of each backups up
2. sort list of these tuples, and
3. discard backups other than 'maxbackups' ones at the end of list
This doesn't work well in the case below:
- "sort by name" order differs from actual backup-ing order, and
- some of backups have same timestamp
For example, 'test-shelve.t' satisfies the former condition:
- 'default-01' < 'default-1' in "sort by name" order
- 'default-1' < 'default-01' in actual backup-ing order
Then, 'default-01' is discarded instead of 'default-1' unexpectedly,
if they have same timestamp. This failure appears occasionally,
because the most important condition "same timestamp" is timing
critical.
To avoid such unexpected discarding, this patch keeps old backups if
timestamp can't decide exact order of them.
Timestamp of the border backup (= the oldest one of recent
'maxbackups' ones) as 'bordermtime' is used to examine whether
timestamp can decide exact order of backups.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Mon, 13 Jul 2015 23:34:12 +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)