@ -917,7 +917,7 @@ class TestGitCl(TestCase):
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					                           short_hostname = ' chromium ' , 
 
					 
					 
					 
					                           short_hostname = ' chromium ' , 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					                           labels = None ,  change_id = None ,  original_title = None , 
 
					 
					 
					 
					                           labels = None ,  change_id = None ,  original_title = None , 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					                           final_description = None ,  gitcookies_exists = True , 
 
					 
					 
					 
					                           final_description = None ,  gitcookies_exists = True , 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					                           force = False  ): 
 
					 
					 
					 
					                           force = False , edit_description = None  ): 
 
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					    if  post_amend_description  is  None : 
 
					 
					 
					 
					    if  post_amend_description  is  None : 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					      post_amend_description  =  description 
 
					 
					 
					 
					      post_amend_description  =  description 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    cc  =  cc  or  [ ] 
 
					 
					 
					 
					    cc  =  cc  or  [ ] 
 
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					 
					@ -983,6 +983,13 @@ class TestGitCl(TestCase):
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					            ( ( [ ' git ' ,  ' config ' ,  ' core.editor ' ] , ) ,  ' ' ) , 
 
					 
					 
					 
					            ( ( [ ' git ' ,  ' config ' ,  ' core.editor ' ] , ) ,  ' ' ) , 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					            ( ( [ ' RunEditor ' ] , ) ,  description ) , 
 
					 
					 
					 
					            ( ( [ ' RunEditor ' ] , ) ,  description ) , 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					          ] 
 
					 
					 
					 
					          ] 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					      # user wants to edit description 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					      if  edit_description : 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					        calls  + =  [ 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					          ( ( [ ' git ' ,  ' config ' ,  ' rietveld.bug-prefix ' ] , ) ,  ' ' ) , 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					          ( ( [ ' git ' ,  ' config ' ,  ' core.editor ' ] , ) ,  ' ' ) , 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					          ( ( [ ' RunEditor ' ] , ) ,  edit_description ) , 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					        ] 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					      ref_to_push  =  ' abcdef0123456789 ' 
 
					 
					 
					 
					      ref_to_push  =  ' abcdef0123456789 ' 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					      calls  + =  [ 
 
					 
					 
					 
					      calls  + =  [ 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        ( ( [ ' git ' ,  ' config ' ,  ' branch.master.merge ' ] , ) ,  ' refs/heads/master ' ) , 
 
					 
					 
					 
					        ( ( [ ' git ' ,  ' config ' ,  ' branch.master.merge ' ] , ) ,  ' refs/heads/master ' ) , 
 
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					 
					@ -1240,6 +1247,7 @@ class TestGitCl(TestCase):
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					      final_description = None , 
 
					 
					 
					 
					      final_description = None , 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					      gitcookies_exists = True , 
 
					 
					 
					 
					      gitcookies_exists = True , 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					      force = False , 
 
					 
					 
					 
					      force = False , 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					      edit_description = None , 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					      fetched_description = None ) : 
 
					 
					 
					 
					      fetched_description = None ) : 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    """ Generic gerrit upload test framework. """ 
 
					 
					 
					 
					    """ Generic gerrit upload test framework. """ 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    if  squash_mode  is  None : 
 
					 
					 
					 
					    if  squash_mode  is  None : 
 
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					 
					@ -1311,7 +1319,8 @@ class TestGitCl(TestCase):
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					          original_title = original_title , 
 
					 
					 
					 
					          original_title = original_title , 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					          final_description = final_description , 
 
					 
					 
					 
					          final_description = final_description , 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					          gitcookies_exists = gitcookies_exists , 
 
					 
					 
					 
					          gitcookies_exists = gitcookies_exists , 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					          force = force ) 
 
					 
					 
					 
					          force = force , 
 
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					          edit_description = edit_description ) 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    # Uncomment when debugging. 
 
					 
					 
					 
					    # Uncomment when debugging. 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    # print('\n'.join(map(lambda x: '%2i: %s' % x, enumerate(self.calls)))) 
 
					 
					 
					 
					    # print('\n'.join(map(lambda x: '%2i: %s' % x, enumerate(self.calls)))) 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    git_cl . main ( [ ' upload ' ]  +  upload_args ) 
 
					 
					 
					 
					    git_cl . main ( [ ' upload ' ]  +  upload_args ) 
 
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					 
					@ -1531,6 +1540,21 @@ class TestGitCl(TestCase):
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        ' Uploading may fail due to lack of permissions ' , 
 
					 
					 
					 
					        ' Uploading may fail due to lack of permissions ' , 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        git_cl . sys . stdout . getvalue ( ) ) 
 
					 
					 
					 
					        git_cl . sys . stdout . getvalue ( ) ) 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					  def  test_upload_change_description_editor ( self ) : 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					    fetched_description  =  ' foo \n \n Change-Id: 123456789 ' 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					    description  =  ' bar \n \n Change-Id: 123456789 ' 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					    self . _run_gerrit_upload_test ( 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					        [ ' --squash ' ,  ' --edit-description ' ] , 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					        description , 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					        [ ] , 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					        fetched_description = fetched_description , 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					        squash = True , 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					        expected_upstream_ref = ' origin/master ' , 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					        issue = 123456 , 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					        change_id = ' 123456789 ' , 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					        original_title = ' User input ' , 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					        edit_description = description ) 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					  def  test_upload_branch_deps ( self ) : 
 
					 
					 
					 
					  def  test_upload_branch_deps ( self ) : 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    self . mock ( git_cl . sys ,  ' stdout ' ,  StringIO ( ) ) 
 
					 
					 
					 
					    self . mock ( git_cl . sys ,  ' stdout ' ,  StringIO ( ) ) 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    def  mock_run_git ( * args ,  * * _kwargs ) : 
 
					 
					 
					 
					    def  mock_run_git ( * args ,  * * _kwargs ) :