parameters: (filesystem, checkout_root, paths)
return_statement: return paths
docstring: Change the working directory to the WebKit checkout root, if possible.
  
      If every path in the paths parameter is below the checkout root (or if
      the paths parameter is empty or None), this method changes the current
      working directory to the checkout root and converts the paths parameter
      as described below.
          This allows the paths being checked to be displayed relative to the
      checkout root, and for path-specific style checks to work as expected.
      Path-specific checks include whether files should be skipped, whether
      custom style rules should apply to certain files, etc.
  
      Returns:
        paths: A copy of the paths parameter -- possibly converted, as follows.
               If this method changed the current working directory to the
               checkout root, then the list is the paths parameter converted to
               normalized paths relative to the checkout root.
  
      Args:
        paths: A list of paths to the files that should be checked for style.
               This argument can be None or the empty list if a git commit
               or all changes under the checkout root should be checked.
        checkout_root: The path to the root of the WebKit checkout.
docstring_summary: Change the working directory to the WebKit checkout root, if possible.
docstring_tokens: Change the working directory to the WebKit checkout root if possible .
function: def change_directory(filesystem, checkout_root, paths):
      """Change the working directory to the WebKit checkout root, if possible.
  
      If every path in the paths parameter is below the checkout root (or if
      the paths parameter is empty or None), this method changes the current
      working directory to the checkout root and converts the paths parameter
      as described below.
          This allows the paths being checked to be displayed relative to the
      checkout root, and for path-specific style checks to work as expected.
      Path-specific checks include whether files should be skipped, whether
      custom style rules should apply to certain files, etc.
  
      Returns:
        paths: A copy of the paths parameter -- possibly converted, as follows.
               If this method changed the current working directory to the
               checkout root, then the list is the paths parameter converted to
               normalized paths relative to the checkout root.
  
      Args:
        paths: A list of paths to the files that should be checked for style.
               This argument can be None or the empty list if a git commit
               or all changes under the checkout root should be checked.
        checkout_root: The path to the root of the WebKit checkout.
  
      """
      if paths is not None:
          paths = list(paths)
  
      if paths:
          # Then try converting all of the paths to paths relative to
          # the checkout root.
          rel_paths = []
          for path in paths:
              rel_path = filesystem.relpath(path, checkout_root)
              if rel_path.startswith(filesystem.pardir):
                  # Then the path is not below the checkout root.  Since all
                  # paths should be interpreted relative to the same root,
                  # do not interpret any of the paths as relative to the
                  # checkout root.  Interpret all of them relative to the
                  # current working directory, and do not change the current
                  # working directory.
                  _log.warn(
  """Path-dependent style checks may not work correctly:
  
    One of the given paths is outside the WebKit checkout of the current
    working directory:
  
      Path: %s
      Checkout root: %s
  
    Pass only files below the checkout root to ensure correct results.
    See the help documentation for more info.
  """
                            % (path, checkout_root))
  
                  return paths
              rel_paths.append(rel_path)
          # If we got here, the conversion was successful.
          paths = rel_paths
  
      _log.debug("Changing to checkout root: " + checkout_root)
      filesystem.chdir(checkout_root)
  
      return paths
function_tokens: def change_directory ( filesystem , checkout_root , paths ) : if paths is not None : paths = list ( paths ) if paths : # Then try converting all of the paths to paths relative to # the checkout root. rel_paths = [ ] for path in paths : rel_path = filesystem . relpath ( path , checkout_root ) if rel_path . startswith ( filesystem . pardir ) : # Then the path is not below the checkout root.  Since all # paths should be interpreted relative to the same root, # do not interpret any of the paths as relative to the # checkout root.  Interpret all of them relative to the # current working directory, and do not change the current # working directory. _log . warn ( """Path-dependent style checks may not work correctly:
  
    One of the given paths is outside the WebKit checkout of the current
    working directory:
  
      Path: %s
      Checkout root: %s
  
    Pass only files below the checkout root to ensure correct results.
    See the help documentation for more info.
  """ % ( path , checkout_root ) ) return paths rel_paths . append ( rel_path ) # If we got here, the conversion was successful. paths = rel_paths _log . debug ( "Changing to checkout root: " + checkout_root ) filesystem . chdir ( checkout_root ) return paths