<s> from __future__ import ( absolute_import , division , generators , nested_scopes , print_function , <EOL> unicode_literals , with_statement ) <EOL> from abc import abstractmethod <EOL> from pants . base . build_environment import get_buildroot <EOL> from pants . scm . scm import Scm <EOL> from pants . util . meta import AbstractClass <EOL> class Workspace ( AbstractClass ) : <EOL> """<STR_LIT>""" <EOL> class WorkspaceError ( Exception ) : <EOL> """<STR_LIT>""" <EOL> @ abstractmethod <EOL> def touched_files ( self , parent ) : <EOL> """<STR_LIT>""" <EOL> @ abstractmethod <EOL> def changes_in ( self , rev_or_range ) : <EOL> """<STR_LIT>""" <EOL> class ScmWorkspace ( Workspace ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , scm ) : <EOL> """<STR_LIT>""" <EOL> super ( ScmWorkspace , self ) . __init__ ( ) <EOL> if scm is None : <EOL> raise self . WorkspaceError ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> self . _scm = scm <EOL> def touched_files ( self , parent ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> return self . _scm . changed_files ( from_commit = parent , <EOL> include_untracked = True , <EOL> relative_to = get_buildroot ( ) ) <EOL> except Scm . ScmException as e : <EOL> raise self . WorkspaceError ( "<STR_LIT>" , e ) <EOL> def changes_in ( self , rev_or_range ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> return self . _scm . changes_in ( rev_or_range , relative_to = get_buildroot ( ) ) <EOL> except Scm . ScmException as e : <EOL> raise self . WorkspaceError ( "<STR_LIT>" . format ( rev_or_range ) , e ) </s>
