unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* smerge autolaunch integration for conflicts in git
@ 2014-08-13  9:13 Eric S. Raymond
  2014-08-13 15:07 ` Lawrence Mitchell
  2014-08-20 20:46 ` Glenn Morris
  0 siblings, 2 replies; 3+ messages in thread
From: Eric S. Raymond @ 2014-08-13  9:13 UTC (permalink / raw)
  To: emacs-devel

I had a look at Rüdiger Sonderfeld's patch partially implementing
smerge launching for conflicted files in git.

Good news: Completing the patch was surprisingly easy. Rüdiger's
premises about vc-git's internals seem correct.  The only missing
piece was the resolve command the git backend should use when it
detects that there are no conflict markers remaining, and that is just
"git add" - no dark magic.  I have merged the implementation to trunk.

Bad news: I don't have a practical way to test this change beyond
verifying that the Lisp compiles - it could go pear-shaped when it
sees a live conflict.  Somebody for which this meets a real use case,
like Stefan, will have to try it.

Good news: I merged it anyway because if it breaks, it's not going to
do so seriously and should be easy to fix.  Multiple git adds on a
file are harmless.  The most likely failure is that the regexp for
detecting conflicts in a status listing is slightly off, in which case
the launch hook will simply not fire.

Bad news: I wanted to do this really elegantly, by pulling most of
the smerge launch logic into vc-git.el.  Alas, it's not possible without a
fairly large and disruptive refactoring (which probably shouldn't be
done before 24 release). Before even thinking further in that
direction I want to make sure this patch actually works.
-- 
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>

Men trained in arms from their infancy, and animated by the love of liberty,
will afford neither a cheap or easy conquest.
        -- From the Declaration of the Continental Congress, July 1775.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: smerge autolaunch integration for conflicts in git
  2014-08-13  9:13 smerge autolaunch integration for conflicts in git Eric S. Raymond
@ 2014-08-13 15:07 ` Lawrence Mitchell
  2014-08-20 20:46 ` Glenn Morris
  1 sibling, 0 replies; 3+ messages in thread
From: Lawrence Mitchell @ 2014-08-13 15:07 UTC (permalink / raw)
  To: emacs-devel

Eric S. Raymond wrote:

[...]

> Good news: I merged it anyway because if it breaks, it's not going to
> do so seriously and should be easy to fix.  Multiple git adds on a
> file are harmless.  The most likely failure is that the regexp for
> detecting conflicts in a status listing is slightly off, in which case
> the launch hook will simply not fire.

A better way to do this is to use git ls-files.  For example:

git ls-files -u -z -- directory

gives you the unmerged files in directory (paths
NUL-separated) with each file repeated 3 times

So something like the following gives you the unmerged files:

(let ((lines (split-string (vc-git--run-command-string directory
                            "ls-files" "-u" "-z" "--")
                           "\0" 'omit-nulls)))
 (loop for line in lines
       for i = 0 then (+ i 1)
       ;; Prefix is:
       ;; 6 chars for mode
       ;; 1 space
       ;; 40 chars for SHA1
       ;; 1 space
       ;; 1 char for state
       ;; 1 tab
       ;; filename
       if (zerop (mod i 3)) collect (substring line 50)))

[...]


-- 
Lawrence Mitchell <wence@gmx.li>




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: smerge autolaunch integration for conflicts in git
  2014-08-13  9:13 smerge autolaunch integration for conflicts in git Eric S. Raymond
  2014-08-13 15:07 ` Lawrence Mitchell
@ 2014-08-20 20:46 ` Glenn Morris
  1 sibling, 0 replies; 3+ messages in thread
From: Glenn Morris @ 2014-08-20 20:46 UTC (permalink / raw)
  To: Eric S. Raymond; +Cc: emacs-devel


The comments from

 http://lists.gnu.org/archive/html/emacs-devel/2014-01/msg01126.html

are still applicable.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-08-20 20:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-13  9:13 smerge autolaunch integration for conflicts in git Eric S. Raymond
2014-08-13 15:07 ` Lawrence Mitchell
2014-08-20 20:46 ` Glenn Morris

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).