diff options
| author | Glenn Morris | 2018-10-24 13:20:01 -0400 |
|---|---|---|
| committer | Glenn Morris | 2018-10-24 13:20:01 -0400 |
| commit | 129ffc2761bc977dc859e7065668cdd997fb4ef7 (patch) | |
| tree | 302fa7df4a0dd79ede5f7245f7e60e6bde071596 /admin/gitmerge.el | |
| parent | 00027ff9d0f646662458bdb47cc7e2214f439698 (diff) | |
| download | emacs-129ffc2761bc977dc859e7065668cdd997fb4ef7.tar.gz emacs-129ffc2761bc977dc859e7065668cdd997fb4ef7.zip | |
* admin/gitmerge.el (gitmerge-resolve): Check NEWS patch exit status.
Diffstat (limited to 'admin/gitmerge.el')
| -rw-r--r-- | admin/gitmerge.el | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/admin/gitmerge.el b/admin/gitmerge.el index a123e0352d7..6dedee8dd14 100644 --- a/admin/gitmerge.el +++ b/admin/gitmerge.el | |||
| @@ -275,6 +275,9 @@ should not be skipped." | |||
| 275 | (setq found (cdr skip)))) | 275 | (setq found (cdr skip)))) |
| 276 | found)) | 276 | found)) |
| 277 | 277 | ||
| 278 | (defvar change-log-start-entry-re) ; in add-log, which defines change-log-mode | ||
| 279 | (declare-function add-log-iso8601-time-string "add-log" ()) | ||
| 280 | |||
| 278 | (defun gitmerge-resolve (file) | 281 | (defun gitmerge-resolve (file) |
| 279 | "Try to resolve conflicts in FILE with smerge. | 282 | "Try to resolve conflicts in FILE with smerge. |
| 280 | Returns non-nil if conflicts remain." | 283 | Returns non-nil if conflicts remain." |
| @@ -323,6 +326,9 @@ Returns non-nil if conflicts remain." | |||
| 323 | ;; Try to resolve the conflicts. | 326 | ;; Try to resolve the conflicts. |
| 324 | (let (temp) | 327 | (let (temp) |
| 325 | (cond | 328 | (cond |
| 329 | ;; FIXME when merging release branch to master, we still | ||
| 330 | ;; need to detect and handle the case where NEWS was modified | ||
| 331 | ;; without a conflict. We should abort if NEWS gets changed. | ||
| 326 | ((and (equal file "etc/NEWS") | 332 | ((and (equal file "etc/NEWS") |
| 327 | (ignore-errors | 333 | (ignore-errors |
| 328 | (setq temp | 334 | (setq temp |
| @@ -332,18 +338,21 @@ Returns non-nil if conflicts remain." | |||
| 332 | (or noninteractive | 338 | (or noninteractive |
| 333 | (y-or-n-p "Try to fix NEWS conflict? "))) | 339 | (y-or-n-p "Try to fix NEWS conflict? "))) |
| 334 | (let ((relfile (file-name-nondirectory file)) | 340 | (let ((relfile (file-name-nondirectory file)) |
| 335 | (tempfile (make-temp-file "gitmerge"))) | 341 | (patchfile (concat temp "-gitmerge.patch"))) |
| 336 | (unwind-protect | 342 | (call-process "git" nil `(:file ,patchfile) nil "diff" |
| 343 | (format ":1:%s" file) | ||
| 344 | (format ":3:%s" file)) | ||
| 345 | (if (eq 0 (call-process "patch" patchfile nil nil temp)) | ||
| 337 | (progn | 346 | (progn |
| 338 | (call-process "git" nil `(:file ,tempfile) nil "diff" | 347 | ;; We intentionally use a non-temporary name for this |
| 339 | (format ":1:%s" file) | 348 | ;; file, and only delete it if applied successfully. |
| 340 | (format ":3:%s" file)) | 349 | (delete-file patchfile) |
| 350 | (call-process "git" nil t nil "add" "--" temp) | ||
| 341 | (call-process "git" nil t nil "reset" "--" relfile) | 351 | (call-process "git" nil t nil "reset" "--" relfile) |
| 342 | (call-process "git" nil t nil "checkout" "--" relfile) | 352 | (call-process "git" nil t nil "checkout" "--" relfile) |
| 343 | (revert-buffer nil 'noconfirm) | 353 | (revert-buffer nil 'noconfirm)) |
| 344 | (call-process "patch" tempfile nil nil temp) | 354 | ;; The conflict markers remain so we return non-nil. |
| 345 | (call-process "git" nil t nil "add" "--" temp)) | 355 | (message "Failed to fix NEWS conflict")))) |
| 346 | (delete-file tempfile)))) | ||
| 347 | ;; Generated files. | 356 | ;; Generated files. |
| 348 | ((member file '("lisp/ldefs-boot.el")) | 357 | ((member file '("lisp/ldefs-boot.el")) |
| 349 | ;; We are in the file's buffer, so names are relative. | 358 | ;; We are in the file's buffer, so names are relative. |