aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/vc/log-edit.el38
-rw-r--r--lisp/vc/vc-dispatcher.el10
2 files changed, 30 insertions, 18 deletions
diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el
index e74ca7267c5..f82c7e9052e 100644
--- a/lisp/vc/log-edit.el
+++ b/lisp/vc/log-edit.el
@@ -917,21 +917,8 @@ where LOGBUFFER is the name of the ChangeLog buffer, and each
917 (log-edit-narrow-changelog) 917 (log-edit-narrow-changelog)
918 (goto-char (point-min)) 918 (goto-char (point-min))
919 919
920 ;; Search for the name of FILE relative to the ChangeLog. If that 920 (let ((pattern (log-edit-changelog--pattern file
921 ;; doesn't occur anywhere, they're not using full relative 921 changelog-file-name)))
922 ;; filenames in the ChangeLog, so just look for FILE; we'll accept
923 ;; some false positives.
924 (let ((pattern (file-relative-name
925 file (file-name-directory changelog-file-name))))
926 (if (or (string= pattern "")
927 (not (save-excursion
928 (search-forward pattern nil t))))
929 (setq pattern (file-name-nondirectory file)))
930
931 (setq pattern (concat "\\(^\\|[^[:alnum:]]\\)"
932 (regexp-quote pattern)
933 "\\($\\|[^[:alnum:]]\\)"))
934
935 (let (texts 922 (let (texts
936 (pos (point))) 923 (pos (point)))
937 (while (and (not (eobp)) (re-search-forward pattern nil t)) 924 (while (and (not (eobp)) (re-search-forward pattern nil t))
@@ -946,6 +933,25 @@ where LOGBUFFER is the name of the ChangeLog buffer, and each
946 933
947 (cons (current-buffer) texts))))))))) 934 (cons (current-buffer) texts)))))))))
948 935
936(defun log-edit-changelog--pattern (file changelog-file-name)
937 (if (eq (aref file (1- (length file))) ?/)
938 ;; Match any files inside this directory.
939 (concat "^\t\\* " (unless (string= file "./") file))
940 ;; Search for the name of FILE relative to the ChangeLog. If that
941 ;; doesn't occur anywhere, they're not using full relative
942 ;; filenames in the ChangeLog, so just look for FILE; we'll accept
943 ;; some false positives.
944 (let ((pattern (file-relative-name
945 file (file-name-directory changelog-file-name))))
946 ;; FIXME: When can the above return an empty string?
947 (if (or (string= pattern "")
948 (not (save-excursion
949 (search-forward pattern nil t))))
950 (setq pattern (file-name-nondirectory file)))
951 (setq pattern (concat "\\(^\\|[^[:alnum:]]\\)"
952 (regexp-quote pattern)
953 "\\($\\|[^[:alnum:]]\\)")))))
954
949(defun log-edit-changelog-insert-entries (buffer beg end &rest files) 955(defun log-edit-changelog-insert-entries (buffer beg end &rest files)
950 "Insert the text from BUFFER between BEG and END. 956 "Insert the text from BUFFER between BEG and END.
951Rename relative filenames in the ChangeLog entry as FILES." 957Rename relative filenames in the ChangeLog entry as FILES."
@@ -957,6 +963,8 @@ Rename relative filenames in the ChangeLog entry as FILES."
957 (setq bound (point-marker)) 963 (setq bound (point-marker))
958 (when log-name 964 (when log-name
959 (dolist (f files) 965 (dolist (f files)
966 ;; FIXME: f can be a directory, a (possibly indirect) parent
967 ;; of the ChangeLog file.
960 (save-excursion 968 (save-excursion
961 (goto-char opoint) 969 (goto-char opoint)
962 (when (re-search-forward 970 (when (re-search-forward
diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el
index 8b3e888f700..a2c1cba5fde 100644
--- a/lisp/vc/vc-dispatcher.el
+++ b/lisp/vc/vc-dispatcher.el
@@ -606,9 +606,13 @@ NOT-URGENT means it is ok to continue if the user says not to save."
606 (not (equal vc-log-fileset fileset)))) 606 (not (equal vc-log-fileset fileset))))
607 `((log-edit-listfun 607 `((log-edit-listfun
608 . (lambda () 608 . (lambda ()
609 ;; FIXME: Should expand the list for directories. 609 ;; FIXME: When fileset includes directories, and
610 ;; Is the above still relevant? If so, it needs a 610 ;; there are relevant ChangeLog files inside their
611 ;; better explanation. -- dgutov 611 ;; children, we don't find them. Either handle it
612 ;; in `log-edit-insert-changelog-entries' by
613 ;; walking down the file trees, or somehow pass
614 ;; `fileset-only-files' from `vc-next-action'
615 ;; through to this function.
612 (let ((root (vc-root-dir))) 616 (let ((root (vc-root-dir)))
613 ;; Returns paths relative to the root, so that 617 ;; Returns paths relative to the root, so that
614 ;; `log-edit-changelog-insert-entries' 618 ;; `log-edit-changelog-insert-entries'