diff --git a/gclient_eval.py b/gclient_eval.py index 297ae07d4..5571946c4 100644 --- a/gclient_eval.py +++ b/gclient_eval.py @@ -42,7 +42,7 @@ class ConstantString(object): return self.value == other def __hash__(self): - return self.value.__hash__() + return self.value.__hash__() class _NodeDict(collections_abc.MutableMapping): @@ -893,6 +893,15 @@ def GetCIPD(gclient_dict, dep_name, package_name): def GetRevision(gclient_dict, dep_name): if 'deps' not in gclient_dict or dep_name not in gclient_dict['deps']: + suggestions = [] + if 'deps' in gclient_dict: + for key in gclient_dict['deps']: + if dep_name in key: + suggestions.append(key) + if suggestions: + raise KeyError( + "Could not find any dependency called %s. Did you mean %s" % + (dep_name, ' or '.join(suggestions))) raise KeyError( "Could not find any dependency called %s." % dep_name) diff --git a/roll_dep.py b/roll_dep.py index 3defd7048..a83497f33 100755 --- a/roll_dep.py +++ b/roll_dep.py @@ -17,6 +17,7 @@ import os import re import subprocess2 import sys +import tempfile NEED_SHELL = sys.platform.startswith('win') GCLIENT_PATH = os.path.join( @@ -187,7 +188,14 @@ def finalize(commit_msg, current_dir, rolls): print('\n'.join(' ' + i for i in commit_msg.splitlines())) check_call(['git', 'add', 'DEPS'], cwd=current_dir) - check_call(['git', 'commit', '--quiet', '-m', commit_msg], cwd=current_dir) + # We have to set delete=False and then let the object go out of scope so + # that the file can be opened by name on Windows. + with tempfile.NamedTemporaryFile('w+', newline='', delete=False) as f: + commit_filename = f.name + f.write(commit_msg) + check_call(['git', 'commit', '--quiet', '--file', commit_filename], + cwd=current_dir) + os.remove(commit_filename) # Pull the dependency to the right revision. This is surprising to users # otherwise.