| 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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 Error: if can't get URL for relative path. | 354 Error: if can't get URL for relative path. |
| 355 """ | 355 """ |
| 356 if args: | 356 if args: |
| 357 raise gclient_utils.Error("Unsupported argument(s): %s" % ",".join(args)) | 357 raise gclient_utils.Error("Unsupported argument(s): %s" % ",".join(args)) |
| 358 | 358 |
| 359 self._CheckMinVersion("1.6.6") | 359 self._CheckMinVersion("1.6.6") |
| 360 | 360 |
| 361 # If a dependency is not pinned, track the default remote branch. | 361 # If a dependency is not pinned, track the default remote branch. |
| 362 default_rev = 'refs/remotes/%s/master' % self.remote | 362 default_rev = 'refs/remotes/%s/master' % self.remote |
| 363 url, deps_revision = gclient_utils.SplitUrlRevision(self.url) | 363 url, deps_revision = gclient_utils.SplitUrlRevision(self.url) |
| 364 rev_str = "" | |
| 365 revision = deps_revision | 364 revision = deps_revision |
| 366 managed = True | 365 managed = True |
| 367 if options.revision: | 366 if options.revision: |
| 368 # Override the revision number. | 367 # Override the revision number. |
| 369 revision = str(options.revision) | 368 revision = str(options.revision) |
| 370 if revision == 'unmanaged': | 369 if revision == 'unmanaged': |
| 371 # Check again for a revision in case an initial ref was specified | 370 # Check again for a revision in case an initial ref was specified |
| 372 # in the url, for example bla.git@refs/heads/custombranch | 371 # in the url, for example bla.git@refs/heads/custombranch |
| 373 revision = deps_revision | 372 revision = deps_revision |
| 374 managed = False | 373 managed = False |
| 375 if not revision: | 374 if not revision: |
| 376 revision = default_rev | 375 revision = default_rev |
| 377 | 376 |
| 378 if managed: | 377 if managed: |
| 379 self._DisableHooks() | 378 self._DisableHooks() |
| 380 | 379 |
| 381 rev_str = ' at %s' % revision | |
| 382 files = [] if file_list is not None else None | 380 files = [] if file_list is not None else None |
| 383 | 381 |
| 384 printed_path = False | 382 printed_path = False |
| 385 verbose = [] | 383 verbose = [] |
| 386 if options.verbose: | 384 if options.verbose: |
| 387 self.Print('_____ %s%s' % (self.relpath, rev_str), timestamp=False) | 385 self.Print('_____ %s at %s' % (self.relpath, revision), timestamp=False) |
| 388 verbose = ['--verbose'] | 386 verbose = ['--verbose'] |
| 389 printed_path = True | 387 printed_path = True |
| 390 | 388 |
| 391 remote_ref = scm.GIT.RefToRemoteRef(revision, self.remote) | 389 remote_ref = scm.GIT.RefToRemoteRef(revision, self.remote) |
| 392 if remote_ref: | 390 if remote_ref: |
| 393 # Rewrite remote refs to their local equivalents. | 391 # Rewrite remote refs to their local equivalents. |
| 394 revision = ''.join(remote_ref) | 392 revision = ''.join(remote_ref) |
| 395 rev_type = "branch" | 393 rev_type = "branch" |
| 396 elif revision.startswith('refs/'): | 394 elif revision.startswith('refs/'): |
| 397 # Local branch? We probably don't want to support, since DEPS should | 395 # Local branch? We probably don't want to support, since DEPS should |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 # This allows devs to use experimental repos which have a different url | 456 # This allows devs to use experimental repos which have a different url |
| 459 # but whose branch(s) are the same as official repos. | 457 # but whose branch(s) are the same as official repos. |
| 460 if (current_url.rstrip('/') != url.rstrip('/') and | 458 if (current_url.rstrip('/') != url.rstrip('/') and |
| 461 url != 'git://foo' and | 459 url != 'git://foo' and |
| 462 subprocess2.capture( | 460 subprocess2.capture( |
| 463 ['git', 'config', 'remote.%s.gclient-auto-fix-url' % self.remote], | 461 ['git', 'config', 'remote.%s.gclient-auto-fix-url' % self.remote], |
| 464 cwd=self.checkout_path).strip() != 'False'): | 462 cwd=self.checkout_path).strip() != 'False'): |
| 465 self.Print('_____ switching %s to a new upstream' % self.relpath) | 463 self.Print('_____ switching %s to a new upstream' % self.relpath) |
| 466 if not (options.force or options.reset): | 464 if not (options.force or options.reset): |
| 467 # Make sure it's clean | 465 # Make sure it's clean |
| 468 self._CheckClean(rev_str) | 466 self._CheckClean(revision) |
| 469 # Switch over to the new upstream | 467 # Switch over to the new upstream |
| 470 self._Run(['remote', 'set-url', self.remote, url], options) | 468 self._Run(['remote', 'set-url', self.remote, url], options) |
| 471 if mirror: | 469 if mirror: |
| 472 with open(os.path.join( | 470 with open(os.path.join( |
| 473 self.checkout_path, '.git', 'objects', 'info', 'alternates'), | 471 self.checkout_path, '.git', 'objects', 'info', 'alternates'), |
| 474 'w') as fh: | 472 'w') as fh: |
| 475 fh.write(os.path.join(url, 'objects')) | 473 fh.write(os.path.join(url, 'objects')) |
| 476 self._EnsureValidHeadObjectOrCheckout(revision, options, url) | 474 self._EnsureValidHeadObjectOrCheckout(revision, options, url) |
| 477 self._FetchAndReset(revision, file_list, options) | 475 self._FetchAndReset(revision, file_list, options) |
| 478 | 476 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 | 533 |
| 536 # This is a big hammer, debatable if it should even be here... | 534 # This is a big hammer, debatable if it should even be here... |
| 537 if options.force or options.reset: | 535 if options.force or options.reset: |
| 538 target = 'HEAD' | 536 target = 'HEAD' |
| 539 if options.upstream and upstream_branch: | 537 if options.upstream and upstream_branch: |
| 540 target = upstream_branch | 538 target = upstream_branch |
| 541 self._Run(['reset', '--hard', target], options) | 539 self._Run(['reset', '--hard', target], options) |
| 542 | 540 |
| 543 if current_type == 'detached': | 541 if current_type == 'detached': |
| 544 # case 0 | 542 # case 0 |
| 545 self._CheckClean(rev_str) | 543 self._CheckClean(revision) |
| 546 self._CheckDetachedHead(rev_str, options) | 544 self._CheckDetachedHead(revision, options) |
| 547 if self._Capture(['rev-list', '-n', '1', 'HEAD']) == revision: | 545 if self._Capture(['rev-list', '-n', '1', 'HEAD']) == revision: |
| 548 self.Print('Up-to-date; skipping checkout.') | 546 self.Print('Up-to-date; skipping checkout.') |
| 549 else: | 547 else: |
| 550 # 'git checkout' may need to overwrite existing untracked files. Allow | 548 # 'git checkout' may need to overwrite existing untracked files. Allow |
| 551 # it only when nuclear options are enabled. | 549 # it only when nuclear options are enabled. |
| 552 self._Checkout( | 550 self._Checkout( |
| 553 options, | 551 options, |
| 554 revision, | 552 revision, |
| 555 force=(options.force and options.delete_unversioned_trees), | 553 force=(options.force and options.delete_unversioned_trees), |
| 556 quiet=True, | 554 quiet=True, |
| 557 ) | 555 ) |
| 558 if not printed_path: | 556 if not printed_path: |
| 559 self.Print('_____ %s%s' % (self.relpath, rev_str), timestamp=False) | 557 self.Print('_____ %s at %s' % (self.relpath, revision), timestamp=False) |
| 560 elif current_type == 'hash': | 558 elif current_type == 'hash': |
| 561 # case 1 | 559 # case 1 |
| 562 # Can't find a merge-base since we don't know our upstream. That makes | 560 # Can't find a merge-base since we don't know our upstream. That makes |
| 563 # this command VERY likely to produce a rebase failure. For now we | 561 # this command VERY likely to produce a rebase failure. For now we |
| 564 # assume origin is our upstream since that's what the old behavior was. | 562 # assume origin is our upstream since that's what the old behavior was. |
| 565 upstream_branch = self.remote | 563 upstream_branch = self.remote |
| 566 if options.revision or deps_revision: | 564 if options.revision or deps_revision: |
| 567 upstream_branch = revision | 565 upstream_branch = revision |
| 568 self._AttemptRebase(upstream_branch, files, options, | 566 self._AttemptRebase(upstream_branch, files, options, |
| 569 printed_path=printed_path, merge=options.merge) | 567 printed_path=printed_path, merge=options.merge) |
| 570 printed_path = True | 568 printed_path = True |
| 571 elif rev_type == 'hash': | 569 elif rev_type == 'hash': |
| 572 # case 2 | 570 # case 2 |
| 573 self._AttemptRebase(upstream_branch, files, options, | 571 self._AttemptRebase(upstream_branch, files, options, |
| 574 newbase=revision, printed_path=printed_path, | 572 newbase=revision, printed_path=printed_path, |
| 575 merge=options.merge) | 573 merge=options.merge) |
| 576 printed_path = True | 574 printed_path = True |
| 577 elif remote_ref and ''.join(remote_ref) != upstream_branch: | 575 elif remote_ref and ''.join(remote_ref) != upstream_branch: |
| 578 # case 4 | 576 # case 4 |
| 579 new_base = ''.join(remote_ref) | 577 new_base = ''.join(remote_ref) |
| 580 if not printed_path: | 578 if not printed_path: |
| 581 self.Print('_____ %s%s' % (self.relpath, rev_str), timestamp=False) | 579 self.Print('_____ %s at %s' % (self.relpath, revision), timestamp=False) |
| 582 switch_error = ("Could not switch upstream branch from %s to %s\n" | 580 switch_error = ("Could not switch upstream branch from %s to %s\n" |
| 583 % (upstream_branch, new_base) + | 581 % (upstream_branch, new_base) + |
| 584 "Please use --force or merge or rebase manually:\n" + | 582 "Please use --force or merge or rebase manually:\n" + |
| 585 "cd %s; git rebase %s\n" % (self.checkout_path, new_base) + | 583 "cd %s; git rebase %s\n" % (self.checkout_path, new_base) + |
| 586 "OR git checkout -b <some new branch> %s" % new_base) | 584 "OR git checkout -b <some new branch> %s" % new_base) |
| 587 force_switch = False | 585 force_switch = False |
| 588 if options.force: | 586 if options.force: |
| 589 try: | 587 try: |
| 590 self._CheckClean(rev_str) | 588 self._CheckClean(revision) |
| 591 # case 4a | 589 # case 4a |
| 592 force_switch = True | 590 force_switch = True |
| 593 except gclient_utils.Error as e: | 591 except gclient_utils.Error as e: |
| 594 if options.reset: | 592 if options.reset: |
| 595 # case 4b | 593 # case 4b |
| 596 force_switch = True | 594 force_switch = True |
| 597 else: | 595 else: |
| 598 switch_error = '%s\n%s' % (e.message, switch_error) | 596 switch_error = '%s\n%s' % (e.message, switch_error) |
| 599 if force_switch: | 597 if force_switch: |
| 600 self.Print("Switching upstream branch from %s to %s" % | 598 self.Print("Switching upstream branch from %s to %s" % |
| (...skipping 15 matching lines...) Expand all Loading... |
| 616 if options.merge: | 614 if options.merge: |
| 617 merge_args.append('--ff') | 615 merge_args.append('--ff') |
| 618 else: | 616 else: |
| 619 merge_args.append('--ff-only') | 617 merge_args.append('--ff-only') |
| 620 merge_args.append(upstream_branch) | 618 merge_args.append(upstream_branch) |
| 621 merge_output = self._Capture(merge_args) | 619 merge_output = self._Capture(merge_args) |
| 622 except subprocess2.CalledProcessError as e: | 620 except subprocess2.CalledProcessError as e: |
| 623 if re.match('fatal: Not possible to fast-forward, aborting.', e.stderr): | 621 if re.match('fatal: Not possible to fast-forward, aborting.', e.stderr): |
| 624 files = [] | 622 files = [] |
| 625 if not printed_path: | 623 if not printed_path: |
| 626 self.Print('_____ %s%s' % (self.relpath, rev_str), timestamp=False) | 624 self.Print('_____ %s at %s' % (self.relpath, revision), |
| 625 timestamp=False) |
| 627 printed_path = True | 626 printed_path = True |
| 628 while True: | 627 while True: |
| 629 if not options.auto_rebase: | 628 if not options.auto_rebase: |
| 630 try: | 629 try: |
| 631 action = self._AskForData( | 630 action = self._AskForData( |
| 632 'Cannot %s, attempt to rebase? ' | 631 'Cannot %s, attempt to rebase? ' |
| 633 '(y)es / (q)uit / (s)kip : ' % | 632 '(y)es / (q)uit / (s)kip : ' % |
| 634 ('merge' if options.merge else 'fast-forward merge'), | 633 ('merge' if options.merge else 'fast-forward merge'), |
| 635 options) | 634 options) |
| 636 except ValueError: | 635 except ValueError: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 648 elif re.match(r'skip|s', action, re.I): | 647 elif re.match(r'skip|s', action, re.I): |
| 649 self.Print('Skipping %s' % self.relpath) | 648 self.Print('Skipping %s' % self.relpath) |
| 650 return | 649 return |
| 651 else: | 650 else: |
| 652 self.Print('Input not recognized') | 651 self.Print('Input not recognized') |
| 653 elif re.match("error: Your local changes to '.*' would be " | 652 elif re.match("error: Your local changes to '.*' would be " |
| 654 "overwritten by merge. Aborting.\nPlease, commit your " | 653 "overwritten by merge. Aborting.\nPlease, commit your " |
| 655 "changes or stash them before you can merge.\n", | 654 "changes or stash them before you can merge.\n", |
| 656 e.stderr): | 655 e.stderr): |
| 657 if not printed_path: | 656 if not printed_path: |
| 658 self.Print('_____ %s%s' % (self.relpath, rev_str), timestamp=False) | 657 self.Print('_____ %s at %s' % (self.relpath, revision), |
| 658 timestamp=False) |
| 659 printed_path = True | 659 printed_path = True |
| 660 raise gclient_utils.Error(e.stderr) | 660 raise gclient_utils.Error(e.stderr) |
| 661 else: | 661 else: |
| 662 # Some other problem happened with the merge | 662 # Some other problem happened with the merge |
| 663 logging.error("Error during fast-forward merge in %s!" % self.relpath) | 663 logging.error("Error during fast-forward merge in %s!" % self.relpath) |
| 664 self.Print(e.stderr) | 664 self.Print(e.stderr) |
| 665 raise | 665 raise |
| 666 else: | 666 else: |
| 667 # Fast-forward merge was successful | 667 # Fast-forward merge was successful |
| 668 if not re.match('Already up-to-date.', merge_output) or verbose: | 668 if not re.match('Already up-to-date.', merge_output) or verbose: |
| 669 if not printed_path: | 669 if not printed_path: |
| 670 self.Print('_____ %s%s' % (self.relpath, rev_str), timestamp=False) | 670 self.Print('_____ %s at %s' % (self.relpath, revision), |
| 671 timestamp=False) |
| 671 printed_path = True | 672 printed_path = True |
| 672 self.Print(merge_output.strip()) | 673 self.Print(merge_output.strip()) |
| 673 if not verbose: | 674 if not verbose: |
| 674 # Make the output a little prettier. It's nice to have some | 675 # Make the output a little prettier. It's nice to have some |
| 675 # whitespace between projects when syncing. | 676 # whitespace between projects when syncing. |
| 676 self.Print('') | 677 self.Print('') |
| 677 | 678 |
| 678 if file_list is not None: | 679 if file_list is not None: |
| 679 file_list.extend([os.path.join(self.checkout_path, f) for f in files]) | 680 file_list.extend([os.path.join(self.checkout_path, f) for f in files]) |
| 680 | 681 |
| 681 # If the rebase generated a conflict, abort and ask user to fix | 682 # If the rebase generated a conflict, abort and ask user to fix |
| 682 if self._IsRebasing(): | 683 if self._IsRebasing(): |
| 683 raise gclient_utils.Error('\n____ %s%s\n' | 684 raise gclient_utils.Error('\n____ %s at %s\n' |
| 684 '\nConflict while rebasing this branch.\n' | 685 '\nConflict while rebasing this branch.\n' |
| 685 'Fix the conflict and run gclient again.\n' | 686 'Fix the conflict and run gclient again.\n' |
| 686 'See man git-rebase for details.\n' | 687 'See man git-rebase for details.\n' |
| 687 % (self.relpath, rev_str)) | 688 % (self.relpath, revision)) |
| 688 | 689 |
| 689 if verbose: | 690 if verbose: |
| 690 self.Print('Checked out revision %s' % self.revinfo(options, (), None), | 691 self.Print('Checked out revision %s' % self.revinfo(options, (), None), |
| 691 timestamp=False) | 692 timestamp=False) |
| 692 | 693 |
| 693 # If --reset and --delete_unversioned_trees are specified, remove any | 694 # If --reset and --delete_unversioned_trees are specified, remove any |
| 694 # untracked directories. | 695 # untracked directories. |
| 695 if options.reset and options.delete_unversioned_trees: | 696 if options.reset and options.delete_unversioned_trees: |
| 696 # GIT.CaptureStatus() uses 'dit diff' to compare to a specific SHA1 (the | 697 # GIT.CaptureStatus() uses 'dit diff' to compare to a specific SHA1 (the |
| 697 # merge-base by default), so doesn't include untracked files. So we use | 698 # merge-base by default), so doesn't include untracked files. So we use |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1041 | 1042 |
| 1042 def _IsRebasing(self): | 1043 def _IsRebasing(self): |
| 1043 # Check for any of REBASE-i/REBASE-m/REBASE/AM. Unfortunately git doesn't | 1044 # Check for any of REBASE-i/REBASE-m/REBASE/AM. Unfortunately git doesn't |
| 1044 # have a plumbing command to determine whether a rebase is in progress, so | 1045 # have a plumbing command to determine whether a rebase is in progress, so |
| 1045 # for now emualate (more-or-less) git-rebase.sh / git-completion.bash | 1046 # for now emualate (more-or-less) git-rebase.sh / git-completion.bash |
| 1046 g = os.path.join(self.checkout_path, '.git') | 1047 g = os.path.join(self.checkout_path, '.git') |
| 1047 return ( | 1048 return ( |
| 1048 os.path.isdir(os.path.join(g, "rebase-merge")) or | 1049 os.path.isdir(os.path.join(g, "rebase-merge")) or |
| 1049 os.path.isdir(os.path.join(g, "rebase-apply"))) | 1050 os.path.isdir(os.path.join(g, "rebase-apply"))) |
| 1050 | 1051 |
| 1051 def _CheckClean(self, rev_str): | 1052 def _CheckClean(self, revision): |
| 1052 lockfile = os.path.join(self.checkout_path, ".git", "index.lock") | 1053 lockfile = os.path.join(self.checkout_path, ".git", "index.lock") |
| 1053 if os.path.exists(lockfile): | 1054 if os.path.exists(lockfile): |
| 1054 raise gclient_utils.Error( | 1055 raise gclient_utils.Error( |
| 1055 '\n____ %s%s\n' | 1056 '\n____ %s at %s\n' |
| 1056 '\tYour repo is locked, possibly due to a concurrent git process.\n' | 1057 '\tYour repo is locked, possibly due to a concurrent git process.\n' |
| 1057 '\tIf no git executable is running, then clean up %r and try again.\n' | 1058 '\tIf no git executable is running, then clean up %r and try again.\n' |
| 1058 % (self.relpath, rev_str, lockfile)) | 1059 % (self.relpath, revision, lockfile)) |
| 1059 | 1060 |
| 1060 # Make sure the tree is clean; see git-rebase.sh for reference | 1061 # Make sure the tree is clean; see git-rebase.sh for reference |
| 1061 try: | 1062 try: |
| 1062 scm.GIT.Capture(['update-index', '--ignore-submodules', '--refresh'], | 1063 scm.GIT.Capture(['update-index', '--ignore-submodules', '--refresh'], |
| 1063 cwd=self.checkout_path) | 1064 cwd=self.checkout_path) |
| 1064 except subprocess2.CalledProcessError: | 1065 except subprocess2.CalledProcessError: |
| 1065 raise gclient_utils.Error('\n____ %s%s\n' | 1066 raise gclient_utils.Error('\n____ %s at %s\n' |
| 1066 '\tYou have unstaged changes.\n' | 1067 '\tYou have unstaged changes.\n' |
| 1067 '\tPlease commit, stash, or reset.\n' | 1068 '\tPlease commit, stash, or reset.\n' |
| 1068 % (self.relpath, rev_str)) | 1069 % (self.relpath, revision)) |
| 1069 try: | 1070 try: |
| 1070 scm.GIT.Capture(['diff-index', '--cached', '--name-status', '-r', | 1071 scm.GIT.Capture(['diff-index', '--cached', '--name-status', '-r', |
| 1071 '--ignore-submodules', 'HEAD', '--'], | 1072 '--ignore-submodules', 'HEAD', '--'], |
| 1072 cwd=self.checkout_path) | 1073 cwd=self.checkout_path) |
| 1073 except subprocess2.CalledProcessError: | 1074 except subprocess2.CalledProcessError: |
| 1074 raise gclient_utils.Error('\n____ %s%s\n' | 1075 raise gclient_utils.Error('\n____ %s at %s\n' |
| 1075 '\tYour index contains uncommitted changes\n' | 1076 '\tYour index contains uncommitted changes\n' |
| 1076 '\tPlease commit, stash, or reset.\n' | 1077 '\tPlease commit, stash, or reset.\n' |
| 1077 % (self.relpath, rev_str)) | 1078 % (self.relpath, revision)) |
| 1078 | 1079 |
| 1079 def _CheckDetachedHead(self, rev_str, _options): | 1080 def _CheckDetachedHead(self, revision, _options): |
| 1080 # HEAD is detached. Make sure it is safe to move away from (i.e., it is | 1081 # HEAD is detached. Make sure it is safe to move away from (i.e., it is |
| 1081 # reference by a commit). If not, error out -- most likely a rebase is | 1082 # reference by a commit). If not, error out -- most likely a rebase is |
| 1082 # in progress, try to detect so we can give a better error. | 1083 # in progress, try to detect so we can give a better error. |
| 1083 try: | 1084 try: |
| 1084 scm.GIT.Capture(['name-rev', '--no-undefined', 'HEAD'], | 1085 scm.GIT.Capture(['name-rev', '--no-undefined', 'HEAD'], |
| 1085 cwd=self.checkout_path) | 1086 cwd=self.checkout_path) |
| 1086 except subprocess2.CalledProcessError: | 1087 except subprocess2.CalledProcessError: |
| 1087 # Commit is not contained by any rev. See if the user is rebasing: | 1088 # Commit is not contained by any rev. See if the user is rebasing: |
| 1088 if self._IsRebasing(): | 1089 if self._IsRebasing(): |
| 1089 # Punt to the user | 1090 # Punt to the user |
| 1090 raise gclient_utils.Error('\n____ %s%s\n' | 1091 raise gclient_utils.Error('\n____ %s at %s\n' |
| 1091 '\tAlready in a conflict, i.e. (no branch).\n' | 1092 '\tAlready in a conflict, i.e. (no branch).\n' |
| 1092 '\tFix the conflict and run gclient again.\n' | 1093 '\tFix the conflict and run gclient again.\n' |
| 1093 '\tOr to abort run:\n\t\tgit-rebase --abort\n' | 1094 '\tOr to abort run:\n\t\tgit-rebase --abort\n' |
| 1094 '\tSee man git-rebase for details.\n' | 1095 '\tSee man git-rebase for details.\n' |
| 1095 % (self.relpath, rev_str)) | 1096 % (self.relpath, revision)) |
| 1096 # Let's just save off the commit so we can proceed. | 1097 # Let's just save off the commit so we can proceed. |
| 1097 name = ('saved-by-gclient-' + | 1098 name = ('saved-by-gclient-' + |
| 1098 self._Capture(['rev-parse', '--short', 'HEAD'])) | 1099 self._Capture(['rev-parse', '--short', 'HEAD'])) |
| 1099 self._Capture(['branch', '-f', name]) | 1100 self._Capture(['branch', '-f', name]) |
| 1100 self.Print('_____ found an unreferenced commit and saved it as \'%s\'' % | 1101 self.Print('_____ found an unreferenced commit and saved it as \'%s\'' % |
| 1101 name) | 1102 name) |
| 1102 | 1103 |
| 1103 def _GetCurrentBranch(self): | 1104 def _GetCurrentBranch(self): |
| 1104 # Returns name of current branch or None for detached HEAD | 1105 # Returns name of current branch or None for detached HEAD |
| 1105 branch = self._Capture(['rev-parse', '--abbrev-ref=strict', 'HEAD']) | 1106 branch = self._Capture(['rev-parse', '--abbrev-ref=strict', 'HEAD']) |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1175 kwargs.setdefault('cwd', self.checkout_path) | 1176 kwargs.setdefault('cwd', self.checkout_path) |
| 1176 kwargs.setdefault('stdout', self.out_fh) | 1177 kwargs.setdefault('stdout', self.out_fh) |
| 1177 kwargs['filter_fn'] = self.filter | 1178 kwargs['filter_fn'] = self.filter |
| 1178 kwargs.setdefault('print_stdout', False) | 1179 kwargs.setdefault('print_stdout', False) |
| 1179 env = scm.GIT.ApplyEnvVars(kwargs) | 1180 env = scm.GIT.ApplyEnvVars(kwargs) |
| 1180 cmd = ['git'] + args | 1181 cmd = ['git'] + args |
| 1181 if show_header: | 1182 if show_header: |
| 1182 gclient_utils.CheckCallAndFilterAndHeader(cmd, env=env, **kwargs) | 1183 gclient_utils.CheckCallAndFilterAndHeader(cmd, env=env, **kwargs) |
| 1183 else: | 1184 else: |
| 1184 gclient_utils.CheckCallAndFilter(cmd, env=env, **kwargs) | 1185 gclient_utils.CheckCallAndFilter(cmd, env=env, **kwargs) |
| OLD | NEW |