Mercurial > public > mercurial-scm > hg
comparison mercurial/filemerge.py @ 21524:47b97d9af27e
merge: add labels parameter from merge.update to filemerge
Adds a labels function parameter to all the functions between merge.update and
filemerge.filemerge. This will allow commands like rebase to specify custom
marker labels.
author | Durham Goode <durham@fb.com> |
---|---|
date | Thu, 08 May 2014 16:54:23 -0700 |
parents | 25d5a9ecbb85 |
children | 9c35f3a8cac4 |
comparison
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: |