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

Side by Side Diff: gclient_scm.py

Issue 402084: gclient: Fix bug where urls with revisions are not parsed correctly. (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 | 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 # Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 # Copyright (c) 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 """Gclient-specific SCM-specific operations.""" 5 """Gclient-specific SCM-specific operations."""
6 6
7 import logging 7 import logging
8 import os 8 import os
9 import re 9 import re
10 import subprocess 10 import subprocess
11 11
12 import scm 12 import scm
13 import gclient_utils 13 import gclient_utils
14 14
15 15
16 ### SCM abstraction layer 16 ### SCM abstraction layer
17 17
18 # Factory Method for SCM wrapper creation 18 # Factory Method for SCM wrapper creation
19 19
20 def CreateSCM(url=None, root_dir=None, relpath=None, scm_name='svn'): 20 def CreateSCM(url=None, root_dir=None, relpath=None, scm_name='svn'):
21 # TODO(maruel): Deduce the SCM from the url. 21 # TODO(maruel): Deduce the SCM from the url.
22 scm_map = { 22 scm_map = {
23 'svn' : SVNWrapper, 23 'svn' : SVNWrapper,
24 'git' : GitWrapper, 24 'git' : GitWrapper,
25 } 25 }
26 26
27 if url and (url.startswith('git:') or 27 orig_url = url
28 url.startswith('ssh:') or 28
29 url.endswith('.git')): 29 if url:
30 scm_name = 'git' 30 url, _ = gclient_utils.SplitUrlRevision(url)
M-A Ruel 2009/11/19 18:36:52 smells go here. :)
31 if url.startswith('git:') or url.startswith('ssh:') or url.endswith('.git'):
32 scm_name = 'git'
31 33
32 if not scm_name in scm_map: 34 if not scm_name in scm_map:
33 raise gclient_utils.Error('Unsupported scm %s' % scm_name) 35 raise gclient_utils.Error('Unsupported scm %s' % scm_name)
34 return scm_map[scm_name](url, root_dir, relpath, scm_name) 36 return scm_map[scm_name](orig_url, root_dir, relpath, scm_name)
35 37
36 38
37 # SCMWrapper base class 39 # SCMWrapper base class
38 40
39 class SCMWrapper(object): 41 class SCMWrapper(object):
40 """Add necessary glue between all the supported SCM. 42 """Add necessary glue between all the supported SCM.
41 43
42 This is the abstraction layer to bind to different SCM. Since currently only 44 This is the abstraction layer to bind to different SCM. Since currently only
43 subversion is supported, a lot of subersionism remains. This can be sorted out 45 subversion is supported, a lot of subersionism remains. This can be sorted out
44 once another SCM is supported.""" 46 once another SCM is supported."""
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 self.ReplaceAndPrint(line) 455 self.ReplaceAndPrint(line)
454 else: 456 else:
455 if (line.startswith(self.original_prefix) or 457 if (line.startswith(self.original_prefix) or
456 line.startswith(self.working_prefix)): 458 line.startswith(self.working_prefix)):
457 self.ReplaceAndPrint(line) 459 self.ReplaceAndPrint(line)
458 else: 460 else:
459 print line 461 print line
460 462
461 filterer = DiffFilterer(self.relpath) 463 filterer = DiffFilterer(self.relpath)
462 self.RunAndFilterOutput(command, path, False, False, filterer.Filter) 464 self.RunAndFilterOutput(command, path, False, False, filterer.Filter)
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