Skip to content

hg_prompt_filter() does not use get_hg_branch() which is specifically intended to get the Mercurial branch information #2659

@vsajip

Description

@vsajip

This code

cmder/vendor/clink.lua

Lines 525 to 527 in 711fe28

local pipe = io.popen("hg branch 2>&1")
local output = pipe:read('*all')
local rc = { pipe:close() }

does not make use of the function specifically there for the purpose of getting the Mercurial branch information, which is at

cmder/vendor/clink.lua

Lines 305 to 321 in 711fe28

---
-- Find out current branch
-- @return {false|mercurial branch name}
---
local function get_hg_branch()
local file = io.popen("hg branch 2>nul")
for line in file:lines() do
local m = line:match("(.+)$")
if m then
file:close()
return m
end
end
file:close()
return false
end

It should do that, because it is better to encapsulate details of how the branch information is obtained/formatted. For example, I use the prompt extension for Mercurial to customise the information.

Earlier versions of cmder used get_hg_branch(), and it's not clear why that was changed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions