Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(543)

Side by Side Diff: git_common.py

Issue 1387223002: Attempt at making git-drover work on Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: don't monkey patch Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | git_drover.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 # Monkeypatch IMapIterator so that Ctrl-C can kill everything properly. 5 # Monkeypatch IMapIterator so that Ctrl-C can kill everything properly.
6 # Derived from https://gist.github.com/aljungberg/626518 6 # Derived from https://gist.github.com/aljungberg/626518
7 import multiprocessing.pool 7 import multiprocessing.pool
8 from multiprocessing.pool import IMapIterator 8 from multiprocessing.pool import IMapIterator
9 def wrapper(func): 9 def wrapper(func):
10 def wrap(self, timeout=None): 10 def wrap(self, timeout=None):
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 # and deleted upstream branches). 814 # and deleted upstream branches).
815 missing_upstreams = {} 815 missing_upstreams = {}
816 for info in info_map.values(): 816 for info in info_map.values():
817 if info.upstream not in info_map and info.upstream not in missing_upstreams: 817 if info.upstream not in info_map and info.upstream not in missing_upstreams:
818 missing_upstreams[info.upstream] = None 818 missing_upstreams[info.upstream] = None
819 819
820 return dict(info_map.items() + missing_upstreams.items()) 820 return dict(info_map.items() + missing_upstreams.items())
821 821
822 822
823 def make_workdir_common(repository, new_workdir, files_to_symlink, 823 def make_workdir_common(repository, new_workdir, files_to_symlink,
824 files_to_copy): 824 files_to_copy, symlink=None):
825 if not symlink:
826 symlink = os.symlink
825 os.makedirs(new_workdir) 827 os.makedirs(new_workdir)
826 for entry in files_to_symlink: 828 for entry in files_to_symlink:
827 clone_file(repository, new_workdir, entry, os.symlink) 829 clone_file(repository, new_workdir, entry, symlink)
828 for entry in files_to_copy: 830 for entry in files_to_copy:
829 clone_file(repository, new_workdir, entry, shutil.copy) 831 clone_file(repository, new_workdir, entry, shutil.copy)
830 832
831 833
832 def make_workdir(repository, new_workdir): 834 def make_workdir(repository, new_workdir):
833 GIT_DIRECTORY_WHITELIST = [ 835 GIT_DIRECTORY_WHITELIST = [
834 'config', 836 'config',
835 'info', 837 'info',
836 'hooks', 838 'hooks',
837 'logs/refs', 839 'logs/refs',
838 'objects', 840 'objects',
839 'packed-refs', 841 'packed-refs',
840 'refs', 842 'refs',
841 'remotes', 843 'remotes',
842 'rr-cache', 844 'rr-cache',
843 'svn' 845 'svn'
844 ] 846 ]
845 make_workdir_common(repository, new_workdir, GIT_DIRECTORY_WHITELIST, 847 make_workdir_common(repository, new_workdir, GIT_DIRECTORY_WHITELIST,
846 ['HEAD']) 848 ['HEAD'])
847 849
848 850
849 def clone_file(repository, new_workdir, link, operation): 851 def clone_file(repository, new_workdir, link, operation):
850 if not os.path.exists(os.path.join(repository, link)): 852 if not os.path.exists(os.path.join(repository, link)):
851 return 853 return
852 link_dir = os.path.dirname(os.path.join(new_workdir, link)) 854 link_dir = os.path.dirname(os.path.join(new_workdir, link))
853 if not os.path.exists(link_dir): 855 if not os.path.exists(link_dir):
854 os.makedirs(link_dir) 856 os.makedirs(link_dir)
855 operation(os.path.join(repository, link), os.path.join(new_workdir, link)) 857 operation(os.path.join(repository, link), os.path.join(new_workdir, link))
OLDNEW
« no previous file with comments | « no previous file | git_drover.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698