OLD | NEW |
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 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 elif re.match(r'quit|q', action, re.I): | 605 elif re.match(r'quit|q', action, re.I): |
606 raise gclient_utils.Error("Can't fast-forward, please merge or " | 606 raise gclient_utils.Error("Can't fast-forward, please merge or " |
607 "rebase manually.\n" | 607 "rebase manually.\n" |
608 "cd %s && git " % self.checkout_path | 608 "cd %s && git " % self.checkout_path |
609 + "rebase %s" % upstream_branch) | 609 + "rebase %s" % upstream_branch) |
610 elif re.match(r'skip|s', action, re.I): | 610 elif re.match(r'skip|s', action, re.I): |
611 self.Print('Skipping %s' % self.relpath) | 611 self.Print('Skipping %s' % self.relpath) |
612 return | 612 return |
613 else: | 613 else: |
614 self.Print('Input not recognized') | 614 self.Print('Input not recognized') |
615 elif re.match("error: Your local changes to (')?.*(')? would be " | 615 elif re.match("error: Your local changes to '.*' would be " |
616 "overwritten by merge(. Aborting)?[:.]\n(.*\n)?Please, " | 616 "overwritten by merge. Aborting.\nPlease, commit your " |
617 "commit your changes or stash them before you can " | 617 "changes or stash them before you can merge.\n", |
618 "merge.\n", | |
619 e.stderr): | 618 e.stderr): |
620 if not printed_path: | 619 if not printed_path: |
621 self.Print('_____ %s%s' % (self.relpath, rev_str), timestamp=False) | 620 self.Print('_____ %s%s' % (self.relpath, rev_str), timestamp=False) |
622 printed_path = True | 621 printed_path = True |
623 raise gclient_utils.Error(e.stderr) | 622 raise gclient_utils.Error(e.stderr) |
624 else: | 623 else: |
625 # Some other problem happened with the merge | 624 # Some other problem happened with the merge |
626 logging.error("Error during fast-forward merge in %s!" % self.relpath) | 625 logging.error("Error during fast-forward merge in %s!" % self.relpath) |
627 self.Print(e.stderr) | 626 self.Print(e.stderr) |
628 raise | 627 raise |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 try: | 1014 try: |
1016 scm.GIT.Capture(['update-index', '--ignore-submodules', '--refresh'], | 1015 scm.GIT.Capture(['update-index', '--ignore-submodules', '--refresh'], |
1017 cwd=self.checkout_path) | 1016 cwd=self.checkout_path) |
1018 except subprocess2.CalledProcessError: | 1017 except subprocess2.CalledProcessError: |
1019 raise gclient_utils.Error('\n____ %s%s\n' | 1018 raise gclient_utils.Error('\n____ %s%s\n' |
1020 '\tYou have unstaged changes.\n' | 1019 '\tYou have unstaged changes.\n' |
1021 '\tPlease commit, stash, or reset.\n' | 1020 '\tPlease commit, stash, or reset.\n' |
1022 % (self.relpath, rev_str)) | 1021 % (self.relpath, rev_str)) |
1023 try: | 1022 try: |
1024 scm.GIT.Capture(['diff-index', '--cached', '--name-status', '-r', | 1023 scm.GIT.Capture(['diff-index', '--cached', '--name-status', '-r', |
1025 '--ignore-submodules', '--exit-code', 'HEAD', '--'], | 1024 '--ignore-submodules', 'HEAD', '--'], |
1026 cwd=self.checkout_path) | 1025 cwd=self.checkout_path) |
1027 except subprocess2.CalledProcessError: | 1026 except subprocess2.CalledProcessError: |
1028 raise gclient_utils.Error('\n____ %s%s\n' | 1027 raise gclient_utils.Error('\n____ %s%s\n' |
1029 '\tYour index contains uncommitted changes\n' | 1028 '\tYour index contains uncommitted changes\n' |
1030 '\tPlease commit, stash, or reset.\n' | 1029 '\tPlease commit, stash, or reset.\n' |
1031 % (self.relpath, rev_str)) | 1030 % (self.relpath, rev_str)) |
1032 | 1031 |
1033 def _CheckDetachedHead(self, rev_str, _options): | 1032 def _CheckDetachedHead(self, rev_str, _options): |
1034 # HEAD is detached. Make sure it is safe to move away from (i.e., it is | 1033 # HEAD is detached. Make sure it is safe to move away from (i.e., it is |
1035 # reference by a commit). If not, error out -- most likely a rebase is | 1034 # reference by a commit). If not, error out -- most likely a rebase is |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1600 new_command.append('--force') | 1599 new_command.append('--force') |
1601 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1600 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1602 new_command.extend(('--accept', 'theirs-conflict')) | 1601 new_command.extend(('--accept', 'theirs-conflict')) |
1603 elif options.manually_grab_svn_rev: | 1602 elif options.manually_grab_svn_rev: |
1604 new_command.append('--force') | 1603 new_command.append('--force') |
1605 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1604 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1606 new_command.extend(('--accept', 'postpone')) | 1605 new_command.extend(('--accept', 'postpone')) |
1607 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1606 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1608 new_command.extend(('--accept', 'postpone')) | 1607 new_command.extend(('--accept', 'postpone')) |
1609 return new_command | 1608 return new_command |
OLD | NEW |