bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#18850: smerge-mode: use diff-check-labels


From: Ivan Shmakov
Subject: bug#18850: smerge-mode: use diff-check-labels
Date: Mon, 27 Oct 2014 10:25:00 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Package:  emacs
Severity: wishlist
Tags:     patch
Control:  block -1 by 18824

>>>>> Stefan Monnier <monnier@iro.umontreal.ca> writes:

 >> Please provide a separate diff-check-labels function to allow for
 >> the code calling diff.el facilities to supply its own --label=
 >> arguments to diff in place of diff.el-generated ones.

 > Sounds fine.  While you're at it, you might like to use this for
 > smerge-mode (which uses "-L" rather than "--label").

        I assume you mean something along the lines of the (untested)
        patch MIMEd.

        Curiously, I don’t usually use the merge facility proper,
        resolving merge conflicts afterwards.  Instead, I save the diff
        against the current revision, switch to a newer one, apply the
        diff saved, and deal with the ‘.rej’ files, if any.  Like:

$ (umask 0222 && git diff > +patch-$(date +%s).diff) 
$ git reset origin/master \
      && patch -bVt -p1 -R < <(git diff) 
…
$ patch -bVt -p1 < +patch-1414405170.diff 
…

-- 
FSF associate member #7257  http://boycottsystemd.org/  … 3013 B6A0 230E 334A
--- a/lisp/vc/smerge-mode.el
+++ b/lisp/vc/smerge-mode.el
@@ -44,6 +44,7 @@
 ;;; Code:
 
 (eval-when-compile (require 'cl-lib))
+(require 'diff)                                ; for diff-check-labels
 (require 'diff-mode)                    ;For diff-auto-refine-mode.
 (require 'newcomment)
 
@@ -1162,10 +1163,13 @@ smerge-diff (n1 n2)
            (erase-buffer)
            (let ((status
                   (apply 'call-process diff-command nil t nil
-                         (append smerge-diff-switches
-                                 (list "-L" (concat name1 "/" file)
-                                       "-L" (concat name2 "/" file)
-                                       file1 file2)))))
+                         (nconc (and (diff-check-labels)
+                                     (list "--label"
+                                           (concat name1 "/" file)
+                                           "--label"
+                                           (concat name2 "/" file)))
+                                smerge-diff-switches)
+                         file1 file2)))))
              (if (eq status 0) (insert "No differences found.\n"))))
          (goto-char (point-min))
          (diff-mode)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]