Changeset - f8314738030a
[Not reviewed]
default
0 1 0
Mads Kiilerich - 6 years ago 2019-11-03 16:39:59
mads@kiilerich.com
Grafted from: d080d554400a
scripts/i18n: let 'normalized-merge' leave 3-way conflict markers in output file

3-way conflict markers in the output file can be convenient ... and they do no
harm when merge tools like kdiff3 will overwrite output anyway.
1 file changed with 6 insertions and 3 deletions:
0 comments (0 inline, 0 general)
scripts/i18n
Show inline comments
 
@@ -107,21 +107,24 @@ def normalized_merge(local, base, other,
 
    localkeep = local + '.keep'
 
    shutil.copyfile(local, localkeep)
 

	
 
    ret = simplemerge.simplemerge(uimod.ui.load(),
 
         context.arbitraryfilectx(local.encode('utf-8')),
 
         context.arbitraryfilectx(base.encode('utf-8')),
 
         context.arbitraryfilectx(other.encode('utf-8'))
 
         context.arbitraryfilectx(other.encode('utf-8')),
 
         label=[b'local', b'other', b'base'],
 
         mode='merge',
 
    )
 
    shutil.copyfile(local, output)  # simplemerge wrote to local
 
    shutil.copyfile(local, output)  # simplemerge wrote to local - either resolved or with conflict markers
 
    if ret:
 
        shutil.copyfile(localkeep, local)
 
        basekeep = base + '.keep'
 
        otherkeep = other + '.keep'
 
        shutil.copyfile(base, basekeep)
 
        shutil.copyfile(other, otherkeep)
 
        sys.stderr.write("Error: simple merge failed. Run a merge tool manually to resolve conflicts, then use 'hg resolve -m'.\n")
 
        sys.stderr.write("Error: simple merge failed and %s is left with conflict markers. Resolve the conflics , then use 'hg resolve -m'.\n" % output)
 
        sys.stderr.write('Resolve with e.g.: kdiff3 %s %s %s -o %s\n' % (basekeep, localkeep, otherkeep, output))
 
        sys.exit(ret)
 

	
 
    os.remove(localkeep)
 

	
 
@cli.command()
0 comments (0 inline, 0 general)