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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 """Get the head revision of a SVN repository. | 487 """Get the head revision of a SVN repository. |
488 | 488 |
489 Returns: | 489 Returns: |
490 Int head revision | 490 Int head revision |
491 """ | 491 """ |
492 info = SVN.Capture(["info", "--xml", url], os.getcwd()) | 492 info = SVN.Capture(["info", "--xml", url], os.getcwd()) |
493 dom = xml.dom.minidom.parseString(info) | 493 dom = xml.dom.minidom.parseString(info) |
494 return dom.getElementsByTagName('entry')[0].getAttribute('revision') | 494 return dom.getElementsByTagName('entry')[0].getAttribute('revision') |
495 | 495 |
496 @staticmethod | 496 @staticmethod |
| 497 def CaptureBaseRevision(cwd): |
| 498 """Get the base revision of a SVN repository. |
| 499 |
| 500 Returns: |
| 501 Int base revision |
| 502 """ |
| 503 info = SVN.Capture(["info", "--xml"], cwd) |
| 504 dom = xml.dom.minidom.parseString(info) |
| 505 return dom.getElementsByTagName('entry')[0].getAttribute('revision') |
| 506 |
| 507 @staticmethod |
497 def CaptureStatus(files): | 508 def CaptureStatus(files): |
498 """Returns the svn 1.5 svn status emulated output. | 509 """Returns the svn 1.5 svn status emulated output. |
499 | 510 |
500 @files can be a string (one file) or a list of files. | 511 @files can be a string (one file) or a list of files. |
501 | 512 |
502 Returns an array of (status, file) tuples.""" | 513 Returns an array of (status, file) tuples.""" |
503 command = ["status", "--xml"] | 514 command = ["status", "--xml"] |
504 if not files: | 515 if not files: |
505 pass | 516 pass |
506 elif isinstance(files, basestring): | 517 elif isinstance(files, basestring): |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 if not cur_dir_repo_root: | 756 if not cur_dir_repo_root: |
746 return None | 757 return None |
747 | 758 |
748 while True: | 759 while True: |
749 parent = os.path.dirname(directory) | 760 parent = os.path.dirname(directory) |
750 if (SVN.CaptureInfo(parent, print_error=False).get( | 761 if (SVN.CaptureInfo(parent, print_error=False).get( |
751 "Repository Root") != cur_dir_repo_root): | 762 "Repository Root") != cur_dir_repo_root): |
752 break | 763 break |
753 directory = parent | 764 directory = parent |
754 return GetCasedPath(directory) | 765 return GetCasedPath(directory) |
OLD | NEW |