OLD | NEW |
1 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Gclient-specific SCM-specific operations.""" | 5 """Gclient-specific SCM-specific operations.""" |
6 | 6 |
7 import logging | 7 import logging |
8 import os | 8 import os |
9 import re | 9 import re |
10 import subprocess | 10 import subprocess |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 self.url = url | 50 self.url = url |
51 self._root_dir = root_dir | 51 self._root_dir = root_dir |
52 if self._root_dir: | 52 if self._root_dir: |
53 self._root_dir = self._root_dir.replace('/', os.sep) | 53 self._root_dir = self._root_dir.replace('/', os.sep) |
54 self.relpath = relpath | 54 self.relpath = relpath |
55 if self.relpath: | 55 if self.relpath: |
56 self.relpath = self.relpath.replace('/', os.sep) | 56 self.relpath = self.relpath.replace('/', os.sep) |
57 if self.relpath and self._root_dir: | 57 if self.relpath and self._root_dir: |
58 self.checkout_path = os.path.join(self._root_dir, self.relpath) | 58 self.checkout_path = os.path.join(self._root_dir, self.relpath) |
59 | 59 |
60 def FullUrlForRelativeUrl(self, url): | |
61 # Find the forth '/' and strip from there. A bit hackish. | |
62 return '/'.join(self.url.split('/')[:4]) + url | |
63 | |
64 def RunCommand(self, command, options, args, file_list=None): | 60 def RunCommand(self, command, options, args, file_list=None): |
65 # file_list will have all files that are modified appended to it. | 61 # file_list will have all files that are modified appended to it. |
66 if file_list is None: | 62 if file_list is None: |
67 file_list = [] | 63 file_list = [] |
68 | 64 |
69 commands = ['cleanup', 'export', 'update', 'revert', 'revinfo', | 65 commands = ['cleanup', 'export', 'update', 'revert', 'revinfo', |
70 'status', 'diff', 'pack', 'runhooks'] | 66 'status', 'diff', 'pack', 'runhooks'] |
71 | 67 |
72 if not command in commands: | 68 if not command in commands: |
73 raise gclient_utils.Error('Unknown command %s' % command) | 69 raise gclient_utils.Error('Unknown command %s' % command) |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 self.ReplaceAndPrint(line) | 503 self.ReplaceAndPrint(line) |
508 else: | 504 else: |
509 if (line.startswith(self.original_prefix) or | 505 if (line.startswith(self.original_prefix) or |
510 line.startswith(self.working_prefix)): | 506 line.startswith(self.working_prefix)): |
511 self.ReplaceAndPrint(line) | 507 self.ReplaceAndPrint(line) |
512 else: | 508 else: |
513 print line | 509 print line |
514 | 510 |
515 filterer = DiffFilterer(self.relpath) | 511 filterer = DiffFilterer(self.relpath) |
516 self.RunAndFilterOutput(command, path, False, False, filterer.Filter) | 512 self.RunAndFilterOutput(command, path, False, False, filterer.Filter) |
OLD | NEW |