comparison mercurial/filemerge.py @ 36982:a4a95bd7158d

filemerge: give some variables in _xmerge more descriptive names Differential Revision: https://phab.mercurial-scm.org/D2886
author Kyle Lippincott <spectral@google.com>
date Fri, 19 Jan 2018 18:52:50 -0800
parents 5bc7ff103081
children 317382151ac3
comparison
equal deleted inserted replaced
36981:795eb53f1d3e 36982:a4a95bd7158d
507 if fcd.isabsent() or fco.isabsent(): 507 if fcd.isabsent() or fco.isabsent():
508 repo.ui.warn(_('warning: %s cannot merge change/delete conflict ' 508 repo.ui.warn(_('warning: %s cannot merge change/delete conflict '
509 'for %s\n') % (tool, fcd.path())) 509 'for %s\n') % (tool, fcd.path()))
510 return False, 1, None 510 return False, 1, None
511 unused, unused, unused, back = files 511 unused, unused, unused, back = files
512 a = _workingpath(repo, fcd) 512 localpath = _workingpath(repo, fcd)
513 b, c = _maketempfiles(repo, fco, fca) 513 basepath, otherpath = _maketempfiles(repo, fco, fca)
514 try: 514 try:
515 out = "" 515 outpath = ""
516 mylabel, otherlabel = labels[:2] 516 mylabel, otherlabel = labels[:2]
517 if len(labels) >= 3: 517 if len(labels) >= 3:
518 baselabel = labels[2] 518 baselabel = labels[2]
519 else: 519 else:
520 baselabel = 'base' 520 baselabel = 'base'
532 ui = repo.ui 532 ui = repo.ui
533 533
534 args = _toolstr(ui, tool, "args") 534 args = _toolstr(ui, tool, "args")
535 if "$output" in args: 535 if "$output" in args:
536 # read input from backup, write to original 536 # read input from backup, write to original
537 out = a 537 outpath = localpath
538 a = repo.wvfs.join(back.path()) 538 localpath = repo.wvfs.join(back.path())
539 replace = {'local': a, 'base': b, 'other': c, 'output': out, 539 replace = {'local': localpath, 'base': basepath, 'other': otherpath,
540 'labellocal': mylabel, 'labelother': otherlabel, 540 'output': outpath, 'labellocal': mylabel,
541 'labelbase': baselabel} 541 'labelother': otherlabel, 'labelbase': baselabel}
542 args = util.interpolate(br'\$', replace, args, 542 args = util.interpolate(br'\$', replace, args,
543 lambda s: util.shellquote(util.localpath(s))) 543 lambda s: util.shellquote(util.localpath(s)))
544 cmd = toolpath + ' ' + args 544 cmd = toolpath + ' ' + args
545 if _toolbool(ui, tool, "gui"): 545 if _toolbool(ui, tool, "gui"):
546 repo.ui.status(_('running merge tool %s for file %s\n') % 546 repo.ui.status(_('running merge tool %s for file %s\n') %
548 repo.ui.debug('launching merge tool: %s\n' % cmd) 548 repo.ui.debug('launching merge tool: %s\n' % cmd)
549 r = ui.system(cmd, cwd=repo.root, environ=env, blockedtag='mergetool') 549 r = ui.system(cmd, cwd=repo.root, environ=env, blockedtag='mergetool')
550 repo.ui.debug('merge tool returned: %d\n' % r) 550 repo.ui.debug('merge tool returned: %d\n' % r)
551 return True, r, False 551 return True, r, False
552 finally: 552 finally:
553 util.unlink(b) 553 util.unlink(basepath)
554 util.unlink(c) 554 util.unlink(otherpath)
555 555
556 def _formatconflictmarker(ctx, template, label, pad): 556 def _formatconflictmarker(ctx, template, label, pad):
557 """Applies the given template to the ctx, prefixed by the label. 557 """Applies the given template to the ctx, prefixed by the label.
558 558
559 Pad is the minimum width of the label prefix, so that multiple markers 559 Pad is the minimum width of the label prefix, so that multiple markers