equal
deleted
inserted
replaced
|
1 #!/usr/bin/python |
|
2 # |
|
3 # Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 # All rights reserved. |
|
5 # This component and the accompanying materials are made available |
|
6 # under the terms of "Eclipse Public License v1.0" |
|
7 # which accompanies this distribution, and is available |
|
8 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
9 # |
|
10 # Initial Contributors: |
|
11 # Nokia Corporation - initial contribution. |
|
12 # |
|
13 # Contributors: |
|
14 # |
|
15 # Description: |
|
16 # Checks for empty directories (ignoring .svn directories) recursively |
|
17 # starting from the given path. This check is done because Mercurial does |
|
18 # not support empty directories. |
|
19 |
|
20 import sys, os, re |
|
21 |
|
22 def main(): |
|
23 |
|
24 def visitFun(arg, dirname, names): |
|
25 |
|
26 # Skip SVN directories |
|
27 if dirname.find("\\.svn") != -1: |
|
28 return |
|
29 |
|
30 # Check if the directory is empty (except for the .svn subdirectory) |
|
31 if len(names) == 0 or (len(names) == 1 and names[0] == ".svn"): |
|
32 print dirname |
|
33 |
|
34 root = sys.argv[1] |
|
35 os.path.walk(root, visitFun, None) |
|
36 |
|
37 |
|
38 if __name__ == "__main__": |
|
39 main() |