| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |