gnu-arch-users
[Top][All Lists]
Advanced

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

Re: [Gnu-arch-users] Graphical merges


From: Matthieu Moy
Subject: Re: [Gnu-arch-users] Graphical merges
Date: Wed, 21 Apr 2004 01:27:02 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.2 (gnu/linux)

Matthieu Moy <address@hidden> writes:

> Hi all,
>
> I'm trying  to set  up a prototype  of graphical  conflicts resolution
> tool using ediff mode in Emacs. 

Pfiouu, I'm impressed how easy it was :-)

It'll be integrated  in xtla.el, but as it  is rather independant from
the rest  of the  package, it may  interest some  people if I  post it
here :

(defvar xtla-mine-string "TREE")
(defvar xtla-his-string "MERGE-SOURCE")

(defun xtla-view-conflicts (file)
  "Graphical view of conflicts after tla star-merge --three-way"
  (interactive "f")
  (let ((mine-buffer (get-buffer-create "*xtla-mine*"))
        (his-buffer (get-buffer-create "*xtla-his*")))
    (with-current-buffer mine-buffer
      (erase-buffer)
      (insert-file-contents file)
      (goto-char (point-min))
      (while (re-search-forward (concat "^<<<<<<< "
                                        (regexp-quote xtla-mine-string) "$")
                                nil t)
        (beginning-of-line)
        (delete-region (point) (1+ (line-end-position)))
        (re-search-forward "^=======$")
        (beginning-of-line)
        (delete-region (point) (progn
                                 (re-search-forward
                                  (concat "^>>>>>>> "
                                          (regexp-quote xtla-his-string) 
"\n"))))
        ))
    (with-current-buffer his-buffer
      (erase-buffer)
      (insert-file-contents file)
      (goto-char (point-min))
      (while (re-search-forward (concat "^<<<<<<< "
                                        (regexp-quote xtla-mine-string) "$")
                                nil t)
        (beginning-of-line)
        (delete-region (point) (progn
                                 (re-search-forward "^=======\n")))
        (re-search-forward
         (concat "^>>>>>>> "
                 (regexp-quote xtla-his-string) "$"))
        (beginning-of-line)
        (delete-region (point) (1+ (line-end-position)))
        )
      )
    (ediff-buffers mine-buffer his-buffer)
    ))

-- 
Matthieu




reply via email to

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