Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Unified Diff: wtf

Issue 1602020: Adding weekly tool to help with weekly snippets (Closed)
Patch Set: . Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « weekly ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: wtf
diff --git a/wtf b/wtf
index 72e2dfcf11cfa1d4fc08f4e1e1a8c279b3077406..79fbaf39903c8381ffb58e89866eb66644147dfe 100755
--- a/wtf
+++ b/wtf
@@ -5,6 +5,7 @@
"""Display active git branches and code changes in a chromiumos workspace."""
+import gclient_utils
import os
import re
import subprocess
@@ -51,15 +52,6 @@ def show_dir(full_name, relative_name, color):
print status
-def find_file(filename):
- """Search upwards from the current directory to find a file."""
- path = filename
- while os.getcwd().split('/'):
- if os.path.isfile(path):
- return path
- path = os.path.join('../', path)
-
-
def main():
"""Take no arguments."""
@@ -69,23 +61,14 @@ def main():
color = True
base = os.path.basename(os.getcwd())
- config_file = '.gclient_entries'
- config_path = find_file(config_file)
-
- if not config_path:
- print "Can't find", config_file
- sys.exit(1)
-
- env = {}
- execfile(config_path, env)
+ root, entries = gclient_utils.GetGClientRootAndEntries()
- # which are the git repos?
- raw = [k for k, v in env['entries'].items() if not re.search('svn', v)]
+ # which entries map to a git repos?
+ raw = [k for k, v in entries.items() if not re.search('svn', v)]
raw.sort()
# We want to use the full path for testing, but we want to use the relative
# path for display.
- root = os.path.dirname(config_path)
fulldirs = map(lambda(p): os.path.normpath(os.path.join(root, p)), raw)
reldirs = map(lambda(p): re.sub('^' + base, '.', p), raw)
« no previous file with comments | « weekly ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698