comparison mercurial/filemerge.py @ 26730:a1e43e85d294

merge-tools: allow marking a mergetool as completely disabled Very often in my life I'm finding that the only configured merge tool present on the system is vimdiff[0], and it's currently impossible (as far as I can tell) short of specifying `ui.merge = `[1] to actually *disable* a merge tool. This allows vimdiff-haters to put: [merge-tools] vimdiff.disable = yes in their ~/.hgrc and never see vimdiff again. I'm stopping short of putting this as a commented out entry in the sample new user hgrc (seen when a user runs `hg config --edit` with no ~/.hgrc) for now, but I might come back and do that later. 0: vimdiff is at an awkward intersection: it's usually installed by the vim package which is often installed as a vi substitute, so it's mere presence doesn't imply me wanting it, unlike (say) kdiff3. 1: There's a related problem I ran into today where specifying `ui.merge = :merge` failed because :merge isn't a command, which I think is a regression. I'll try and figure that out and at least file a bug.
author Augie Fackler <augie@google.com>
date Wed, 14 Oct 2015 12:57:33 -0400
parents ef1eb6df7071
children 859f453e8b4e
comparison
equal deleted inserted replaced
26729:16e69e6b357b 26730:a1e43e85d294
118 toolpath = _findtool(ui, tool) 118 toolpath = _findtool(ui, tool)
119 return (tool, util.shellquote(toolpath)) 119 return (tool, util.shellquote(toolpath))
120 120
121 # then merge tools 121 # then merge tools
122 tools = {} 122 tools = {}
123 disabled = set()
123 for k, v in ui.configitems("merge-tools"): 124 for k, v in ui.configitems("merge-tools"):
124 t = k.split('.')[0] 125 t = k.split('.')[0]
125 if t not in tools: 126 if t not in tools:
126 tools[t] = int(_toolstr(ui, t, "priority", "0")) 127 tools[t] = int(_toolstr(ui, t, "priority", "0"))
128 if _toolbool(ui, t, "disabled", False):
129 disabled.add(t)
127 names = tools.keys() 130 names = tools.keys()
128 tools = sorted([(-p, t) for t, p in tools.items()]) 131 tools = sorted([(-p, t) for t, p in tools.items() if t not in disabled])
129 uimerge = ui.config("ui", "merge") 132 uimerge = ui.config("ui", "merge")
130 if uimerge: 133 if uimerge:
131 if uimerge not in names: 134 if uimerge not in names:
132 return (uimerge, uimerge) 135 return (uimerge, uimerge)
133 tools.insert(0, (None, uimerge)) # highest priority 136 tools.insert(0, (None, uimerge)) # highest priority