OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Display active git branches and code changes in a chromiumos workspace.""" | 6 """Display active git branches and code changes in a chromiumos workspace.""" |
7 | 7 |
8 import gclient_utils | 8 import gclient_utils |
9 import os | 9 import os |
10 import re | 10 import re |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 | 57 |
58 color = False | 58 color = False |
59 | 59 |
60 if os.isatty(1): | 60 if os.isatty(1): |
61 color = True | 61 color = True |
62 | 62 |
63 base = os.path.basename(os.getcwd()) | 63 base = os.path.basename(os.getcwd()) |
64 root, entries = gclient_utils.GetGClientRootAndEntries() | 64 root, entries = gclient_utils.GetGClientRootAndEntries() |
65 | 65 |
66 # which entries map to a git repos? | 66 # which entries map to a git repos? |
67 raw = [k for k, v in entries.items() if not re.search('svn', v)] | 67 raw = [k for k, v in entries.items() if v and not re.search('svn', v)] |
M-A Ruel
2012/09/12 20:34:14
raw = sorted(k for k, v in entries.itermitems() if
| |
68 raw.sort() | 68 raw.sort() |
69 | 69 |
70 # We want to use the full path for testing, but we want to use the relative | 70 # We want to use the full path for testing, but we want to use the relative |
71 # path for display. | 71 # path for display. |
72 fulldirs = map(lambda(p): os.path.normpath(os.path.join(root, p)), raw) | 72 fulldirs = map(lambda(p): os.path.normpath(os.path.join(root, p)), raw) |
73 reldirs = map(lambda(p): re.sub('^' + base, '.', p), raw) | 73 reldirs = map(lambda(p): re.sub('^' + base, '.', p), raw) |
74 | 74 |
75 for full_path, relative_path in zip(fulldirs, reldirs): | 75 for full_path, relative_path in zip(fulldirs, reldirs): |
76 show_dir(full_path, relative_path, color) | 76 show_dir(full_path, relative_path, color) |
77 | 77 |
78 if __name__ == '__main__': | 78 if __name__ == '__main__': |
79 main() | 79 main() |
OLD | NEW |