| OLD | NEW |
| 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 posixpath | 9 import posixpath |
| 10 import re | 10 import re |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 raise gclient_utils.Error('Command %s not implemented in %s wrapper' % ( | 107 raise gclient_utils.Error('Command %s not implemented in %s wrapper' % ( |
| 108 command, self.scm_name)) | 108 command, self.scm_name)) |
| 109 | 109 |
| 110 return getattr(self, command)(options, args, file_list) | 110 return getattr(self, command)(options, args, file_list) |
| 111 | 111 |
| 112 | 112 |
| 113 class GitWrapper(SCMWrapper, scm.GIT): | 113 class GitWrapper(SCMWrapper, scm.GIT): |
| 114 """Wrapper for Git""" | 114 """Wrapper for Git""" |
| 115 | 115 |
| 116 def cleanup(self, options, args, file_list): | 116 def cleanup(self, options, args, file_list): |
| 117 """Cleanup working copy.""" | 117 """'Cleanup' the repo. |
| 118 |
| 119 There's no real git equivalent for the svn cleanup command, do a no-op. |
| 120 """ |
| 118 __pychecker__ = 'unusednames=options,args,file_list' | 121 __pychecker__ = 'unusednames=options,args,file_list' |
| 119 self._Run(['prune'], redirect_stdout=False) | |
| 120 self._Run(['fsck'], redirect_stdout=False) | |
| 121 self._Run(['gc'], redirect_stdout=False) | |
| 122 | 122 |
| 123 def diff(self, options, args, file_list): | 123 def diff(self, options, args, file_list): |
| 124 __pychecker__ = 'unusednames=options,args,file_list' | 124 __pychecker__ = 'unusednames=options,args,file_list' |
| 125 merge_base = self._Run(['merge-base', 'HEAD', 'origin']) | 125 merge_base = self._Run(['merge-base', 'HEAD', 'origin']) |
| 126 self._Run(['diff', merge_base], redirect_stdout=False) | 126 self._Run(['diff', merge_base], redirect_stdout=False) |
| 127 | 127 |
| 128 def export(self, options, args, file_list): | 128 def export(self, options, args, file_list): |
| 129 """Export a clean directory tree into the given path. | 129 """Export a clean directory tree into the given path. |
| 130 | 130 |
| 131 Exports into the specified directory, creating the path if it does | 131 Exports into the specified directory, creating the path if it does |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 print("\n________ couldn't run \'%s\' in \'%s\':\nThe directory " | 547 print("\n________ couldn't run \'%s\' in \'%s\':\nThe directory " |
| 548 "does not exist." | 548 "does not exist." |
| 549 % (' '.join(command), path)) | 549 % (' '.join(command), path)) |
| 550 # There's no file list to retrieve. | 550 # There's no file list to retrieve. |
| 551 else: | 551 else: |
| 552 self.RunAndGetFileList(options, command, path, file_list) | 552 self.RunAndGetFileList(options, command, path, file_list) |
| 553 | 553 |
| 554 def FullUrlForRelativeUrl(self, url): | 554 def FullUrlForRelativeUrl(self, url): |
| 555 # Find the forth '/' and strip from there. A bit hackish. | 555 # Find the forth '/' and strip from there. A bit hackish. |
| 556 return '/'.join(self.url.split('/')[:4]) + url | 556 return '/'.join(self.url.split('/')[:4]) + url |
| OLD | NEW |