merge conflicts - simplifying afterwards-tool.

John Arbash Meinel john at arbash-meinel.com
Thu Dec 15 16:23:42 GMT 2005


Robert Collins wrote:
> One of the interesting things I see is when the matching regions things
> get confused, like:
> 

Well, I think one problem is sometimes you want either behavior, just
depending on what is being changed. If I understand you correctly, I
think you are saying that you want sort of the opposite of the current
--reprocess behavior. You want conflict regions to be expanded so they
merge into one large conflict even though there are matching lines
inbetween.

Is this a decent example of what you would like to see? I think it is
helpful to see actual text lines.

BASE:

def ret1(a):
  a += 1
  return a

def ret2(a):
  a += 2
  return a

THIS:

def ret1(a):
  a += 1
  return a

def ret2(a):
  a += 2
  return a

def ret3(a):
  a += 3
  return a

def ret4(a):
  a += 4
  return a

OTHER:

def ret1(a):
  a += 1
  return a

def ret2(a):
  a += 2
  return a

def ret5(a):
  a += 5
  return a

def ret6(a):
  a += 6
  return a

And the problem you are running into is that what you end up wanting is:
def ret1(a):
  a += 1
  return a

def ret2(a):
  a += 2
  return a

<<<<
def ret3(a):
  a += 3
  return a

def ret4(a):
  a += 4
  return a
====
def ret5(a):
  a += 5
  return a

def ret6(a):
  a += 6
  return a
>>>>


And what you are getting is:

def ret1(a):
  a += 1
  return a

def ret2(a):
  a += 2
  return a

<<<<
def ret3(a):
  a += 3
====
def ret5(a):
  a += 5
>>>>
  return a

<<<<
def ret4(a):
  a += 4
===
def ret5(a):
  a += 5
>>>>
  return a

...

> What I'd *LOVE* is a tool to coalesce selected conflicts of that nature:

...

> 
> This matters because often I want to take all of the LCLCL sequence and
> the RCRCR sequence: they both added code and happened to have common
> lines in close proximity.
> 
> This is related to but not superceded by the patentience algorithm John
> is working on.
>
> Cheers,
> Rob
>
>


Yeah, patience would tend to help prevent spurious matches based on
'return a' lines, but it doesn't keep you from getting some of them.
One thing is that right now I run regular difflib on unmatched regions.
It makes sense in certain circumstances, but you probably would get the
desired behavior if you turned it off. Without difflib, Patience will
not ever use a repeated line to indicate a match. If you have a uniquely
matching line, then it will grow to include nearby common lines. But I
do believe patience merge without difflib would give you the specific
behavior that you were asking for in this specific case.

John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051215/cc01f9ec/attachment.pgp 


More information about the bazaar mailing list