[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Python question

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2003-01-11 18:25:00 CET


I am writing a regression test involving 'svn status' and symbolic
links in the working copy. I'm using os.symlink and I assume this
won't work on Windows, so the the test is skipped:

       Skip(status_type_change_to_link, (os.name != 'posix')),

The problem I am having is the function chmod_tree in svntest/main.py.
This gets run at the start of the test as part of removing any old
working copy from a previous run. It doesn't work when it encounters
symbolic links that point to items that don't exist. So far the only
way I can make this work is

Index: ../svn/subversion/tests/clients/cmdline/svntest/main.py
--- ../svn/subversion/tests/clients/cmdline/svntest/main.py (revision 4346)
+++ ../svn/subversion/tests/clients/cmdline/svntest/main.py (working copy)
@@ -243,8 +243,12 @@
     mode, mask = arg
     for name in names:
       fullname = os.path.join(dirname, name)
- new_mode = (os.stat(fullname)[stat.ST_MODE] & ~mask) | mode
- os.chmod(fullname, new_mode)
+ try:
+ new_mode = (os.stat(fullname)[stat.ST_MODE] & ~mask) | mode
+ os.chmod(fullname, new_mode)
+ except OSError:
+ # Ugly, but this happens for a broken symbolic link
+ pass
   os.path.walk(path, visit, (mode, mask))
 # For clearing away working copies

Anyone got any better ideas?

Philip Martin
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Jan 11 18:25:43 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.