Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
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
Ejemplo n.º 3
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.explainexit(ret)[0]))
Ejemplo n.º 4
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)
Ejemplo n.º 5
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]))
Ejemplo n.º 6
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)
Ejemplo n.º 7
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]))
Ejemplo n.º 8
0
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)
Ejemplo n.º 9
0
	def popen(self, cmd, env=None):
		return util.popen(cmd, env)
Ejemplo n.º 10
0
 def _git_exec(self, cmd, **args):
     return util.popen('git', cmd, self.git_dir, **args)
Ejemplo n.º 11
0
 def popen(self, cmd, env=None):
     return util.popen(cmd, env)
Ejemplo n.º 12
0
 def _cc_exec(self, cmd, **args):
     return util.popen('cleartool', cmd, self.cc_dir, **args)
Ejemplo n.º 13
0
 def _git_exec(self, cmd, **args):
     return util.popen('git', cmd, self.git_dir, **args)
Ejemplo n.º 14
0
 def _cc_exec(self, cmd, **args):
     return util.popen('cleartool', cmd, self.cc_dir, **args)