#NEWLINE# @ classmethod #NEWLINE# def _to_relative_path( cls , parent_repo , path ) : #NEWLINE# #INDENT# ":return: a path guaranteed  to be relative to the given parent-repository\n        :raise ValueError: if path is not contained in the parent repository's working tree" #NEWLINE# path = to_native_path_linux ( path ) #NEWLINE# if path . endswith ( '/' ) : #NEWLINE# #INDENT# path = path [ : ( - 1 ) ] #NEWLINE# #UNINDENT# if os . path . isabs ( path ) : #NEWLINE# #INDENT# working_tree_linux = to_native_path_linux ( parent_repo . working_tree_dir ) #NEWLINE# if ( not path . startswith ( working_tree_linux ) ) : #NEWLINE# #INDENT# raise ValueError ( ( "Submodule checkout path '%s' needs to be within the parents repository at '%s'" % ( path , path ) ) ) #NEWLINE# #UNINDENT# path = path [ ( len ( working_tree_linux ) + 1 ) : ] #NEWLINE# if ( not path ) : #NEWLINE# #INDENT# raise ValueError ( ( "Absolute submodule path '%s' didn't yield a valid relative path" % path ) ) #NEWLINE# #UNINDENT# #UNINDENT# return path