[PATCH 2 of 2] filemerge: detect merge tool aborts

Steve Borho steve at borho.org
Mon Feb 4 21:27:07 CST 2008


On Mon, 2008-02-04 at 21:12 -0600, Matt Mackall wrote:
> On Mon, 2008-02-04 at 20:27 -0600, Steve Borho wrote:
> > # HG changeset patch
> > # User Steve Borho <steve at borho.org>
> > # Date 1202177707 21600
> > # Node ID 532093498c8f7953d01a1bc3d874deee24d8be24
> > # Parent  bb87b78bf30a6c3642b04e3a42aea8775fb78f38
> > filemerge: detect merge tool aborts
> > 
> > Some merge tools return 0 even if they do not write an output file.
> > This patch tries to at least recognize that the merge failed.
> > 
> > diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
> > --- a/mercurial/filemerge.py
> > +++ b/mercurial/filemerge.py
> > @@ -7,7 +7,7 @@
> >  
> >  from node import *
> >  from i18n import _
> > -import util, os, tempfile, context, simplemerge, re
> > +import util, os, tempfile, context, simplemerge, re, filecmp
> >  
> >  def _toolstr(ui, tool, part, default=""):
> >      return ui.config("merge-tools", tool + "." + part, default)
> > @@ -199,6 +199,11 @@
> >      if r:
> >          repo.ui.warn(_("merging %s failed!\n") % fd)
> >      else:
> > +        if filecmp.cmp(repo.wjoin(fd), back):
> 
> elif saves a level of indentation. I'm tempted to put this under a
> <tool>.checkchanged option (default false) though.

I'm ok with that, though I wish I could remember the tools which need
this check enabled.

-- 
Steve Borho (steve at borho.org)
http://www.borho.org/~steve/steve.asc
Key fingerprint = 2D08 E7CF B624 624C DE1F  E2E4 B0C2 5292 F2C6 2C8C



More information about the Mercurial-devel mailing list