Commit d9682e9e authored by eric@webkit.org's avatar eric@webkit.org
Browse files

2010-10-25 Eric Seidel <eric@webkit.org>

        Reviewed by Adam Barth.

        webkit-patch should clean up svn locks when passed --force-clean
        https://bugs.webkit.org/show_bug.cgi?id=48269

        * Scripts/webkitpy/common/checkout/scm.py:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70502 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 75e9db9e
2010-10-25 Eric Seidel <eric@webkit.org>
Reviewed by Adam Barth.
webkit-patch should clean up svn locks when passed --force-clean
https://bugs.webkit.org/show_bug.cgi?id=48269
* Scripts/webkitpy/common/checkout/scm.py:
2010-10-25 Anders Carlsson <andersca@apple.com>
 
Reviewed by Adam Roben.
......
......@@ -379,6 +379,12 @@ class SVN(SCM):
return self.run(["svn", "diff"], cwd=self.checkout_root, decode_output=False) == ""
def clean_working_directory(self):
# Make sure there are no locks lying around from a previously aborted svn invocation.
# This is slightly dangerous, as it's possible the user is running another svn process
# on this checkout at the same time. However, it's much more likely that we're running
# under windows and svn just sucks (or the user interrupted svn and it failed to clean up).
self.run(["svn", "cleanup"], cwd=self.checkout_root)
# svn revert -R is not as awesome as git reset --hard.
# It will leave added files around, causing later svn update
# calls to fail on the bots. We make this mirror git reset --hard
......@@ -432,6 +438,7 @@ class SVN(SCM):
def revisions_changing_file(self, path, limit=5):
revisions = []
# svn log will exit(1) (and thus self.run will raise) if the path does not exist.
log_command = ['svn', 'log', '--quiet', '--limit=%s' % limit, path]
for line in self.run(log_command, cwd=self.checkout_root).splitlines():
match = re.search('^r(?P<revision>\d+) ', line)
......
......@@ -760,6 +760,15 @@ Q1dTBx0AAAB42itg4GlgYJjGwMDDyODMxMDw34GBgQEAJPQDJA==
self.do_test_diff_for_file()
self.assertFalse(os.path.exists(self.bogus_dir))
def test_svn_lock(self):
svn_root_lock_path = ".svn/lock"
write_into_file_at_path(svn_root_lock_path, "", "utf-8")
# webkit-patch uses a Checkout object and runs update-webkit, just use svn update here.
self.assertRaises(ScriptError, run_command, ['svn', 'update'])
self.scm.clean_working_directory()
self.assertFalse(os.path.exists(svn_root_lock_path))
run_command(['svn', 'update']) # Should succeed and not raise.
class GitTest(SCMTest):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment