def clone(source=None, dest=None, noupdate=False, updaterev=None, rev=None, branch=None, pull=False, uncompressed=False, ssh=None, remotecmd=None, insecure=False, encoding=None, configs=None): args = util.cmdbuilder('clone', source, dest, noupdate=noupdate, updaterev=updaterev, rev=rev, branch=branch, pull=pull, uncompresses=uncompressed, e=ssh, remotecmd=remotecmd, insecure=insecure) args.insert(0, HGPATH) proc = util.popen(args) out, err = proc.communicate() if proc.returncode: raise error.CommandError(args, proc.returncode, out, err) return client.hgclient(dest, encoding, configs, connect=False)
def externalpatch(patcher, args, patchname, ui, strip, cwd, files): """use <patcher> to apply <patchname> to the working directory. returns whether patch was applied with fuzz factor.""" fuzz = False if cwd: args.append('-d %s' % util.shellquote(cwd)) fp = util.popen('%s %s -p%d < %s' % (patcher, ' '.join(args), strip, util.shellquote(patchname))) for line in fp: line = line.rstrip() ui.note(line + '\n') if line.startswith('patching file '): pf = util.parse_patch_output(line) printed_file = False files.setdefault(pf, None) elif line.find('with fuzz') >= 0: fuzz = True if not printed_file: ui.warn(pf + '\n') printed_file = True ui.warn(line + '\n') elif line.find('saving rejects to file') >= 0: ui.warn(line + '\n') elif line.find('FAILED') >= 0: if not printed_file: ui.warn(pf + '\n') printed_file = True ui.warn(line + '\n') code = fp.close() if code: raise PatchError(_("patch command failed: %s") % util.explain_exit(code)[0]) return fuzz
def _sendmail(ui, sender, recipients, msg): """send mail using sendmail.""" program = ui.config("email", "method") cmdline = "%s -f %s %s" % (program, util.email(sender), " ".join(map(util.email, recipients))) ui.note(_("sending mail: %s\n") % cmdline) fp = util.popen(cmdline, "w") fp.write(msg) ret = fp.close() if ret: raise util.Abort("%s %s" % (os.path.basename(program.split(None, 1)[0]), util.explainexit(ret)[0]))
def init(dest=None, ssh=None, remotecmd=None, insecure=False, encoding=None, configs=None): args = util.cmdbuilder('init', dest, e=ssh, remotecmd=remotecmd, insecure=insecure) args.insert(0, HGPATH) proc = util.popen(args) out, err = proc.communicate() if proc.returncode: raise error.CommandError(args, proc.returncode, out, err) return client.hgclient(dest, encoding, configs, connect=False)
def _sendmail(ui, sender, recipients, msg): '''send mail using sendmail.''' program = ui.config('email', 'method') cmdline = '%s -f %s %s' % (program, util.email(sender), ' '.join( map(util.email, recipients))) ui.note(_('sending mail: %s\n') % cmdline) fp = util.popen(cmdline, 'w') fp.write(msg) ret = fp.close() if ret: raise util.Abort('%s %s' % (os.path.basename( program.split(None, 1)[0]), util.explain_exit(ret)[0]))
def _sendmail(ui, sender, recipients, msg): '''send mail using sendmail.''' program = ui.config('email', 'method') cmdline = '%s -f %s %s' % (program, util.email(sender), ' '.join(map(util.email, recipients))) ui.note(_('sending mail: %s\n') % cmdline) fp = util.popen(cmdline, 'w') fp.write(msg) ret = fp.close() if ret: raise util.Abort('%s %s' % ( os.path.basename(program.split(None, 1)[0]), util.explain_exit(ret)[0]))
def popen(self, cmd, env=None): return util.popen(cmd, env)
def _git_exec(self, cmd, **args): return util.popen('git', cmd, self.git_dir, **args)
def _cc_exec(self, cmd, **args): return util.popen('cleartool', cmd, self.cc_dir, **args)