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

Side by Side Diff: git_common.py

Issue 2019223002: Stashing is also an option when copy is dirty for upload (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Freeze is a better stash Created 4 years, 5 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 | no next file » | 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 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 743
744 def get_dirty_files(): 744 def get_dirty_files():
745 # Make sure index is up-to-date before running diff-index. 745 # Make sure index is up-to-date before running diff-index.
746 run_with_retcode('update-index', '--refresh', '-q') 746 run_with_retcode('update-index', '--refresh', '-q')
747 return run('diff-index', '--name-status', 'HEAD') 747 return run('diff-index', '--name-status', 'HEAD')
748 748
749 749
750 def is_dirty_git_tree(cmd): 750 def is_dirty_git_tree(cmd):
751 dirty = get_dirty_files() 751 dirty = get_dirty_files()
752 if dirty: 752 if dirty:
753 print 'Cannot %s with a dirty tree. You must commit locally first.' % cmd 753 print 'Cannot %s with a dirty tree. '\
754 'Commit, freeze or stash your changes first.' % cmd
754 print 'Uncommitted files: (git diff-index --name-status HEAD)' 755 print 'Uncommitted files: (git diff-index --name-status HEAD)'
755 print dirty[:4096] 756 print dirty[:4096]
756 if len(dirty) > 4096: # pragma: no cover 757 if len(dirty) > 4096: # pragma: no cover
757 print '... (run "git diff-index --name-status HEAD" to see full output).' 758 print '... (run "git diff-index --name-status HEAD" to see full output).'
758 return True 759 return True
759 return False 760 return False
760 761
761 762
762 def status(): 763 def status():
763 """Returns a parsed version of git-status. 764 """Returns a parsed version of git-status.
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 ['HEAD']) 1003 ['HEAD'])
1003 1004
1004 1005
1005 def clone_file(repository, new_workdir, link, operation): 1006 def clone_file(repository, new_workdir, link, operation):
1006 if not os.path.exists(os.path.join(repository, link)): 1007 if not os.path.exists(os.path.join(repository, link)):
1007 return 1008 return
1008 link_dir = os.path.dirname(os.path.join(new_workdir, link)) 1009 link_dir = os.path.dirname(os.path.join(new_workdir, link))
1009 if not os.path.exists(link_dir): 1010 if not os.path.exists(link_dir):
1010 os.makedirs(link_dir) 1011 os.makedirs(link_dir)
1011 operation(os.path.join(repository, link), os.path.join(new_workdir, link)) 1012 operation(os.path.join(repository, link), os.path.join(new_workdir, link))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698