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 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 filter_fn=DiffFilterer(self.relpath).Filter) | 674 filter_fn=DiffFilterer(self.relpath).Filter) |
675 | 675 |
676 def update(self, options, args, file_list): | 676 def update(self, options, args, file_list): |
677 """Runs svn to update or transparently checkout the working copy. | 677 """Runs svn to update or transparently checkout the working copy. |
678 | 678 |
679 All updated files will be appended to file_list. | 679 All updated files will be appended to file_list. |
680 | 680 |
681 Raises: | 681 Raises: |
682 Error: if can't get URL for relative path. | 682 Error: if can't get URL for relative path. |
683 """ | 683 """ |
684 # Only update if git is not controlling the directory. | 684 # Only update if git or hg is not controlling the directory. |
685 git_path = os.path.join(self.checkout_path, '.git') | 685 git_path = os.path.join(self.checkout_path, '.git') |
686 if os.path.exists(git_path): | 686 if os.path.exists(git_path): |
687 print('________ found .git directory; skipping %s' % self.relpath) | 687 print('________ found .git directory; skipping %s' % self.relpath) |
688 return | 688 return |
689 | 689 |
| 690 hg_path = os.path.join(self.checkout_path, '.hg') |
| 691 if os.path.exists(hg_path): |
| 692 print('________ found .hg directory; skipping %s' % self.relpath) |
| 693 return |
| 694 |
690 if args: | 695 if args: |
691 raise gclient_utils.Error("Unsupported argument(s): %s" % ",".join(args)) | 696 raise gclient_utils.Error("Unsupported argument(s): %s" % ",".join(args)) |
692 | 697 |
693 # revision is the revision to match. It is None if no revision is specified, | 698 # revision is the revision to match. It is None if no revision is specified, |
694 # i.e. the 'deps ain't pinned'. | 699 # i.e. the 'deps ain't pinned'. |
695 url, revision = gclient_utils.SplitUrlRevision(self.url) | 700 url, revision = gclient_utils.SplitUrlRevision(self.url) |
696 # Keep the original unpinned url for reference in case the repo is switched. | 701 # Keep the original unpinned url for reference in case the repo is switched. |
697 base_url = url | 702 base_url = url |
698 if options.revision: | 703 if options.revision: |
699 # Override the revision number. | 704 # Override the revision number. |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 | 927 |
923 This method returns a new list to be used as a command.""" | 928 This method returns a new list to be used as a command.""" |
924 new_command = command[:] | 929 new_command = command[:] |
925 if revision: | 930 if revision: |
926 new_command.extend(['--revision', str(revision).strip()]) | 931 new_command.extend(['--revision', str(revision).strip()]) |
927 # --force was added to 'svn update' in svn 1.5. | 932 # --force was added to 'svn update' in svn 1.5. |
928 if ((options.force or options.manually_grab_svn_rev) and | 933 if ((options.force or options.manually_grab_svn_rev) and |
929 scm.SVN.AssertVersion("1.5")[0]): | 934 scm.SVN.AssertVersion("1.5")[0]): |
930 new_command.append('--force') | 935 new_command.append('--force') |
931 return new_command | 936 return new_command |
OLD | NEW |