Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
vsajip opened this issue Jan 28, 2022 · 1 comment

Comments

@vsajip
Copy link
Contributor

vsajip commented Jan 28, 2022

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.

@daxgames
Copy link
Member

If you can fix it ease do and open a PR.

daxgames added a commit that referenced this issue Feb 3, 2022
Fix #2659: Use get_hg_branch() to get Mercurial branch information.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants