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

Side by Side Diff: gclient_scm.py

Issue 1498203002: Add detection for locked git repos. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 5 years 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) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 from __future__ import print_function 7 from __future__ import print_function
8 8
9 import errno 9 import errno
10 import logging 10 import logging
(...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 def _IsRebasing(self): 1069 def _IsRebasing(self):
1070 # Check for any of REBASE-i/REBASE-m/REBASE/AM. Unfortunately git doesn't 1070 # Check for any of REBASE-i/REBASE-m/REBASE/AM. Unfortunately git doesn't
1071 # have a plumbing command to determine whether a rebase is in progress, so 1071 # have a plumbing command to determine whether a rebase is in progress, so
1072 # for now emualate (more-or-less) git-rebase.sh / git-completion.bash 1072 # for now emualate (more-or-less) git-rebase.sh / git-completion.bash
1073 g = os.path.join(self.checkout_path, '.git') 1073 g = os.path.join(self.checkout_path, '.git')
1074 return ( 1074 return (
1075 os.path.isdir(os.path.join(g, "rebase-merge")) or 1075 os.path.isdir(os.path.join(g, "rebase-merge")) or
1076 os.path.isdir(os.path.join(g, "rebase-apply"))) 1076 os.path.isdir(os.path.join(g, "rebase-apply")))
1077 1077
1078 def _CheckClean(self, rev_str): 1078 def _CheckClean(self, rev_str):
1079 lockfile = os.path.join(self.checkout_path, ".git", "index.lock")
1080 if os.path.exists(lockfile):
1081 raise gclient_utils.Error(
1082 '\n____ %s%s\n'
1083 '\tYour repo is locked, possibly due to a concurrent git process.\n'
1084 '\tIf no git executable is running, then clean up %r and try again.\n'
1085 % (self.relpath, rev_str, lockfile))
1086
1079 # Make sure the tree is clean; see git-rebase.sh for reference 1087 # Make sure the tree is clean; see git-rebase.sh for reference
1080 try: 1088 try:
1081 scm.GIT.Capture(['update-index', '--ignore-submodules', '--refresh'], 1089 scm.GIT.Capture(['update-index', '--ignore-submodules', '--refresh'],
1082 cwd=self.checkout_path) 1090 cwd=self.checkout_path)
1083 except subprocess2.CalledProcessError: 1091 except subprocess2.CalledProcessError:
1084 raise gclient_utils.Error('\n____ %s%s\n' 1092 raise gclient_utils.Error('\n____ %s%s\n'
1085 '\tYou have unstaged changes.\n' 1093 '\tYou have unstaged changes.\n'
1086 '\tPlease commit, stash, or reset.\n' 1094 '\tPlease commit, stash, or reset.\n'
1087 % (self.relpath, rev_str)) 1095 % (self.relpath, rev_str))
1088 try: 1096 try:
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
1681 new_command.append('--force') 1689 new_command.append('--force')
1682 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1690 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1683 new_command.extend(('--accept', 'theirs-conflict')) 1691 new_command.extend(('--accept', 'theirs-conflict'))
1684 elif options.manually_grab_svn_rev: 1692 elif options.manually_grab_svn_rev:
1685 new_command.append('--force') 1693 new_command.append('--force')
1686 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1694 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1687 new_command.extend(('--accept', 'postpone')) 1695 new_command.extend(('--accept', 'postpone'))
1688 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1696 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1689 new_command.extend(('--accept', 'postpone')) 1697 new_command.extend(('--accept', 'postpone'))
1690 return new_command 1698 return new_command
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