]> code.delx.au - gnu-emacs/blobdiff - admin/gitmerge.el
; Merge from origin/emacs-25
[gnu-emacs] / admin / gitmerge.el
index 206f12c08ad5c3c2e0ef76ecd27be54374c2d2be..ae863fdecb5f14d5df2bfd7988ace0823e4a3eee 100644 (file)
@@ -1,6 +1,6 @@
 ;;; gitmerge.el --- help merge one Emacs branch into another
 
-;; Copyright (C) 2010-2014 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2016 Free Software Foundation, Inc.
 
 ;; Authors: David Engster <deng@randomsample.de>
 ;;          Stefan Monnier <monnier@iro.umontreal.ca>
@@ -48,7 +48,9 @@
 (require 'smerge-mode)
 
 (defvar gitmerge-skip-regexp
-  "back[- ]?port\\|merge\\|sync\\|re-?generate\\|bump version\\|from trunk\\|\
+  ;; We used to include "sync" in there, but in my experience it only
+  ;; caused false positives.  --Stef
+  "back[- ]?port\\|merge\\|re-?generate\\|bump version\\|from trunk\\|\
 Auto-commit"
   "Regexp matching logs of revisions that might be skipped.
 `gitmerge-missing' will ask you if it should skip any matches.")
@@ -65,7 +67,7 @@ Auto-commit"
   '((t (:strike-through t)))
   "Face for skipped commits.")
 
-(defconst gitmerge-default-branch "origin/emacs-24"
+(defconst gitmerge-default-branch "origin/emacs-25"
   "Default for branch that should be merged.")
 
 (defconst gitmerge-buffer "*gitmerge*"
@@ -183,8 +185,8 @@ if and why this commit should be skipped."
     ;; Go through the log and remember all commits that match
     ;; `gitmerge-skip-regexp' or are marked by --cherry-mark.
     (with-temp-buffer
-      (call-process "git" nil t nil "log" "--cherry-mark" from
-                   (concat "^" (car (vc-git-branches))))
+      (call-process "git" nil t nil "log" "--cherry-mark" "--left-only"
+                   (concat from "..." (car (vc-git-branches))))
       (goto-char (point-max))
       (while (re-search-backward "^commit \\(.+\\) \\([0-9a-f]+\\).*" nil t)
        (let ((cherrymark (match-string 1))
@@ -206,9 +208,9 @@ if and why this commit should be skipped."
   "Create the buffer for choosing commits."
   (with-current-buffer (get-buffer-create gitmerge-buffer)
     (erase-buffer)
-    (call-process "git" nil t nil "log"
+    (call-process "git" nil t nil "log" "--left-only"
                  "--pretty=format:%h %<(20,trunc) %an: %<(100,trunc) %s"
-                 from (concat "^" (car (vc-git-branches))))
+                 (concat from "..." (car (vc-git-branches))))
     (goto-char (point-min))
     (while (looking-at "^\\([a-f0-9]+\\)")
       (let ((skipreason (gitmerge-skip-commit-p (match-string 1) commits)))
@@ -314,7 +316,11 @@ Returns non-nil if conflicts remain."
 SKIP denotes whether those commits are actually skipped.  If END
 is nil, only the single commit BEG is merged."
   (with-temp-buffer
-    (insert "Merge from " branch "\n\n"
+    ;; We do not insert "; " for non-skipped messages,
+    ;; because the date of those entries is helpful in figuring out
+    ;; when things got merged, since git does not track that.
+    (insert (if skip "; " "")
+           "Merge from " branch "\n\n"
            (if skip
                (concat "The following commit"
                        (if end "s were " " was ")
@@ -425,8 +431,14 @@ If so, add no longer conflicted files and commit."
        (when mergehead
          (with-current-buffer (get-buffer-create gitmerge-output-buffer)
            (erase-buffer)
+            ;; FIXME: We add "-m-" because the default commit message
+            ;; apparently tickles our commit hook:
+            ;;    Line longer than 78 characters in commit message
+            ;;    Line longer than 78 characters in commit message
+            ;;    Line longer than 78 characters in commit message
+            ;;    Commit aborted; please see the file CONTRIBUTE
            (unless (zerop (call-process "git" nil t nil
-                                        "commit" "--no-edit"))
+                                        "commit" "--no-edit" "-m-"))
              (error "Git error during merge - fix it manually"))))
        ;; Successfully resumed.
        t))))