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

Side by Side Diff: gcl.py

Issue 113650: Fix error printing in gcl.GetRepositoryRoot() and fix its unit tests. (Closed)
Patch Set: Created 11 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | tests/gcl_unittest.py » ('j') | tests/gcl_unittest.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2006-2009 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 # Wrapper script around Rietveld's upload.py that groups files into 6 # Wrapper script around Rietveld's upload.py that groups files into
7 # changelists. 7 # changelists.
8 8
9 import getpass 9 import getpass
10 import os 10 import os
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 global repository_root 94 global repository_root
95 if not repository_root: 95 if not repository_root:
96 infos = gclient.CaptureSVNInfo(os.getcwd(), print_error=False) 96 infos = gclient.CaptureSVNInfo(os.getcwd(), print_error=False)
97 cur_dir_repo_root = infos.get("Repository Root") 97 cur_dir_repo_root = infos.get("Repository Root")
98 if not cur_dir_repo_root: 98 if not cur_dir_repo_root:
99 raise Exception("gcl run outside of repository") 99 raise Exception("gcl run outside of repository")
100 100
101 repository_root = os.getcwd() 101 repository_root = os.getcwd()
102 while True: 102 while True:
103 parent = os.path.dirname(repository_root) 103 parent = os.path.dirname(repository_root)
104 if (gclient.CaptureSVNInfo(parent).get("Repository Root") != 104 if (gclient.CaptureSVNInfo(parent, print_error=False).get(
105 cur_dir_repo_root): 105 "Repository Root") != cur_dir_repo_root):
106 break 106 break
107 repository_root = parent 107 repository_root = parent
108 return repository_root 108 return repository_root
109 109
110 110
111 def GetInfoDir(): 111 def GetInfoDir():
112 """Returns the directory where gcl info files are stored.""" 112 """Returns the directory where gcl info files are stored."""
113 global gcl_info_dir 113 global gcl_info_dir
114 if not gcl_info_dir: 114 if not gcl_info_dir:
115 gcl_info_dir = os.path.join(GetRepositoryRoot(), '.svn', 'gcl_info') 115 gcl_info_dir = os.path.join(GetRepositoryRoot(), '.svn', 'gcl_info')
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 # the files. This allows commands such as 'gcl diff xxx' to work. 1097 # the files. This allows commands such as 'gcl diff xxx' to work.
1098 args =["svn", command] 1098 args =["svn", command]
1099 root = GetRepositoryRoot() 1099 root = GetRepositoryRoot()
1100 args.extend([os.path.join(root, x) for x in change_info.FileList()]) 1100 args.extend([os.path.join(root, x) for x in change_info.FileList()])
1101 RunShell(args, True) 1101 RunShell(args, True)
1102 return 0 1102 return 0
1103 1103
1104 1104
1105 if __name__ == "__main__": 1105 if __name__ == "__main__":
1106 sys.exit(main()) 1106 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | tests/gcl_unittest.py » ('j') | tests/gcl_unittest.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698