@@ -39,25 +39,24 @@ fn get_mod_date_info(mut pp pool.PoolProcessor, idx int, wid int) &ModuleDateInf
39
39
}
40
40
path := get_path_of_existing_module (result.name) or { return result }
41
41
vcs := vcs_used_in_dir (path) or { return result }
42
- is_hg := vcs. cmd == 'hg'
42
+ args := vcs_info[ vcs].args
43
43
mut outputs := []string {}
44
- for step in vcs. args.outdated {
45
- cmd := ' ${ vcs.cmd} ${vcs. args.path} " ${ path} " ${ step} '
44
+ for step in args.outdated {
45
+ cmd := [ vcs.str (), args.path, os. quoted_path ( path), step]. join ( ' ' )
46
46
res := os.execute (cmd)
47
47
if res.exit_code < 0 {
48
48
verbose_println ('Error command: ${cmd} ' )
49
49
verbose_println ('Error details:\n ${res.output} ' )
50
50
result.exec_err = true
51
51
return result
52
52
}
53
- if is_hg && res.exit_code == 1 {
53
+ if vcs == .hg && res.exit_code == 1 {
54
54
result.outdated = true
55
55
return result
56
56
}
57
57
outputs << res.output
58
58
}
59
- // vcs.cmd == 'git'
60
- if ! is_hg && outputs[1 ] != outputs[2 ] {
59
+ if vcs == .git && outputs[1 ] != outputs[2 ] {
61
60
result.outdated = true
62
61
}
63
62
return result
@@ -217,10 +216,6 @@ fn get_path_of_existing_module(mod_name string) ?string {
217
216
vpm_error ('skipping `${path} `, since it is not a directory.' )
218
217
return none
219
218
}
220
- vcs_used_in_dir (path) or {
221
- vpm_error ('skipping `${path} `, since it uses an unsupported version control system.' )
222
- return none
223
- }
224
219
return path
225
220
}
226
221
@@ -252,12 +247,6 @@ fn ensure_vmodules_dir_exist() {
252
247
}
253
248
}
254
249
255
- fn (vcs &VCS) is_executable () ! {
256
- os.find_abs_path_of_executable (vcs.cmd) or {
257
- return error ('VPM needs `${vcs.cmd} ` to be installed.' )
258
- }
259
- }
260
-
261
250
fn increment_module_download_count (name string ) ! {
262
251
if settings.no_dl_count_increment {
263
252
println ('Skipping download count increment for `${name} `.' )
@@ -296,15 +285,6 @@ fn resolve_dependencies(manifest ?vmod.Manifest, modules []string) {
296
285
}
297
286
}
298
287
299
- fn vcs_used_in_dir (dir string ) ? VCS {
300
- for vcs in supported_vcs.values () {
301
- if os.is_dir (os.real_path (os.join_path (dir, vcs.dir))) {
302
- return vcs
303
- }
304
- }
305
- return none
306
- }
307
-
308
288
fn verbose_println (msg string ) {
309
289
if settings.is_verbose {
310
290
println (msg)
0 commit comments