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

Side by Side Diff: gclient_utils.py

Issue 401022: Fix parsing bug in SplitUrlRevision. (Closed)
Patch Set: Created 11 years, 1 month 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 | tests/gclient_utils_test.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 2009 Google Inc. All Rights Reserved. 1 # Copyright 2009 Google Inc. All Rights Reserved.
2 # 2 #
3 # Licensed under the Apache License, Version 2.0 (the "License"); 3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License. 4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at 5 # You may obtain a copy of the License at
6 # 6 #
7 # http://www.apache.org/licenses/LICENSE-2.0 7 # http://www.apache.org/licenses/LICENSE-2.0
8 # 8 #
9 # Unless required by applicable law or agreed to in writing, software 9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS, 10 # distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 11 matching lines...) Expand all
22 import sys 22 import sys
23 import time 23 import time
24 import xml.dom.minidom 24 import xml.dom.minidom
25 import xml.parsers.expat 25 import xml.parsers.expat
26 26
27 27
28 def SplitUrlRevision(url): 28 def SplitUrlRevision(url):
29 """Splits url and returns a two-tuple: url, rev""" 29 """Splits url and returns a two-tuple: url, rev"""
30 if url.startswith('ssh:'): 30 if url.startswith('ssh:'):
31 # Make sure ssh://test@example.com/test.git@stable works 31 # Make sure ssh://test@example.com/test.git@stable works
32 regex = r"(ssh://(?:[\w]+@)?[-\w:\.]+/[-\w\.]+)(?:@([\w/]+))?" 32 regex = r"(ssh://(?:[\w]+@)?[-\w:\.]+/[-\w\./]+)(?:@([\w/]+))?"
33 components = re.search(regex, url).groups() 33 components = re.search(regex, url).groups()
34 else: 34 else:
35 components = url.split("@") 35 components = url.split("@")
36 if len(components) == 1: 36 if len(components) == 1:
37 components += [None] 37 components += [None]
38 return tuple(components) 38 return tuple(components)
39 39
40 40
41 def ParseXML(output): 41 def ParseXML(output):
42 try: 42 try:
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 raise Error(msg) 258 raise Error(msg)
259 259
260 260
261 def IsUsingGit(root, paths): 261 def IsUsingGit(root, paths):
262 """Returns True if we're using git to manage any of our checkouts. 262 """Returns True if we're using git to manage any of our checkouts.
263 |entries| is a list of paths to check.""" 263 |entries| is a list of paths to check."""
264 for path in paths: 264 for path in paths:
265 if os.path.exists(os.path.join(root, path, '.git')): 265 if os.path.exists(os.path.join(root, path, '.git')):
266 return True 266 return True
267 return False 267 return False
OLDNEW
« no previous file with comments | « no previous file | tests/gclient_utils_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698