Commit 1853f66e authored by Aaron Gable's avatar Aaron Gable Committed by Commit Bot

gclient: diff against hash in DEPS

When someone runs "gclient diff", they expect to be diffing their
local state against the state of a clean gclient checkout.

Up until now, "gclient diff" has been doing... not that. It's been
assuming that the sha1 in DEPS is approximately the head of the
remote's master branch, finding the merge-base between the local
content and that remote master, and diffing against that merge-base.
This makes basically no sense in the context of gclient. With
gclient, we already know exactly what should be checked out: it's
whatever is in DEPS.

This CL updates the behavior of "gclient diff" to do the right thing.

Bug: 731701
Change-Id: I23a43cbc0d6bc7772495097ff615d4d070f5ad19
Reviewed-on: https://chromium-review.googlesource.com/914717Reviewed-by: 's avatarAndrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
parent a148b5ee
......@@ -252,11 +252,10 @@ class GitWrapper(SCMWrapper):
).split()
def diff(self, options, _args, _file_list):
try:
merge_base = [self._Capture(['merge-base', 'HEAD', self.remote])]
except subprocess2.CalledProcessError:
merge_base = []
self._Run(['-c', 'core.quotePath=false', 'diff'] + merge_base, options)
_, revision = gclient_utils.SplitUrlRevision(self.url)
if not revision:
revision = 'refs/remotes/%s/master' % self.remote
self._Run(['-c', 'core.quotePath=false', 'diff', revision], options)
def pack(self, _options, _args, _file_list):
"""Generates a patch file which can be applied to the root of the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment