sindrets / diffview.nvim

Single tabpage interface for easily cycling through diffs for all modified files for any git rev.
Other
3.74k stars 105 forks source link

fix: Fix version check for mercurial #364

Closed Pagliacii closed 1 year ago

Pagliacii commented 1 year ago

Close #363

sindrets commented 1 year ago

Thanks for the PR! This is indeed a bug. But there has to be a better way to validate this without all the redundant statements. How about something like this:

local version_ok = (function()
  if v.major ~= target.major then
    return v.major > target.major
  elseif v.minor ~= target.minor then
    return v.minor > target.minor
  elseif v.patch ~= target.patch then
    return v.patch > target.patch
  end
  return true
end)()
Pagliacii commented 1 year ago

Updated

Pagliacii commented 1 year ago

Sure, I will check it at tonight.

Pagliacii commented 1 year ago

Updated.

Today I found that the mercurial has a version likes this:

Mercurial Distributed SCM (version 6.4)
(see https://mercurial-scm.org for more information)

Copyright (C) 2005-2023 Olivia Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

So I use the hg_version function to extract version info from cli output. And move the version checker to vcs.utils.

zegervdv commented 1 year ago

@Pagliacii thanks for fixing this! I ran into it one day, but didn't have time to debug it. The next day it was gone, so probably my version got updated in the meantime :).

Nice to see someone else is using it with mercurial.