branch: externals/vc-hgcmd commit da539aaa348ac55c9f2d09fee10b51300f34106a Author: muffinmad <andreyk....@gmail.com> Commit: muffinmad <andreyk....@gmail.com>
Skip lines with unknow status while parsing 'hg status' With 'ui.verbose' option turned on there are some additional lines in 'status' output: ``` # The repository is in an unfinished *merge* state. # Unresolved merge conflicts: # # .hgtags # main.py # # To mark files as resolved: hg resolve --mark FILE # To continue: hg commit # To abort: hg merge --abort ``` --- vc-hgcmd.el | 51 ++++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/vc-hgcmd.el b/vc-hgcmd.el index 0498696..50e5808 100644 --- a/vc-hgcmd.el +++ b/vc-hgcmd.el @@ -5,7 +5,7 @@ ;; Author: Andrii Kolomoiets <andreyk....@gmail.com> ;; Keywords: vc ;; URL: https://github.com/muffinmad/emacs-vc-hgcmd -;; Package-Version: 1.9.2 +;; Package-Version: 1.9.3 ;; Package-Requires: ((emacs "25.1")) ;; This file is NOT part of GNU Emacs. @@ -649,30 +649,31 @@ Insert output to process buffer and check if amount of data is enought to parse (conflicted (mapcar #'car conflicted))) (goto-char (point-min)) (while (not (eobp)) - (let ((file (buffer-substring-no-properties (+ (point) 2) (line-end-position))) - (status (cdr (assoc (char-after) vc-hgcmd--translation-status)))) - (unless (or (member file conflicted) (eq status 'origin)) - (push (list - file - status - (pcase status - ('added (save-excursion - (forward-line) - (when (and (point-at-bol) - (eq 'origin (cdr (assoc (char-after) vc-hgcmd--translation-status)))) - (let ((origin (buffer-substring-no-properties (+ (point) 2) (line-end-position)))) - (vc-hgcmd-create-extra-fileinfo - (if (re-search-forward (concat "^R " (regexp-quote origin) "$") nil t) - 'renamed-from - 'copied) - origin))))) - ('removed (save-excursion - (when (re-search-backward (concat "^ " (regexp-quote file) "$") nil t) - (forward-line -1) - (vc-hgcmd-create-extra-fileinfo - 'renamed-to - (buffer-substring-no-properties (+ (point) 2) (line-end-position)))))))) - result))) + (let ((status (cdr (assoc (char-after) vc-hgcmd--translation-status)))) + (when status + (let ((file (buffer-substring-no-properties (+ (point) 2) (line-end-position)))) + (unless (or (member file conflicted) (eq status 'origin)) + (push (list + file + status + (pcase status + ('added (save-excursion + (forward-line) + (when (and (point-at-bol) + (eq 'origin (cdr (assoc (char-after) vc-hgcmd--translation-status)))) + (let ((origin (buffer-substring-no-properties (+ (point) 2) (line-end-position)))) + (vc-hgcmd-create-extra-fileinfo + (if (re-search-forward (concat "^R " (regexp-quote origin) "$") nil t) + 'renamed-from + 'copied) + origin))))) + ('removed (save-excursion + (when (re-search-backward (concat "^ " (regexp-quote file) "$") nil t) + (forward-line -1) + (vc-hgcmd-create-extra-fileinfo + 'renamed-to + (buffer-substring-no-properties (+ (point) 2) (line-end-position)))))))) + result))))) (forward-line)) (funcall update-function result)))