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

Side by Side Diff: gclient_scm.py

Issue 3126020: Remove code duplication and improve style. (Closed)
Patch Set: Created 10 years, 4 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
« no previous file with comments | « gcl.py ('k') | gclient_utils.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 (c) 2010 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2010 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 posixpath 9 import posixpath
10 import re 10 import re
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 cwd = self.checkout_path 646 cwd = self.checkout_path
647 stdout = None 647 stdout = None
648 if redirect_stdout: 648 if redirect_stdout:
649 stdout = subprocess.PIPE 649 stdout = subprocess.PIPE
650 if cwd == None: 650 if cwd == None:
651 cwd = self.checkout_path 651 cwd = self.checkout_path
652 cmd = [scm.GIT.COMMAND] 652 cmd = [scm.GIT.COMMAND]
653 cmd.extend(args) 653 cmd.extend(args)
654 logging.debug(cmd) 654 logging.debug(cmd)
655 try: 655 try:
656 sp = subprocess.Popen(cmd, cwd=cwd, stdout=stdout) 656 sp = gclient_utils.Popen(cmd, cwd=cwd, stdout=stdout)
657 output = sp.communicate()[0] 657 output = sp.communicate()[0]
658 except OSError: 658 except OSError:
659 raise gclient_utils.Error("git command '%s' failed to run." % 659 raise gclient_utils.Error("git command '%s' failed to run." %
660 ' '.join(cmd) + "\nCheck that you have git installed.") 660 ' '.join(cmd) + "\nCheck that you have git installed.")
661 if sp.returncode: 661 if sp.returncode:
662 raise gclient_utils.Error('git command %s returned %d' % 662 raise gclient_utils.Error('git command %s returned %d' %
663 (args[0], sp.returncode)) 663 (args[0], sp.returncode))
664 if output is not None: 664 if output is not None:
665 return output.strip() 665 return output.strip()
666 666
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 961
962 This method returns a new list to be used as a command.""" 962 This method returns a new list to be used as a command."""
963 new_command = command[:] 963 new_command = command[:]
964 if revision: 964 if revision:
965 new_command.extend(['--revision', str(revision).strip()]) 965 new_command.extend(['--revision', str(revision).strip()])
966 # --force was added to 'svn update' in svn 1.5. 966 # --force was added to 'svn update' in svn 1.5.
967 if ((options.force or options.manually_grab_svn_rev) and 967 if ((options.force or options.manually_grab_svn_rev) and
968 scm.SVN.AssertVersion("1.5")[0]): 968 scm.SVN.AssertVersion("1.5")[0]):
969 new_command.append('--force') 969 new_command.append('--force')
970 return new_command 970 return new_command
OLDNEW
« no previous file with comments | « gcl.py ('k') | gclient_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698