mercurial/filemerge.py
changeset 21524 47b97d9af27e
parent 21519 25d5a9ecbb85
child 21693 9c35f3a8cac4
equal deleted inserted replaced
21523:9fb6f328576a 21524:47b97d9af27e
   298     '{ifeq(tags, "tip", "", "{tags} ")}' +
   298     '{ifeq(tags, "tip", "", "{tags} ")}' +
   299     '{if(bookmarks, "{bookmarks} ")}' +
   299     '{if(bookmarks, "{bookmarks} ")}' +
   300     '{ifeq(branch, "default", "", "{branch} ")}' +
   300     '{ifeq(branch, "default", "", "{branch} ")}' +
   301     '- {author|user}: "{desc|firstline}"')
   301     '- {author|user}: "{desc|firstline}"')
   302 
   302 
       
   303 _defaultconflictlabels = ['local', 'other']
       
   304 
   303 def _formatlabels(repo, fcd, fco, labels):
   305 def _formatlabels(repo, fcd, fco, labels):
   304     """Formats the given labels using the conflict marker template.
   306     """Formats the given labels using the conflict marker template.
   305 
   307 
   306     Returns a list of formatted labels.
   308     Returns a list of formatted labels.
   307     """
   309     """
   316     pad = max(len(labels[0]), len(labels[1]))
   318     pad = max(len(labels[0]), len(labels[1]))
   317 
   319 
   318     return [_formatconflictmarker(repo, cd, tmpl, labels[0], pad),
   320     return [_formatconflictmarker(repo, cd, tmpl, labels[0], pad),
   319             _formatconflictmarker(repo, co, tmpl, labels[1], pad)]
   321             _formatconflictmarker(repo, co, tmpl, labels[1], pad)]
   320 
   322 
   321 def filemerge(repo, mynode, orig, fcd, fco, fca):
   323 def filemerge(repo, mynode, orig, fcd, fco, fca, labels=None):
   322     """perform a 3-way merge in the working directory
   324     """perform a 3-way merge in the working directory
   323 
   325 
   324     mynode = parent node before merge
   326     mynode = parent node before merge
   325     orig = original local filename before merge
   327     orig = original local filename before merge
   326     fco = other file context
   328     fco = other file context
   374         ui.status(_("merging %s\n") % fd)
   376         ui.status(_("merging %s\n") % fd)
   375 
   377 
   376     ui.debug("my %s other %s ancestor %s\n" % (fcd, fco, fca))
   378     ui.debug("my %s other %s ancestor %s\n" % (fcd, fco, fca))
   377 
   379 
   378     markerstyle = ui.config('ui', 'mergemarkers', 'detailed')
   380     markerstyle = ui.config('ui', 'mergemarkers', 'detailed')
   379     labels = ['local', 'other']
       
   380     if markerstyle == 'basic':
   381     if markerstyle == 'basic':
   381         formattedlabels = labels
   382         formattedlabels = _defaultconflictlabels
   382     else:
   383     else:
       
   384         if not labels:
       
   385             labels = _defaultconflictlabels
       
   386 
   383         formattedlabels = _formatlabels(repo, fcd, fco, labels)
   387         formattedlabels = _formatlabels(repo, fcd, fco, labels)
   384 
   388 
   385     needcheck, r = func(repo, mynode, orig, fcd, fco, fca, toolconf,
   389     needcheck, r = func(repo, mynode, orig, fcd, fco, fca, toolconf,
   386                         (a, b, c, back), labels=formattedlabels)
   390                         (a, b, c, back), labels=formattedlabels)
   387     if not needcheck:
   391     if not needcheck: