def METHOD_NAME():
  if True:
    os.chdir(constants.BENCH_BASE_DIR)
    for i in range(30):
      try:
        runCommand('hg pull -u > hgupdate.log');
      except RuntimeError:
        message('  retry...')
        time.sleep(60.0)
      else:
        s = open('hgupdate.log', 'r').read()
        if s.find('not updating') != -1:
          raise RuntimeError('hg did not update: %s' % s)
        else:
          break
    else:
      raise RuntimeError('failed to run hg pull -u')
    os.chdir('%s/%s' % (constants.BASE_DIR, NIGHTLY_DIR))
    runCommand('svn cleanup')
    open('update.log', 'ab').write('\n\n[%s]: update' % datetime.datetime.now())
    for i in range(30):
      try:
        runCommand('svn update > update.log 2>&1')
      except RuntimeError:
        message('  retry...')
        time.sleep(60.0)
      else:
        svnRev = int(reSVNRev.search(open('update.log', 'rb').read()).group(1))
        print 'SVN rev is %s' % svnRev
        break
    else:
      raise RuntimeError('svn update failed')
  runCommand('%s clean > clean.log 2>&1' % constants.GRADLE_EXE)
  runCommand('%s compile > compile.log 2>&1' % constants.GRADLE_EXE)
  MEDIUM_LINE_FILE = constants.NIGHTLY_MEDIUM_LINE_FILE
  MEDIUM_INDEX_NUM_DOCS = constants.NIGHTLY_MEDIUM_INDEX_NUM_DOCS
  mediumSource = competition.Data('wikimedium',
                                  MEDIUM_LINE_FILE,
                                  MEDIUM_INDEX_NUM_DOCS,
                                  constants.WIKI_MEDIUM_TASKS_FILE)
  comp = competition.Competition()
  index = comp.newIndex(NIGHTLY_DIR, mediumSource)
  c = comp.competitor(id, NIGHTLY_DIR, index=index)
  r = benchUtil.RunAlgs(constants.JAVA_COMMAND, True, True)
  r.compile(c)