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

Side by Side Diff: scm.py

Issue 1307001: revinfo: Properly use git HEAD or svn BASE revisions (Closed)
Patch Set: fixed issues with patch set 1 Created 10 years, 9 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 | « gclient_scm.py ('k') | tests/scm_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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)
OLDNEW
« no previous file with comments | « gclient_scm.py ('k') | tests/scm_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698