diff options
| author | Stefan Monnier | 2008-04-11 01:10:43 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2008-04-11 01:10:43 +0000 |
| commit | 0e05d8fc47f4744f85c46aef451d3b2fa7e315a0 (patch) | |
| tree | 5d7b0864834050ba1085ee3ef52074a74002afba | |
| parent | e89b536d4b54f200b2f9a6f4561d4b634ef4bbe0 (diff) | |
| download | emacs-0e05d8fc47f4744f85c46aef451d3b2fa7e315a0.tar.gz emacs-0e05d8fc47f4744f85c46aef451d3b2fa7e315a0.zip | |
(smerge-apply-resolution-patch): Fix typo.
(smerge-resolve): Merge the "2-way refinement" case with one half of
the "mere whitespace" resolution.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/smerge-mode.el | 48 |
2 files changed, 33 insertions, 21 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e8603f406f8..9ca7505abe3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2008-04-11 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * smerge-mode.el (smerge-apply-resolution-patch): Fix typo. | ||
| 4 | (smerge-resolve): Merge the "2-way refinement" case with one half of | ||
| 5 | the "mere whitespace" resolution. | ||
| 6 | |||
| 1 | 2008-04-10 Dan Nicolaescu <dann@ics.uci.edu> | 7 | 2008-04-10 Dan Nicolaescu <dann@ics.uci.edu> |
| 2 | 8 | ||
| 3 | * vc-bzr.el (vc-bzr-after-dir-status): Detect the conflict state. | 9 | * vc-bzr.el (vc-bzr-after-dir-status): Detect the conflict state. |
diff --git a/lisp/smerge-mode.el b/lisp/smerge-mode.el index c80ae06a04f..9363b00a094 100644 --- a/lisp/smerge-mode.el +++ b/lisp/smerge-mode.el | |||
| @@ -457,7 +457,7 @@ BUF contains a plain diff between match-1 and match-3." | |||
| 457 | (with-current-buffer textbuf | 457 | (with-current-buffer textbuf |
| 458 | (forward-line (- startline line)) | 458 | (forward-line (- startline line)) |
| 459 | (insert "<<<<<<< " name1 "\n" othertext | 459 | (insert "<<<<<<< " name1 "\n" othertext |
| 460 | (if name2 (concat "||||||| " name2)) | 460 | (if name2 (concat "||||||| " name2 "\n")) |
| 461 | "=======\n") | 461 | "=======\n") |
| 462 | (forward-line lines) | 462 | (forward-line lines) |
| 463 | (insert ">>>>>>> " name3 "\n") | 463 | (insert ">>>>>>> " name3 "\n") |
| @@ -498,42 +498,48 @@ some major modes. Uses `smerge-resolve-function' to do the actual work." | |||
| 498 | (error nil)) | 498 | (error nil)) |
| 499 | ;; Nothing to do: the resolution function has done it already. | 499 | ;; Nothing to do: the resolution function has done it already. |
| 500 | nil) | 500 | nil) |
| 501 | ;; "Mere whitespace" conflicts. | 501 | ;; Non-conflict. |
| 502 | ((or (and (eq m1e m3e) (eq m1b m3b)) ;Non-conflict. | 502 | ((and (eq m1e m3e) (eq m1b m3b)) |
| 503 | (progn | 503 | (set-match-data md) (smerge-keep-n 3)) |
| 504 | (setq m (make-temp-file "smm")) | ||
| 505 | (write-region m1b m1e m nil 'silent) | ||
| 506 | (setq o (make-temp-file "smo")) | ||
| 507 | (write-region m3b m3e o nil 'silent) | ||
| 508 | ;; Same patch applied on both sides, with whitespace changes. | ||
| 509 | (zerop (call-process diff-command nil nil nil "-b" m o))) | ||
| 510 | (when m2e | ||
| 511 | (setq b (make-temp-file "smb")) | ||
| 512 | (write-region m2b m2e b nil 'silent) | ||
| 513 | ;; Only minor whitespace changes made locally. | ||
| 514 | (zerop (call-process diff-command nil buf nil "-bc" b m)))) | ||
| 515 | (set-match-data md) | ||
| 516 | (smerge-keep-n 3)) | ||
| 517 | ;; Refine a 2-way conflict using "diff -b". | 504 | ;; Refine a 2-way conflict using "diff -b". |
| 518 | ;; In case of a 3-way conflict with an empty base | 505 | ;; In case of a 3-way conflict with an empty base |
| 519 | ;; (i.e. 2 conflicting additions), we do the same, presuming | 506 | ;; (i.e. 2 conflicting additions), we do the same, presuming |
| 520 | ;; that the 2 additions should be somehow merged rather | 507 | ;; that the 2 additions should be somehow merged rather |
| 521 | ;; than concatenated. | 508 | ;; than concatenated. |
| 522 | ((not (or (and m2b (not (eq m2b m2e))) | 509 | ((let ((lines (count-lines m3b m3e))) |
| 523 | (eq m1b m1e) (eq m3b m3e) | 510 | (setq m (make-temp-file "smm")) |
| 524 | (let ((lines (count-lines m3b m3e))) | 511 | (write-region m1b m1e m nil 'silent) |
| 525 | (call-process diff-command nil buf nil "-b" o m) | 512 | (setq o (make-temp-file "smo")) |
| 513 | (write-region m3b m3e o nil 'silent) | ||
| 514 | (not (or (eq m1b m1e) (eq m3b m3e) | ||
| 515 | (and (not (zerop (call-process diff-command | ||
| 516 | nil buf nil "-b" o m))) | ||
| 517 | ;; TODO: We don't know how to do the refinement | ||
| 518 | ;; if there's a non-empty ancestor and m1 and m3 | ||
| 519 | ;; aren't just plain equal. | ||
| 520 | m2b (not (eq m2b m2e))) | ||
| 526 | (with-current-buffer buf | 521 | (with-current-buffer buf |
| 527 | (goto-char (point-min)) | 522 | (goto-char (point-min)) |
| 528 | ;; Make sure there's some refinement. | 523 | ;; Make sure there's some refinement. |
| 529 | (looking-at | 524 | (looking-at |
| 530 | (concat "1," (number-to-string lines) "c")))))) | 525 | (concat "1," (number-to-string lines) "c")))))) |
| 531 | (smerge-apply-resolution-patch buf m0b m0e m3b m3e m2b)) | 526 | (smerge-apply-resolution-patch buf m0b m0e m3b m3e m2b)) |
| 527 | ;; "Mere whitespace changes" conflicts. | ||
| 528 | ((when m2e | ||
| 529 | (setq b (make-temp-file "smb")) | ||
| 530 | (write-region m2b m2e b nil 'silent) | ||
| 531 | (with-current-buffer buf (erase-buffer)) | ||
| 532 | ;; Only minor whitespace changes made locally. | ||
| 533 | ;; BEWARE: pass "-c" 'cause the output is reused in the next test. | ||
| 534 | (zerop (call-process diff-command nil buf nil "-bc" b m))) | ||
| 535 | (set-match-data md) | ||
| 536 | (smerge-keep-n 3)) | ||
| 532 | ;; Try "diff -b BASE MINE | patch OTHER". | 537 | ;; Try "diff -b BASE MINE | patch OTHER". |
| 533 | ((when (and (not safe) m2e b | 538 | ((when (and (not safe) m2e b |
| 534 | ;; If the BASE is empty, this would just concatenate | 539 | ;; If the BASE is empty, this would just concatenate |
| 535 | ;; the two, which is rarely right. | 540 | ;; the two, which is rarely right. |
| 536 | (not (eq m2b m2e))) | 541 | (not (eq m2b m2e))) |
| 542 | ;; BEWARE: we're using here the patch of the previous test. | ||
| 537 | (with-current-buffer buf | 543 | (with-current-buffer buf |
| 538 | (zerop (call-process-region | 544 | (zerop (call-process-region |
| 539 | (point-min) (point-max) "patch" t nil nil | 545 | (point-min) (point-max) "patch" t nil nil |