| OLD | NEW |
| 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 |
| 11 import random | 11 import random |
| 12 import re | 12 import re |
| 13 import shutil | 13 import shutil |
| 14 import string | 14 import string |
| 15 import subprocess | 15 import subprocess |
| 16 import sys | 16 import sys |
| 17 import tempfile | 17 import tempfile |
| 18 import time |
| 18 from third_party import upload | 19 from third_party import upload |
| 19 import urllib2 | 20 import urllib2 |
| 20 | 21 |
| 21 import breakpad | 22 import breakpad |
| 22 | 23 |
| 23 # gcl now depends on gclient. | 24 # gcl now depends on gclient. |
| 24 from scm import SVN | 25 from scm import SVN |
| 25 import gclient_utils | 26 import gclient_utils |
| 26 | 27 |
| 27 __version__ = '1.1.3' | 28 __version__ = '1.1.3' |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 global FILES_CACHE | 125 global FILES_CACHE |
| 125 if filename not in FILES_CACHE: | 126 if filename not in FILES_CACHE: |
| 126 # Don't try to look up twice. | 127 # Don't try to look up twice. |
| 127 FILES_CACHE[filename] = None | 128 FILES_CACHE[filename] = None |
| 128 # First we check if we have a cached version. | 129 # First we check if we have a cached version. |
| 129 try: | 130 try: |
| 130 cached_file = os.path.join(GetCacheDir(), filename) | 131 cached_file = os.path.join(GetCacheDir(), filename) |
| 131 except gclient_utils.Error: | 132 except gclient_utils.Error: |
| 132 return None | 133 return None |
| 133 if (not os.path.exists(cached_file) or | 134 if (not os.path.exists(cached_file) or |
| 134 os.stat(cached_file).st_mtime > max_age): | 135 (time.time() - os.stat(cached_file).st_mtime) > max_age): |
| 135 dir_info = SVN.CaptureInfo(".") | 136 dir_info = SVN.CaptureInfo(".") |
| 136 repo_root = dir_info["Repository Root"] | 137 repo_root = dir_info["Repository Root"] |
| 137 if use_root: | 138 if use_root: |
| 138 url_path = repo_root | 139 url_path = repo_root |
| 139 else: | 140 else: |
| 140 url_path = dir_info["URL"] | 141 url_path = dir_info["URL"] |
| 141 content = "" | 142 content = "" |
| 142 while True: | 143 while True: |
| 143 # Look in the repository at the current level for the file. | 144 # Look in the repository at the current level for the file. |
| 144 svn_path = url_path + "/" + filename | 145 svn_path = url_path + "/" + filename |
| (...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1250 return 0 | 1251 return 0 |
| 1251 args =["svn", command] | 1252 args =["svn", command] |
| 1252 root = GetRepositoryRoot() | 1253 root = GetRepositoryRoot() |
| 1253 args.extend([os.path.join(root, x) for x in change_info.GetFileNames()]) | 1254 args.extend([os.path.join(root, x) for x in change_info.GetFileNames()]) |
| 1254 RunShell(args, True) | 1255 RunShell(args, True) |
| 1255 return 0 | 1256 return 0 |
| 1256 | 1257 |
| 1257 | 1258 |
| 1258 if __name__ == "__main__": | 1259 if __name__ == "__main__": |
| 1259 sys.exit(main()) | 1260 sys.exit(main()) |
| OLD | NEW |