vpm: fix and improve `outdated` (#5902)
parent
f4251dded0
commit
0cc8d840a3
|
@ -21,8 +21,8 @@ const (
|
||||||
'git': 'git clone --depth=1'
|
'git': 'git clone --depth=1'
|
||||||
'hg': 'hg clone'
|
'hg': 'hg clone'
|
||||||
}
|
}
|
||||||
supported_vcs_outdate_cmds = {
|
supported_vcs_outdated_steps = {
|
||||||
'git': ['git rev-parse @{u}', 'git rev-parse @']
|
'git': ['git fetch', 'git rev-parse @', 'git rev-parse @{u}']
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -250,26 +250,23 @@ fn vpm_outdated() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if vcs[0] != 'git' {
|
if vcs[0] != 'git' {
|
||||||
println('Listing outdated modules is not supported with VCS {$vcs}.')
|
println('Check for $name was skipped.')
|
||||||
exit(1)
|
verbose_println('VCS ${vcs[0]} does ot support `v outdated`.')
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
local_vcs_cmd := supported_vcs_outdate_cmds[vcs[0]][0]
|
vcs_cmd_steps := supported_vcs_outdated_steps[vcs[0]]
|
||||||
local_res := os.exec(local_vcs_cmd) or {
|
mut outputs := []string{}
|
||||||
|
for step in vcs_cmd_steps {
|
||||||
|
res := os.exec(step) or {
|
||||||
errors++
|
errors++
|
||||||
println('Could not get local commit sha of "$name".')
|
println('Error while checking latest commits for "$name".')
|
||||||
verbose_println('Error command: $local_vcs_cmd')
|
verbose_println('Error command: git fetch')
|
||||||
verbose_println('Error details:\n$err')
|
verbose_println('Error details:\n$err')
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
upstream_vcs_cmd := supported_vcs_outdate_cmds[vcs[0]][1]
|
outputs << res.output
|
||||||
upstream_res := os.exec(upstream_vcs_cmd) or {
|
|
||||||
errors++
|
|
||||||
println('Could not read upstream commit sha of "$name".')
|
|
||||||
verbose_println('Error command: $upstream_vcs_cmd')
|
|
||||||
verbose_println('Error details:\n$err')
|
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
if local_res.output != upstream_res.output {
|
if outputs[1] != outputs[2] {
|
||||||
outdated << name
|
outdated << name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue