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

Side by Side Diff: git_tools.py

Issue 14018027: Fetch all refs, not just refs/heads/master. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/deps2git/
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 6
7 import os 7 import os
8 import re 8 import re
9 import subprocess 9 import subprocess
10 import threading 10 import threading
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 cmd = 'clone%s %s %s' % (' --mirror' if is_mirror else '', git_url, git_repo) 75 cmd = 'clone%s %s %s' % (' --mirror' if is_mirror else '', git_url, git_repo)
76 if not is_mirror and not os.path.exists(git_repo): 76 if not is_mirror and not os.path.exists(git_repo):
77 os.makedirs(git_repo) 77 os.makedirs(git_repo)
78 return Git(git_repo, cmd, is_mirror) 78 return Git(git_repo, cmd, is_mirror)
79 79
80 80
81 def Fetch(git_repo, git_url, is_mirror): 81 def Fetch(git_repo, git_url, is_mirror):
82 """Fetch the latest objects for a given git repository.""" 82 """Fetch the latest objects for a given git repository."""
83 # Always update the upstream url 83 # Always update the upstream url
84 Git(git_repo, 'config remote.origin.url %s' % git_url) 84 Git(git_repo, 'config remote.origin.url %s' % git_url)
85 Git(git_repo, 'fetch origin +refs/heads/master', is_mirror) 85 Git(git_repo, 'fetch origin', is_mirror)
86 86
87 87
88 def Ping(git_repo): 88 def Ping(git_repo):
89 """Confirm that a remote repository URL is valid.""" 89 """Confirm that a remote repository URL is valid."""
90 status, _ = GetStatusOutput('git ls-remote ' + git_repo) 90 status, _ = GetStatusOutput('git ls-remote ' + git_repo)
91 return status == 0 91 return status == 0
92 92
93 93
94 def CreateLessThanOrEqualRegex(number): 94 def CreateLessThanOrEqualRegex(number):
95 """ Return a regular expression to test whether an integer less than or equal 95 """ Return a regular expression to test whether an integer less than or equal
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 (_, output) = Git(git_repo, ('log -E --grep=".*git-svn-id:.*@%s " ' 162 (_, output) = Git(git_repo, ('log -E --grep=".*git-svn-id:.*@%s " '
163 '-1 --format=%%H %s') % (regex, refspec), 163 '-1 --format=%%H %s') % (regex, refspec),
164 is_mirror) 164 is_mirror)
165 if output != '': 165 if output != '':
166 output = output.splitlines()[0] 166 output = output.splitlines()[0]
167 167
168 print '%s: %s <-> %s' % (git_repo, output, svn_rev) 168 print '%s: %s <-> %s' % (git_repo, output, svn_rev)
169 if re.match('^[0-9a-fA-F]{40}$', output): 169 if re.match('^[0-9a-fA-F]{40}$', output):
170 return output 170 return output
171 raise Exception('Cannot find revision %s in %s' % (svn_rev, git_repo)) 171 raise Exception('Cannot find revision %s in %s' % (svn_rev, git_repo))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698