Ejemplo n.º 1
0
 def testspawndetachedfailure1(self):
     """spawndetached() should throw if executing the process fails."""
     try:
         util.spawndetached(["no_such_program", "arg1", "arg2"])
         self.fail("expected spawndetached to fail with ENOENT")
     except (OSError, IOError) as ex:
         self.assertEqual(ex.errno, errno.ENOENT)
Ejemplo n.º 2
0
 def testspawndetachedfailure2(self):
     """spawndetached() should throw if executing the process fails."""
     try:
         util.spawndetached([os.devnull, "arg1", "arg2"])
         self.fail("expected spawndetached to fail with EACCES")
     except (OSError, IOError) as ex:
         self.assertEqual(ex.errno, errno.EPERM)
Ejemplo n.º 3
0
 def testspawndetachednoblock(self):
     """spawndetached() should return without waiting for the process to
     finish."""
     start = time.time()
     util.spawndetached(["sleep", "5"])
     end = time.time()
     if end - start >= 1.0:
         self.fail("spawndetached() took took %s seconds, should have "
                   "returned immediately" % (end - start))
Ejemplo n.º 4
0
def backgroundrepack(repo, incremental=True):
    cmd = [util.hgexecutable(), "-R", repo.origroot, "repack"]
    msg = _("(running background repack)\n")
    if incremental:
        cmd.append("--incremental")
        msg = _("(running background incremental repack)\n")

    if not repo.ui.quiet:
        repo.ui.write_err(msg)
    util.spawndetached(cmd)
Ejemplo n.º 5
0
        def backgroundprefetch(
            self, revs, base=None, repack=False, pats=None, opts=None
        ):
            """Runs prefetch in background with optional repack"""
            cmd = [util.hgexecutable(), "-R", self.origroot, "prefetch"]
            if repack:
                cmd.append("--repack")
            if revs:
                cmd += ["-r", revs]
            if base:
                cmd += ["-b", base]

            util.spawndetached(cmd)