OLD | NEW |
1 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2006-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 """SCM-specific utility classes.""" | 5 """SCM-specific utility classes.""" |
6 | 6 |
7 import glob | 7 import glob |
8 import os | 8 import os |
9 import re | 9 import re |
10 import shutil | 10 import shutil |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 return ('', '') | 63 return ('', '') |
64 raise | 64 raise |
65 | 65 |
66 @staticmethod | 66 @staticmethod |
67 def CaptureStatus(files, upstream_branch='origin'): | 67 def CaptureStatus(files, upstream_branch='origin'): |
68 """Returns git status. | 68 """Returns git status. |
69 | 69 |
70 @files can be a string (one file) or a list of files. | 70 @files can be a string (one file) or a list of files. |
71 | 71 |
72 Returns an array of (status, file) tuples.""" | 72 Returns an array of (status, file) tuples.""" |
73 command = ["diff", "--name-status", "-r", "%s.." % upstream_branch] | 73 command = ["diff", "--name-status", "-r", "%s..." % upstream_branch] |
74 if not files: | 74 if not files: |
75 pass | 75 pass |
76 elif isinstance(files, basestring): | 76 elif isinstance(files, basestring): |
77 command.append(files) | 77 command.append(files) |
78 else: | 78 else: |
79 command.extend(files) | 79 command.extend(files) |
80 | 80 |
81 status = GIT.Capture(command)[0].rstrip() | 81 status = GIT.Capture(command)[0].rstrip() |
82 results = [] | 82 results = [] |
83 if status: | 83 if status: |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 if not cur_dir_repo_root: | 756 if not cur_dir_repo_root: |
757 return None | 757 return None |
758 | 758 |
759 while True: | 759 while True: |
760 parent = os.path.dirname(directory) | 760 parent = os.path.dirname(directory) |
761 if (SVN.CaptureInfo(parent, print_error=False).get( | 761 if (SVN.CaptureInfo(parent, print_error=False).get( |
762 "Repository Root") != cur_dir_repo_root): | 762 "Repository Root") != cur_dir_repo_root): |
763 break | 763 break |
764 directory = parent | 764 directory = parent |
765 return GetCasedPath(directory) | 765 return GetCasedPath(directory) |
OLD | NEW |