Changeset 47540 in webkit
- Timestamp:
- Aug 19, 2009 6:58:19 PM (15 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r47532 r47540 1 2009-08-19 Eric Seidel <eric@webkit.org> 2 3 Reviewed by Adam Barth. 4 5 commit-queue/bugzilla-tool can get wedged if git is mid-rebase 6 https://bugs.webkit.org/show_bug.cgi?id=28436 7 8 Make clean_working_directory cancel rebases too (even though that's a bit of a hack). 9 This code will only ever be run when --force-clean is passed. 10 11 I also added a new unit test to make sure this code actually works. :) 12 13 * Scripts/modules/scm.py: 14 * Scripts/modules/scm_unittest.py: 15 1 16 2009-08-19 Eric Seidel <eric@webkit.org> 2 17 -
trunk/WebKitTools/Scripts/modules/scm.py
r47345 r47540 287 287 def __init__(self, cwd, dryrun=False): 288 288 SCM.__init__(self, cwd, dryrun) 289 289 290 290 @classmethod 291 291 def in_working_directory(cls, path): … … 311 311 return self.run_command(['git', 'log', '--pretty=oneline', 'HEAD...trunk']).splitlines() 312 312 313 def rebase_in_progress(self): 314 return os.path.exists(os.path.join(self.checkout_root, '.git/rebase-apply')) 315 313 316 def working_directory_is_clean(self): 314 317 return self.run_command(['git', 'diff-index', 'HEAD']) == "" 315 318 316 319 def clean_working_directory(self): 317 320 # Could run git clean here too, but that wouldn't match working_directory_is_clean 318 321 self.run_command(['git', 'reset', '--hard', 'HEAD']) 319 322 # Aborting rebase even though this does not match working_directory_is_clean 323 if self.rebase_in_progress(): 324 self.run_command(['git', 'rebase', '--abort']) 325 320 326 def update_webkit(self): 321 # FIXME: Should probably call update-webkit, no?327 # FIXME: Call update-webkit once https://bugs.webkit.org/show_bug.cgi?id=27162 is fixed. 322 328 log("Updating working directory") 323 329 self.run_command(['git', 'svn', 'rebase']) -
trunk/WebKitTools/Scripts/modules/scm_unittest.py
r46772 r47540 37 37 # Perhaps through some SCMTest base-class which both SVNTest and GitTest inherit from. 38 38 39 def run(args): 40 SCM.run_command(args) 39 def run(args, cwd=None): 40 SCM.run_command(args, cwd=cwd) 41 42 def run_silent(args, cwd=None): 43 process = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=cwd) 44 process.communicate() # ignore output 45 exit_code = process.wait() 46 if exit_code: 47 raise ScriptError('Failed to run "%s" exit_code: %d cwd: %s' % (args, exit_code, cwd)) 48 49 def write_into_file_at_path(file_path, contents): 50 file = open(file_path, 'w') 51 file.write(contents) 52 file.close() 41 53 42 54 # Exists to share svn repository creation code between the git and svn tests … … 102 114 def _setup_git_clone_of_svn_repository(self): 103 115 self.git_checkout_path = tempfile.mkdtemp(suffix="git_test_checkout") 104 # --quiet doesn't make git svn silent, so we redirect output 105 args = ['git', 'svn', '--quiet', 'clone', self.svn_repo_url, self.git_checkout_path] 106 git_svn_clone = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) 107 git_svn_clone.communicate() # ignore output 108 git_svn_clone.wait() 116 # --quiet doesn't make git svn silent, so we use run_silent to redirect output 117 run_silent(['git', 'svn', '--quiet', 'clone', self.svn_repo_url, self.git_checkout_path]) 109 118 110 119 def _tear_down_git_clone_of_svn_repository(self): … … 125 134 self.assertEqual(scm.supports_local_commits(), True) 126 135 136 def test_rebase_in_progress(self): 137 svn_test_file = os.path.join(self.svn_checkout_path, 'test_file') 138 write_into_file_at_path(svn_test_file, "svn_checkout") 139 run(['svn', 'commit', '--message', 'commit to conflict with git commit'], cwd=self.svn_checkout_path) 140 141 git_test_file = os.path.join(self.git_checkout_path, 'test_file') 142 write_into_file_at_path(git_test_file, "git_checkout") 143 run(['git', 'commit', '-a', '-m', 'commit to be thrown away by rebase abort']) 144 145 # --quiet doesn't make git svn silent, so use run_silent to redirect output 146 self.assertRaises(ScriptError, run_silent, ['git', 'svn', '--quiet', 'rebase']) # Will fail due to a conflict leaving us mid-rebase. 147 148 scm = detect_scm_system(self.git_checkout_path) 149 self.assertTrue(scm.rebase_in_progress()) 150 151 # Make sure our cleanup works. 152 scm.clean_working_directory() 153 self.assertFalse(scm.rebase_in_progress()) 154 155 # Make sure cleanup doesn't throw when no rebase is in progress. 156 scm.clean_working_directory() 157 127 158 def test_commitish_parsing(self): 128 159 scm = detect_scm_system(self.git_checkout_path) 129 160 130 161 # Multiple revisions are cherry-picked. 131 162 self.assertEqual(len(scm.commit_ids_from_commitish_arguments(['HEAD~2'])), 1) 132 163 self.assertEqual(len(scm.commit_ids_from_commitish_arguments(['HEAD', 'HEAD~2'])), 2) 133 164 134 165 # ... is an invalid range specifier 135 166 self.assertRaises(ScriptError, scm.commit_ids_from_commitish_arguments, ['trunk...HEAD'])
Note: See TracChangeset
for help on using the changeset viewer.