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

Side by Side Diff: scm.py

Issue 503085: Fix a typo in scm.GIT.GetBranch() and add --dry_run to trychange.py to ease testing. (Closed)
Patch Set: Created 11 years 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 | « no previous file | trychange.py » ('j') | trychange.py » ('J')
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 os 7 import os
8 import re 8 import re
9 import shutil 9 import shutil
10 import subprocess 10 import subprocess
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 return branch.replace('refs/heads/', '') 81 return branch.replace('refs/heads/', '')
82 82
83 @staticmethod 83 @staticmethod
84 def GetBranchRef(cwd): 84 def GetBranchRef(cwd):
85 """Returns the full branch reference, e.g. 'refs/heads/master'.""" 85 """Returns the full branch reference, e.g. 'refs/heads/master'."""
86 return GIT.Capture(['symbolic-ref', 'HEAD'], cwd).strip() 86 return GIT.Capture(['symbolic-ref', 'HEAD'], cwd).strip()
87 87
88 @staticmethod 88 @staticmethod
89 def GetBranch(cwd): 89 def GetBranch(cwd):
90 """Returns the short branch name, e.g. 'master'.""" 90 """Returns the short branch name, e.g. 'master'."""
91 return GIT.ShortBranchName(GIT.BranchRef(cwd)) 91 return GIT.ShortBranchName(GIT.GetBranchRef(cwd))
92 92
93 @staticmethod 93 @staticmethod
94 def IsGitSvn(cwd): 94 def IsGitSvn(cwd):
95 """Returns true if this repo looks like it's using git-svn.""" 95 """Returns true if this repo looks like it's using git-svn."""
96 # If you have any "svn-remote.*" config keys, we think you're using svn. 96 # If you have any "svn-remote.*" config keys, we think you're using svn.
97 try: 97 try:
98 GIT.Capture(['config', '--get-regexp', r'^svn-remote\.'], cwd) 98 GIT.Capture(['config', '--get-regexp', r'^svn-remote\.'], cwd)
99 return True 99 return True
100 except gclient_utils.CheckCallError: 100 except gclient_utils.CheckCallError:
101 return False 101 return False
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 if not cur_dir_repo_root: 660 if not cur_dir_repo_root:
661 return None 661 return None
662 662
663 while True: 663 while True:
664 parent = os.path.dirname(directory) 664 parent = os.path.dirname(directory)
665 if (SVN.CaptureInfo(parent, print_error=False).get( 665 if (SVN.CaptureInfo(parent, print_error=False).get(
666 "Repository Root") != cur_dir_repo_root): 666 "Repository Root") != cur_dir_repo_root):
667 break 667 break
668 directory = parent 668 directory = parent
669 return directory 669 return directory
OLDNEW
« no previous file with comments | « no previous file | trychange.py » ('j') | trychange.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698