OLD | NEW |
1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2010 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 self._Run(['checkout-index', '-a', '--prefix=%s/' % export_path], | 143 self._Run(['checkout-index', '-a', '--prefix=%s/' % export_path], |
144 redirect_stdout=False) | 144 redirect_stdout=False) |
145 | 145 |
146 def pack(self, options, args, file_list): | 146 def pack(self, options, args, file_list): |
147 """Generates a patch file which can be applied to the root of the | 147 """Generates a patch file which can be applied to the root of the |
148 repository. | 148 repository. |
149 | 149 |
150 The patch file is generated from a diff of the merge base of HEAD and | 150 The patch file is generated from a diff of the merge base of HEAD and |
151 its upstream branch. | 151 its upstream branch. |
152 """ | 152 """ |
153 path = os.path.join(self._root_dir, self.relpath) | |
154 merge_base = self._Run(['merge-base', 'HEAD', 'origin']) | 153 merge_base = self._Run(['merge-base', 'HEAD', 'origin']) |
155 command = ['git', 'diff', merge_base] | |
156 filterer = DiffFilterer(self.relpath) | |
157 gclient_utils.CheckCallAndFilter( | 154 gclient_utils.CheckCallAndFilter( |
158 command, cwd=path, filter_fn=filterer.Filter, stdout=options.stdout) | 155 ['git', 'diff', merge_base], |
| 156 cwd=self.checkout_path, |
| 157 filter_fn=DiffFilterer(self.relpath, options.stdout).Filter, |
| 158 stdout=options.stdout) |
159 | 159 |
160 def update(self, options, args, file_list): | 160 def update(self, options, args, file_list): |
161 """Runs git to update or transparently checkout the working copy. | 161 """Runs git to update or transparently checkout the working copy. |
162 | 162 |
163 All updated files will be appended to file_list. | 163 All updated files will be appended to file_list. |
164 | 164 |
165 Raises: | 165 Raises: |
166 Error: if can't get URL for relative path. | 166 Error: if can't get URL for relative path. |
167 """ | 167 """ |
168 if args: | 168 if args: |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 | 401 |
402 if verbose: | 402 if verbose: |
403 options.stdout.write('Checked out revision %s\n' % | 403 options.stdout.write('Checked out revision %s\n' % |
404 self.revinfo(options, (), None)) | 404 self.revinfo(options, (), None)) |
405 | 405 |
406 def revert(self, options, args, file_list): | 406 def revert(self, options, args, file_list): |
407 """Reverts local modifications. | 407 """Reverts local modifications. |
408 | 408 |
409 All reverted files will be appended to file_list. | 409 All reverted files will be appended to file_list. |
410 """ | 410 """ |
411 path = os.path.join(self._root_dir, self.relpath) | 411 if not os.path.isdir(self.checkout_path): |
412 if not os.path.isdir(path): | |
413 # revert won't work if the directory doesn't exist. It needs to | 412 # revert won't work if the directory doesn't exist. It needs to |
414 # checkout instead. | 413 # checkout instead. |
415 options.stdout.write('\n_____ %s is missing, synching instead\n' % | 414 options.stdout.write('\n_____ %s is missing, synching instead\n' % |
416 self.relpath) | 415 self.relpath) |
417 # Don't reuse the args. | 416 # Don't reuse the args. |
418 return self.update(options, [], file_list) | 417 return self.update(options, [], file_list) |
419 | 418 |
420 default_rev = "refs/heads/master" | 419 default_rev = "refs/heads/master" |
421 _, deps_revision = gclient_utils.SplitUrlRevision(self.url) | 420 _, deps_revision = gclient_utils.SplitUrlRevision(self.url) |
422 if not deps_revision: | 421 if not deps_revision: |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 | 674 |
676 class SVNWrapper(SCMWrapper): | 675 class SVNWrapper(SCMWrapper): |
677 """ Wrapper for SVN """ | 676 """ Wrapper for SVN """ |
678 | 677 |
679 def cleanup(self, options, args, file_list): | 678 def cleanup(self, options, args, file_list): |
680 """Cleanup working copy.""" | 679 """Cleanup working copy.""" |
681 self._Run(['cleanup'] + args, options) | 680 self._Run(['cleanup'] + args, options) |
682 | 681 |
683 def diff(self, options, args, file_list): | 682 def diff(self, options, args, file_list): |
684 # NOTE: This function does not currently modify file_list. | 683 # NOTE: This function does not currently modify file_list. |
685 path = os.path.join(self._root_dir, self.relpath) | 684 if not os.path.isdir(self.checkout_path): |
686 if not os.path.isdir(path): | 685 raise gclient_utils.Error('Directory %s is not present.' % |
687 raise gclient_utils.Error('Directory %s is not present.' % path) | 686 self.checkout_path) |
688 self._Run(['diff'] + args, options) | 687 self._Run(['diff'] + args, options) |
689 | 688 |
690 def export(self, options, args, file_list): | 689 def export(self, options, args, file_list): |
691 """Export a clean directory tree into the given path.""" | 690 """Export a clean directory tree into the given path.""" |
692 assert len(args) == 1 | 691 assert len(args) == 1 |
693 export_path = os.path.abspath(os.path.join(args[0], self.relpath)) | 692 export_path = os.path.abspath(os.path.join(args[0], self.relpath)) |
694 try: | 693 try: |
695 os.makedirs(export_path) | 694 os.makedirs(export_path) |
696 except OSError: | 695 except OSError: |
697 pass | 696 pass |
698 assert os.path.exists(export_path) | 697 assert os.path.exists(export_path) |
699 self._Run(['export', '--force', '.', export_path], options) | 698 self._Run(['export', '--force', '.', export_path], options) |
700 | 699 |
701 def pack(self, options, args, file_list): | 700 def pack(self, options, args, file_list): |
702 """Generates a patch file which can be applied to the root of the | 701 """Generates a patch file which can be applied to the root of the |
703 repository.""" | 702 repository.""" |
704 path = os.path.join(self._root_dir, self.relpath) | 703 if not os.path.isdir(self.checkout_path): |
705 if not os.path.isdir(path): | 704 raise gclient_utils.Error('Directory %s is not present.' % |
706 raise gclient_utils.Error('Directory %s is not present.' % path) | 705 self.checkout_path) |
707 command = ['svn', 'diff', '-x', '--ignore-eol-style'] | 706 gclient_utils.CheckCallAndFilter( |
708 command.extend(args) | 707 ['svn', 'diff', '-x', '--ignore-eol-style'] + args, |
709 | 708 cwd=self.checkout_path, |
710 filterer = DiffFilterer(self.relpath, options.stdout) | 709 print_stdout=False, |
711 gclient_utils.CheckCallAndFilter(command, cwd=path, always=False, | 710 filter_fn=DiffFilterer(self.relpath, options.stdout).Filter, |
712 print_stdout=False, filter_fn=filterer.Filter, | |
713 stdout=options.stdout) | 711 stdout=options.stdout) |
714 | 712 |
715 def update(self, options, args, file_list): | 713 def update(self, options, args, file_list): |
716 """Runs svn to update or transparently checkout the working copy. | 714 """Runs svn to update or transparently checkout the working copy. |
717 | 715 |
718 All updated files will be appended to file_list. | 716 All updated files will be appended to file_list. |
719 | 717 |
720 Raises: | 718 Raises: |
721 Error: if can't get URL for relative path. | 719 Error: if can't get URL for relative path. |
722 """ | 720 """ |
723 # Only update if git is not controlling the directory. | 721 # Only update if git is not controlling the directory. |
724 checkout_path = os.path.join(self._root_dir, self.relpath) | 722 git_path = os.path.join(self.checkout_path, '.git') |
725 git_path = os.path.join(self._root_dir, self.relpath, '.git') | |
726 if os.path.exists(git_path): | 723 if os.path.exists(git_path): |
727 options.stdout.write('________ found .git directory; skipping %s\n' % | 724 options.stdout.write('________ found .git directory; skipping %s\n' % |
728 self.relpath) | 725 self.relpath) |
729 return | 726 return |
730 | 727 |
731 if args: | 728 if args: |
732 raise gclient_utils.Error("Unsupported argument(s): %s" % ",".join(args)) | 729 raise gclient_utils.Error("Unsupported argument(s): %s" % ",".join(args)) |
733 | 730 |
734 # revision is the revision to match. It is None if no revision is specified, | 731 # revision is the revision to match. It is None if no revision is specified, |
735 # i.e. the 'deps ain't pinned'. | 732 # i.e. the 'deps ain't pinned'. |
736 url, revision = gclient_utils.SplitUrlRevision(self.url) | 733 url, revision = gclient_utils.SplitUrlRevision(self.url) |
737 # Keep the original unpinned url for reference in case the repo is switched. | 734 # Keep the original unpinned url for reference in case the repo is switched. |
738 base_url = url | 735 base_url = url |
739 if options.revision: | 736 if options.revision: |
740 # Override the revision number. | 737 # Override the revision number. |
741 revision = str(options.revision) | 738 revision = str(options.revision) |
742 if revision: | 739 if revision: |
743 forced_revision = True | 740 forced_revision = True |
744 # Reconstruct the url. | 741 # Reconstruct the url. |
745 url = '%s@%s' % (url, revision) | 742 url = '%s@%s' % (url, revision) |
746 rev_str = ' at %s' % revision | 743 rev_str = ' at %s' % revision |
747 else: | 744 else: |
748 forced_revision = False | 745 forced_revision = False |
749 rev_str = '' | 746 rev_str = '' |
750 | 747 |
751 if not os.path.exists(checkout_path): | 748 if not os.path.exists(self.checkout_path): |
752 # We need to checkout. | 749 # We need to checkout. |
753 command = ['checkout', url, checkout_path] | 750 command = ['checkout', url, self.checkout_path] |
754 command = self._AddAdditionalUpdateFlags(command, options, revision) | 751 command = self._AddAdditionalUpdateFlags(command, options, revision) |
755 self._RunAndGetFileList(command, options, file_list, self._root_dir) | 752 self._RunAndGetFileList(command, options, file_list, self._root_dir) |
756 return | 753 return |
757 | 754 |
758 # Get the existing scm url and the revision number of the current checkout. | 755 # Get the existing scm url and the revision number of the current checkout. |
759 from_info = scm.SVN.CaptureInfo(os.path.join(checkout_path, '.'), '.') | 756 from_info = scm.SVN.CaptureInfo(os.path.join(self.checkout_path, '.'), '.') |
760 if not from_info: | 757 if not from_info: |
761 raise gclient_utils.Error(('Can\'t update/checkout %r if an unversioned ' | 758 raise gclient_utils.Error(('Can\'t update/checkout %r if an unversioned ' |
762 'directory is present. Delete the directory ' | 759 'directory is present. Delete the directory ' |
763 'and try again.') % | 760 'and try again.') % |
764 checkout_path) | 761 self.checkout_path) |
765 | 762 |
766 # Look for locked directories. | 763 # Look for locked directories. |
767 dir_info = scm.SVN.CaptureStatus(os.path.join(checkout_path, '.')) | 764 dir_info = scm.SVN.CaptureStatus(os.path.join(self.checkout_path, '.')) |
768 if [True for d in dir_info if d[0][2] == 'L' and d[1] == checkout_path]: | 765 if [True for d in dir_info |
| 766 if d[0][2] == 'L' and d[1] == self.checkout_path]: |
769 # The current directory is locked, clean it up. | 767 # The current directory is locked, clean it up. |
770 self._Run(['cleanup'], options) | 768 self._Run(['cleanup'], options) |
771 | 769 |
772 # Retrieve the current HEAD version because svn is slow at null updates. | 770 # Retrieve the current HEAD version because svn is slow at null updates. |
773 if options.manually_grab_svn_rev and not revision: | 771 if options.manually_grab_svn_rev and not revision: |
774 from_info_live = scm.SVN.CaptureInfo(from_info['URL'], '.') | 772 from_info_live = scm.SVN.CaptureInfo(from_info['URL'], '.') |
775 revision = str(from_info_live['Revision']) | 773 revision = str(from_info_live['Revision']) |
776 rev_str = ' at %s' % revision | 774 rev_str = ' at %s' % revision |
777 | 775 |
778 if from_info['URL'] != base_url: | 776 if from_info['URL'] != base_url: |
(...skipping 21 matching lines...) Expand all Loading... |
800 from_info['Repository Root'], | 798 from_info['Repository Root'], |
801 to_info['Repository Root'], | 799 to_info['Repository Root'], |
802 self.relpath] | 800 self.relpath] |
803 self._Run(command, options, cwd=self._root_dir) | 801 self._Run(command, options, cwd=self._root_dir) |
804 from_info['URL'] = from_info['URL'].replace( | 802 from_info['URL'] = from_info['URL'].replace( |
805 from_info['Repository Root'], | 803 from_info['Repository Root'], |
806 to_info['Repository Root']) | 804 to_info['Repository Root']) |
807 else: | 805 else: |
808 if not options.force and not options.reset: | 806 if not options.force and not options.reset: |
809 # Look for local modifications but ignore unversioned files. | 807 # Look for local modifications but ignore unversioned files. |
810 for status in scm.SVN.CaptureStatus(checkout_path): | 808 for status in scm.SVN.CaptureStatus(self.checkout_path): |
811 if status[0] != '?': | 809 if status[0] != '?': |
812 raise gclient_utils.Error( | 810 raise gclient_utils.Error( |
813 ('Can\'t switch the checkout to %s; UUID don\'t match and ' | 811 ('Can\'t switch the checkout to %s; UUID don\'t match and ' |
814 'there is local changes in %s. Delete the directory and ' | 812 'there is local changes in %s. Delete the directory and ' |
815 'try again.') % (url, checkout_path)) | 813 'try again.') % (url, self.checkout_path)) |
816 # Ok delete it. | 814 # Ok delete it. |
817 options.stdout.write('\n_____ switching %s to a new checkout\n' % | 815 options.stdout.write('\n_____ switching %s to a new checkout\n' % |
818 self.relpath) | 816 self.relpath) |
819 gclient_utils.RemoveDirectory(checkout_path) | 817 gclient_utils.RemoveDirectory(self.checkout_path) |
820 # We need to checkout. | 818 # We need to checkout. |
821 command = ['checkout', url, checkout_path] | 819 command = ['checkout', url, self.checkout_path] |
822 command = self._AddAdditionalUpdateFlags(command, options, revision) | 820 command = self._AddAdditionalUpdateFlags(command, options, revision) |
823 self._RunAndGetFileList(command, options, file_list, self._root_dir) | 821 self._RunAndGetFileList(command, options, file_list, self._root_dir) |
824 return | 822 return |
825 | 823 |
826 # If the provided url has a revision number that matches the revision | 824 # If the provided url has a revision number that matches the revision |
827 # number of the existing directory, then we don't need to bother updating. | 825 # number of the existing directory, then we don't need to bother updating. |
828 if not options.force and str(from_info['Revision']) == revision: | 826 if not options.force and str(from_info['Revision']) == revision: |
829 if options.verbose or not forced_revision: | 827 if options.verbose or not forced_revision: |
830 options.stdout.write('\n_____ %s%s\n' % (self.relpath, rev_str)) | 828 options.stdout.write('\n_____ %s%s\n' % (self.relpath, rev_str)) |
831 return | 829 return |
832 | 830 |
833 command = ['update', checkout_path] | 831 command = ['update', self.checkout_path] |
834 command = self._AddAdditionalUpdateFlags(command, options, revision) | 832 command = self._AddAdditionalUpdateFlags(command, options, revision) |
835 self._RunAndGetFileList(command, options, file_list, self._root_dir) | 833 self._RunAndGetFileList(command, options, file_list, self._root_dir) |
836 | 834 |
837 def updatesingle(self, options, args, file_list): | 835 def updatesingle(self, options, args, file_list): |
838 checkout_path = os.path.join(self._root_dir, self.relpath) | |
839 filename = args.pop() | 836 filename = args.pop() |
840 if scm.SVN.AssertVersion("1.5")[0]: | 837 if scm.SVN.AssertVersion("1.5")[0]: |
841 if not os.path.exists(os.path.join(checkout_path, '.svn')): | 838 if not os.path.exists(os.path.join(self.checkout_path, '.svn')): |
842 # Create an empty checkout and then update the one file we want. Future | 839 # Create an empty checkout and then update the one file we want. Future |
843 # operations will only apply to the one file we checked out. | 840 # operations will only apply to the one file we checked out. |
844 command = ["checkout", "--depth", "empty", self.url, checkout_path] | 841 command = ["checkout", "--depth", "empty", self.url, self.checkout_path] |
845 self._Run(command, options, cwd=self._root_dir) | 842 self._Run(command, options, cwd=self._root_dir) |
846 if os.path.exists(os.path.join(checkout_path, filename)): | 843 if os.path.exists(os.path.join(self.checkout_path, filename)): |
847 os.remove(os.path.join(checkout_path, filename)) | 844 os.remove(os.path.join(self.checkout_path, filename)) |
848 command = ["update", filename] | 845 command = ["update", filename] |
849 self._RunAndGetFileList(command, options, file_list) | 846 self._RunAndGetFileList(command, options, file_list) |
850 # After the initial checkout, we can use update as if it were any other | 847 # After the initial checkout, we can use update as if it were any other |
851 # dep. | 848 # dep. |
852 self.update(options, args, file_list) | 849 self.update(options, args, file_list) |
853 else: | 850 else: |
854 # If the installed version of SVN doesn't support --depth, fallback to | 851 # If the installed version of SVN doesn't support --depth, fallback to |
855 # just exporting the file. This has the downside that revision | 852 # just exporting the file. This has the downside that revision |
856 # information is not stored next to the file, so we will have to | 853 # information is not stored next to the file, so we will have to |
857 # re-export the file every time we sync. | 854 # re-export the file every time we sync. |
858 if not os.path.exists(checkout_path): | 855 if not os.path.exists(self.checkout_path): |
859 os.makedirs(checkout_path) | 856 os.makedirs(self.checkout_path) |
860 command = ["export", os.path.join(self.url, filename), | 857 command = ["export", os.path.join(self.url, filename), |
861 os.path.join(checkout_path, filename)] | 858 os.path.join(self.checkout_path, filename)] |
862 command = self._AddAdditionalUpdateFlags(command, options, | 859 command = self._AddAdditionalUpdateFlags(command, options, |
863 options.revision) | 860 options.revision) |
864 self._Run(command, options, cwd=self._root_dir) | 861 self._Run(command, options, cwd=self._root_dir) |
865 | 862 |
866 def revert(self, options, args, file_list): | 863 def revert(self, options, args, file_list): |
867 """Reverts local modifications. Subversion specific. | 864 """Reverts local modifications. Subversion specific. |
868 | 865 |
869 All reverted files will be appended to file_list, even if Subversion | 866 All reverted files will be appended to file_list, even if Subversion |
870 doesn't know about them. | 867 doesn't know about them. |
871 """ | 868 """ |
872 path = os.path.join(self._root_dir, self.relpath) | 869 if not os.path.isdir(self.checkout_path): |
873 if not os.path.isdir(path): | |
874 # svn revert won't work if the directory doesn't exist. It needs to | 870 # svn revert won't work if the directory doesn't exist. It needs to |
875 # checkout instead. | 871 # checkout instead. |
876 options.stdout.write('\n_____ %s is missing, synching instead\n' % | 872 options.stdout.write('\n_____ %s is missing, synching instead\n' % |
877 self.relpath) | 873 self.relpath) |
878 # Don't reuse the args. | 874 # Don't reuse the args. |
879 return self.update(options, [], file_list) | 875 return self.update(options, [], file_list) |
880 | 876 |
881 # Do a flush of sys.stdout every 10 secs or so otherwise it may never be | 877 # Do a flush of sys.stdout every 10 secs or so otherwise it may never be |
882 # flushed fast enough for buildbot. | 878 # flushed fast enough for buildbot. |
883 last_flushed_at = time.time() | 879 last_flushed_at = time.time() |
884 sys.stdout.flush() | 880 sys.stdout.flush() |
885 | 881 |
886 for file_status in scm.SVN.CaptureStatus(path): | 882 for file_status in scm.SVN.CaptureStatus(self.checkout_path): |
887 file_path = os.path.join(path, file_status[1]) | 883 file_path = os.path.join(self.checkout_path, file_status[1]) |
888 if file_status[0][0] == 'X': | 884 if file_status[0][0] == 'X': |
889 # Ignore externals. | 885 # Ignore externals. |
890 logging.info('Ignoring external %s' % file_path) | 886 logging.info('Ignoring external %s' % file_path) |
891 continue | 887 continue |
892 | 888 |
893 if logging.getLogger().isEnabledFor(logging.INFO): | 889 if logging.getLogger().isEnabledFor(logging.INFO): |
894 logging.info('%s%s' % (file[0], file[1])) | 890 logging.info('%s%s' % (file[0], file[1])) |
895 else: | 891 else: |
896 options.stdout.write(file_path + '\n') | 892 options.stdout.write(file_path + '\n') |
897 # Flush at least 10 seconds between line writes. We wait at least 10 | 893 # Flush at least 10 seconds between line writes. We wait at least 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 | 930 |
935 def revinfo(self, options, args, file_list): | 931 def revinfo(self, options, args, file_list): |
936 """Display revision""" | 932 """Display revision""" |
937 return scm.SVN.CaptureBaseRevision(self.checkout_path) | 933 return scm.SVN.CaptureBaseRevision(self.checkout_path) |
938 | 934 |
939 def runhooks(self, options, args, file_list): | 935 def runhooks(self, options, args, file_list): |
940 self.status(options, args, file_list) | 936 self.status(options, args, file_list) |
941 | 937 |
942 def status(self, options, args, file_list): | 938 def status(self, options, args, file_list): |
943 """Display status information.""" | 939 """Display status information.""" |
944 path = os.path.join(self._root_dir, self.relpath) | |
945 command = ['status'] + args | 940 command = ['status'] + args |
946 if not os.path.isdir(path): | 941 if not os.path.isdir(self.checkout_path): |
947 # svn status won't work if the directory doesn't exist. | 942 # svn status won't work if the directory doesn't exist. |
948 options.stdout.write( | 943 options.stdout.write( |
949 ('\n________ couldn\'t run \'%s\' in \'%s\':\nThe directory ' | 944 ('\n________ couldn\'t run \'%s\' in \'%s\':\nThe directory ' |
950 'does not exist.') % (' '.join(command), path)) | 945 'does not exist.') % (' '.join(command), self.checkout_path)) |
951 # There's no file list to retrieve. | 946 # There's no file list to retrieve. |
952 else: | 947 else: |
953 self._RunAndGetFileList(command, options, file_list) | 948 self._RunAndGetFileList(command, options, file_list) |
954 | 949 |
955 def FullUrlForRelativeUrl(self, url): | 950 def FullUrlForRelativeUrl(self, url): |
956 # Find the forth '/' and strip from there. A bit hackish. | 951 # Find the forth '/' and strip from there. A bit hackish. |
957 return '/'.join(self.url.split('/')[:4]) + url | 952 return '/'.join(self.url.split('/')[:4]) + url |
958 | 953 |
959 def _Run(self, args, options, **kwargs): | 954 def _Run(self, args, options, **kwargs): |
960 """Runs a commands that goes to stdout.""" | 955 """Runs a commands that goes to stdout.""" |
961 kwargs.setdefault('cwd', os.path.join(self._root_dir, self.relpath)) | 956 kwargs.setdefault('cwd', self.checkout_path) |
962 gclient_utils.CheckCallAndFilterAndHeader(['svn'] + args, | 957 gclient_utils.CheckCallAndFilterAndHeader(['svn'] + args, |
963 always=options.verbose, stdout=options.stdout, **kwargs) | 958 always=options.verbose, stdout=options.stdout, **kwargs) |
964 | 959 |
965 def _RunAndGetFileList(self, args, options, file_list, cwd=None): | 960 def _RunAndGetFileList(self, args, options, file_list, cwd=None): |
966 """Runs a commands that goes to stdout and grabs the file listed.""" | 961 """Runs a commands that goes to stdout and grabs the file listed.""" |
967 cwd = cwd or os.path.join(self._root_dir, self.relpath) | 962 cwd = cwd or self.checkout_path |
968 scm.SVN.RunAndGetFileList(options.verbose, args, cwd=cwd, | 963 scm.SVN.RunAndGetFileList(options.verbose, args, cwd=cwd, |
969 file_list=file_list, stdout=options.stdout) | 964 file_list=file_list, stdout=options.stdout) |
970 | 965 |
971 @staticmethod | 966 @staticmethod |
972 def _AddAdditionalUpdateFlags(command, options, revision): | 967 def _AddAdditionalUpdateFlags(command, options, revision): |
973 """Add additional flags to command depending on what options are set. | 968 """Add additional flags to command depending on what options are set. |
974 command should be a list of strings that represents an svn command. | 969 command should be a list of strings that represents an svn command. |
975 | 970 |
976 This method returns a new list to be used as a command.""" | 971 This method returns a new list to be used as a command.""" |
977 new_command = command[:] | 972 new_command = command[:] |
978 if revision: | 973 if revision: |
979 new_command.extend(['--revision', str(revision).strip()]) | 974 new_command.extend(['--revision', str(revision).strip()]) |
980 # --force was added to 'svn update' in svn 1.5. | 975 # --force was added to 'svn update' in svn 1.5. |
981 if ((options.force or options.manually_grab_svn_rev) and | 976 if ((options.force or options.manually_grab_svn_rev) and |
982 scm.SVN.AssertVersion("1.5")[0]): | 977 scm.SVN.AssertVersion("1.5")[0]): |
983 new_command.append('--force') | 978 new_command.append('--force') |
984 return new_command | 979 return new_command |
OLD | NEW |