From: mlh at swl.msd.ray.com (Milton L. Hankins)
Date: Tue, 13 Apr 1999 13:17:50 -0400
Subject: Tools for three way merge of Python source files?
Message-ID: <Pine.SGI.3.95q.990413125514.14593X-100000@masox202.msd.ray.com>
Content-Length: 1706
X-UID: 1149                                                  

Keywords: diff3, merge, three-way, 3-way

Are there tools to help with 3-way merges of Python sources and/or
indentation conversion?

I'm using Python on a Real Project and I need to do a 3-way merge. 
Certain whitespace characters must be ignored -- specifically, carriage
returns.  I have a diff tool which ignores blanks but then I run into
problems where a block of code has been indented further (inside a new
block).

I wish I could rely on the parser to catch this sort of thing, but it
won't detect all possible follies, such as this one:

<my file & ancestor are the same>
if foo:
  if bar:
    baz()
  else:
    frob()

<other file, important change>
if foo:
  if bar:
    baz()
else:
  frob()

Here, the merge result (using blank ignorance) would not incorporate
the changes from <other file>.

One correct solution seems to be to strip CR from CRLF.  But I'm
afraid of having too many conflicting sections (false negatives) where
the spacing difference is actually benign.  Perhaps I should just tell
my fellow developers not to change indentation unless they have to.

So, it also appears that I need a Python-aware indentation converter --
something that converts a source file to use a minimal number of tabs (or
perhaps spaces, as long as it were consistent) for block indents.

If anyone has had similar experiences or knows of a solution I'd love
to hear about it.  Email is preferred.  Thanks.


(I really hope this doesn't start Yet Another Whitespace War.)

--
             Milton L. Hankins               -=-  <mlh at swl.msd.ray.com>
Software Engineer, Raytheon Systems Company  -=-  RayComNet  7-225-4728
      http://amasts.msd.ray.com/~mlh         -=-  ><>  Isaiah 64:6  ><> 





