class_docstr: ArrowSources is a companion class representing a directory containing
  Apache Arrow's sources.
class_docstr_tok: ["ArrowSources","is","a","companion","class","representing","a","directory","containing","Apache","Arrow","'s","sources","."]
docstr: Return a copy of the current sources for a specified git revision.
  
  This method may return the current object if no checkout is required.
  The caller is responsible to remove the cloned repository directory.
  
  The user can use the special WORKSPACE token to mean the current git
  workspace (no checkout performed).
  
  The second value of the returned tuple indicates if a clone was
  performed.
  
  Parameters
  ----------
  revision : str
             Revision to checkout sources at.
  clone_dir : str
              Path to checkout the local clone.
docstr_tok: ["Return","a","copy","of","the","current","sources","for","a","specified","git","revision",".","This","method","may","return","the","current","object","if","no","checkout","is","required",".","The","caller","is","responsible","to","remove","the","cloned","repository","directory",".","The","user","can","use","the","special","WORKSPACE","token","to","mean","the","current","git","workspace","(","no","checkout","performed",")",".","The","second","value","of","the","returned","tuple","indicates","if","a","clone","was","performed",".","Parameters","--","--","--","--","--","revision",":","str","Revision","to","checkout","sources","at",".","clone_dir",":","str","Path","to","checkout","the","local","clone","."]
code: def at_revision(self, revision, clone_dir):
      """Return a copy of the current sources for a specified git revision.
  
      This method may return the current object if no checkout is required.
      The caller is responsible to remove the cloned repository directory.
  
      The user can use the special WORKSPACE token to mean the current git
      workspace (no checkout performed).
  
      The second value of the returned tuple indicates if a clone was
      performed.
  
      Parameters
      ----------
      revision : str
                 Revision to checkout sources at.
      clone_dir : str
                  Path to checkout the local clone.
      """
      if not self.git_backed:
          raise ValueError("{} is not backed by git".format(self))
  
      if revision == ArrowSources.WORKSPACE:
          return self, False
  
      # A local clone is required to leave the current sources intact such
      # that builds depending on said sources are not invalidated (or worse
      # slightly affected when re-invoking the generator).
      # "--local" only works when dest dir is on same volume of source dir.
      # "--shared" works even if dest dir is on different volume.
      git.clone("--shared", self.path, clone_dir)
  
      # Revision can reference "origin/" (or any remotes) that are not found
      # in the local clone. Thus, revisions are dereferenced in the source
      # repository.
      original_revision = git.rev_parse(revision)
  
      git.checkout(original_revision, git_dir=clone_dir)
  
      return ArrowSources(clone_dir), True
  
imports: import os
  from pathlib import Path
  import subprocess
  import tempfile
  from .command import Command
  from .git import git
label_desc: Use image node_id 12 for calling the ArrowSources obj's underlying member method code with example usage: obj.at_revision(revision, clone_dir) and returns: ArrowSources,  True, self,  False