comparison mercurial/scmutil.py @ 37120:a8a902d7176e

procutil: bulk-replace function calls to point to new module
author Yuya Nishihara <yuya@tcha.org>
date Sat, 24 Mar 2018 15:10:51 +0900
parents 7f025c9b7865
children 7c0f40f4f7bf
comparison
equal deleted inserted replaced
37119:d4a2e0d5d042 37120:a8a902d7176e
40 util, 40 util,
41 vfs, 41 vfs,
42 ) 42 )
43 43
44 from .utils import ( 44 from .utils import (
45 procutil,
45 stringutil, 46 stringutil,
46 ) 47 )
47 48
48 if pycompat.iswindows: 49 if pycompat.iswindows:
49 from . import scmwindows as scmplatform 50 from . import scmwindows as scmplatform
291 checkfilename(f) 292 checkfilename(f)
292 abort, warn = checkportabilityalert(ui) 293 abort, warn = checkportabilityalert(ui)
293 if abort or warn: 294 if abort or warn:
294 msg = util.checkwinfilename(f) 295 msg = util.checkwinfilename(f)
295 if msg: 296 if msg:
296 msg = "%s: %s" % (msg, util.shellquote(f)) 297 msg = "%s: %s" % (msg, procutil.shellquote(f))
297 if abort: 298 if abort:
298 raise error.Abort(msg) 299 raise error.Abort(msg)
299 ui.warn(_("warning: %s\n") % msg) 300 ui.warn(_("warning: %s\n") % msg)
300 301
301 def checkportabilityalert(ui): 302 def checkportabilityalert(ui):
1088 try: 1089 try:
1089 if spec.startswith("shell:"): 1090 if spec.startswith("shell:"):
1090 # external commands should be run relative to the repo root 1091 # external commands should be run relative to the repo root
1091 cmd = spec[6:] 1092 cmd = spec[6:]
1092 proc = subprocess.Popen(cmd, shell=True, bufsize=-1, 1093 proc = subprocess.Popen(cmd, shell=True, bufsize=-1,
1093 close_fds=util.closefds, 1094 close_fds=procutil.closefds,
1094 stdout=subprocess.PIPE, cwd=repo.root) 1095 stdout=subprocess.PIPE, cwd=repo.root)
1095 src = proc.stdout 1096 src = proc.stdout
1096 else: 1097 else:
1097 # treat as a URL or file 1098 # treat as a URL or file
1098 src = url.open(repo.ui, spec) 1099 src = url.open(repo.ui, spec)
1112 proc.communicate() 1113 proc.communicate()
1113 if src: 1114 if src:
1114 src.close() 1115 src.close()
1115 if proc and proc.returncode != 0: 1116 if proc and proc.returncode != 0:
1116 raise error.Abort(_("extdata command '%s' failed: %s") 1117 raise error.Abort(_("extdata command '%s' failed: %s")
1117 % (cmd, util.explainexit(proc.returncode)[0])) 1118 % (cmd, procutil.explainexit(proc.returncode)[0]))
1118 1119
1119 return data 1120 return data
1120 1121
1121 def _locksub(repo, lock, envvar, cmd, environ=None, *args, **kwargs): 1122 def _locksub(repo, lock, envvar, cmd, environ=None, *args, **kwargs):
1122 if lock is None: 1123 if lock is None: