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 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 elif re.match(r'quit|q', action, re.I): | 582 elif re.match(r'quit|q', action, re.I): |
583 raise gclient_utils.Error("Can't fast-forward, please merge or " | 583 raise gclient_utils.Error("Can't fast-forward, please merge or " |
584 "rebase manually.\n" | 584 "rebase manually.\n" |
585 "cd %s && git " % self.checkout_path | 585 "cd %s && git " % self.checkout_path |
586 + "rebase %s" % upstream_branch) | 586 + "rebase %s" % upstream_branch) |
587 elif re.match(r'skip|s', action, re.I): | 587 elif re.match(r'skip|s', action, re.I): |
588 self.Print('Skipping %s' % self.relpath) | 588 self.Print('Skipping %s' % self.relpath) |
589 return | 589 return |
590 else: | 590 else: |
591 self.Print('Input not recognized') | 591 self.Print('Input not recognized') |
592 elif re.match("error: Your local changes to '.*' would be " | 592 elif re.match("error: Your local changes to (')?.*(')? would be " |
593 "overwritten by merge. Aborting.\nPlease, commit your " | 593 "overwritten by merge(. Aborting)?[:.]\n(.*\n)?Please, " |
594 "changes or stash them before you can merge.\n", | 594 "commit your changes or stash them before you can " |
| 595 "merge.\n", |
595 e.stderr): | 596 e.stderr): |
596 if not printed_path: | 597 if not printed_path: |
597 self.Print('_____ %s%s' % (self.relpath, rev_str), timestamp=False) | 598 self.Print('_____ %s%s' % (self.relpath, rev_str), timestamp=False) |
598 printed_path = True | 599 printed_path = True |
599 raise gclient_utils.Error(e.stderr) | 600 raise gclient_utils.Error(e.stderr) |
600 else: | 601 else: |
601 # Some other problem happened with the merge | 602 # Some other problem happened with the merge |
602 logging.error("Error during fast-forward merge in %s!" % self.relpath) | 603 logging.error("Error during fast-forward merge in %s!" % self.relpath) |
603 self.Print(e.stderr) | 604 self.Print(e.stderr) |
604 raise | 605 raise |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 try: | 991 try: |
991 scm.GIT.Capture(['update-index', '--ignore-submodules', '--refresh'], | 992 scm.GIT.Capture(['update-index', '--ignore-submodules', '--refresh'], |
992 cwd=self.checkout_path) | 993 cwd=self.checkout_path) |
993 except subprocess2.CalledProcessError: | 994 except subprocess2.CalledProcessError: |
994 raise gclient_utils.Error('\n____ %s%s\n' | 995 raise gclient_utils.Error('\n____ %s%s\n' |
995 '\tYou have unstaged changes.\n' | 996 '\tYou have unstaged changes.\n' |
996 '\tPlease commit, stash, or reset.\n' | 997 '\tPlease commit, stash, or reset.\n' |
997 % (self.relpath, rev_str)) | 998 % (self.relpath, rev_str)) |
998 try: | 999 try: |
999 scm.GIT.Capture(['diff-index', '--cached', '--name-status', '-r', | 1000 scm.GIT.Capture(['diff-index', '--cached', '--name-status', '-r', |
1000 '--ignore-submodules', 'HEAD', '--'], | 1001 '--ignore-submodules', '--exit-code', 'HEAD', '--'], |
1001 cwd=self.checkout_path) | 1002 cwd=self.checkout_path) |
1002 except subprocess2.CalledProcessError: | 1003 except subprocess2.CalledProcessError: |
1003 raise gclient_utils.Error('\n____ %s%s\n' | 1004 raise gclient_utils.Error('\n____ %s%s\n' |
1004 '\tYour index contains uncommitted changes\n' | 1005 '\tYour index contains uncommitted changes\n' |
1005 '\tPlease commit, stash, or reset.\n' | 1006 '\tPlease commit, stash, or reset.\n' |
1006 % (self.relpath, rev_str)) | 1007 % (self.relpath, rev_str)) |
1007 | 1008 |
1008 def _CheckDetachedHead(self, rev_str, _options): | 1009 def _CheckDetachedHead(self, rev_str, _options): |
1009 # HEAD is detached. Make sure it is safe to move away from (i.e., it is | 1010 # HEAD is detached. Make sure it is safe to move away from (i.e., it is |
1010 # reference by a commit). If not, error out -- most likely a rebase is | 1011 # 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... |
1575 new_command.append('--force') | 1576 new_command.append('--force') |
1576 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1577 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1577 new_command.extend(('--accept', 'theirs-conflict')) | 1578 new_command.extend(('--accept', 'theirs-conflict')) |
1578 elif options.manually_grab_svn_rev: | 1579 elif options.manually_grab_svn_rev: |
1579 new_command.append('--force') | 1580 new_command.append('--force') |
1580 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1581 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1581 new_command.extend(('--accept', 'postpone')) | 1582 new_command.extend(('--accept', 'postpone')) |
1582 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1583 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1583 new_command.extend(('--accept', 'postpone')) | 1584 new_command.extend(('--accept', 'postpone')) |
1584 return new_command | 1585 return new_command |
OLD | NEW |