• hinoka@chromium.org's avatar
    Git Cache speculative fix for windows · 4e2ad846
    hinoka@chromium.org authored
    Git cache sometimes fail on:
    Traceback (most recent call last):
      File "E:\b\depot_tools\\gclient.py", line 2064, in <module>
        sys.exit(Main(sys.argv[1:]))
      File "E:\b\depot_tools\\gclient.py", line 2052, in Main
        return dispatcher.execute(OptionParser(), argv)
      File "E:\b\depot_tools\subcommand.py", line 245, in execute
        return command(parser, args[1:])
      File "E:\b\depot_tools\\gclient.py", line 1830, in CMDsync
        ret = client.RunOnDeps('update', args)
      File "E:\b\depot_tools\\gclient.py", line 1342, in RunOnDeps
        work_queue.flush(revision_overrides, command, args, options=self._options)
      File "E:\b\depot_tools\gclient_utils.py", line 852, in flush
        self._run_one_task(self.queued.pop(i), args, kwargs)
      File "E:\b\depot_tools\gclient_utils.py", line 944, in _run_one_task
        task_item.run(*args, **kwargs)
      File "E:\b\depot_tools\\gclient.py", line 744, in run
        file_list)
      File "E:\b\depot_tools\gclient_scm.py", line 160, in RunCommand
        return getattr(self, command)(options, args, file_list)
      File "E:\b\depot_tools\gclient_scm.py", line 387, in update
        self._UpdateMirror(mirror, options)
      File "E:\b\depot_tools\gclient_scm.py", line 802, in _UpdateMirror
        ignore_lock=options.ignore_locks)
      File "E:\b\depot_tools\git_cache.py", line 409, in populate
        os.rename(tempdir, self.mirror_path)
    WindowsError: [Error 183] Cannot create a file when that file already exists
    
    It would appear that its being racy, but otherwise it doesn't make any sense.  A theory
    is that this could be running twice and stepping on each other.  Allowing this
    to pass on OSError allows us to test this theory.
    
    BUG=395333
    
    Review URL: https://codereview.chromium.org/408653002
    
    git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@284272 0039d316-1c4b-4281-b951-d872f2087c98
    4e2ad846
git_cache.py 21.6 KB