#NEWLINE# def test_repo_git_update( self ) : #NEWLINE# #INDENT# repo_dir = os . path . join ( self . TMP_DIR , '.repo_dir' ) #NEWLINE# repo_name = 'my_git_project' #NEWLINE# git_repo = create_repo ( ** { #NEWLINE# #INDENT# 'url' : ( 'git+file://' + os . path . join ( repo_dir , repo_name ) ) , #NEWLINE# 'cwd' : self . TMP_DIR , #NEWLINE# 'name' : repo_name , #NEWLINE# #UNINDENT# } ) #NEWLINE# os . mkdir ( repo_dir ) #NEWLINE# run ( [ 'git' , 'init' , git_repo [ 'name' ] ] , cwd = repo_dir ) #NEWLINE# git_checkout_dest = os . path . join ( self . TMP_DIR , git_repo [ 'name' ] ) #NEWLINE# git_repo . obtain ( quiet = True ) #NEWLINE# testfile = 'testfile.test' #NEWLINE# run ( [ 'touch' , testfile ] , cwd = os . path . join ( repo_dir , repo_name ) ) #NEWLINE# run ( [ 'git' , 'add' , testfile ] , cwd = os . path . join ( repo_dir , repo_name ) ) #NEWLINE# run ( [ 'git' , 'commit' , '-m' , ( 'a test file for %s' % git_repo [ 'name' ] ) ] , cwd = os . path . join ( repo_dir , repo_name ) ) #NEWLINE# git_repo . update_repo ( ) #NEWLINE# test_repo_revision = run ( [ 'git' , 'rev-parse' , 'HEAD' ] , cwd = os . path . join ( repo_dir , repo_name ) ) [ 'stdout' ] #NEWLINE# self . assertEqual ( git_repo . get_revision ( ) , test_repo_revision ) #NEWLINE# self . assertTrue ( os . path . exists ( git_checkout_dest ) )