Fix GetOldContents() to return an empty string if the file didn't exist.
Bug: 700108
Change-Id: I9010aa3b4aa467c91b93ffac924b3ec5a16cfaa2
Reviewed-on: https://chromium-review.googlesource.com/476590
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
diff --git a/scm.py b/scm.py
index 6132845..88016dc 100644
--- a/scm.py
+++ b/scm.py
@@ -259,7 +259,10 @@
if not branch:
branch = GIT.GetUpstreamBranch(cwd)
command = ['show', '%s:%s' % (branch, filename)]
- return GIT.Capture(command, cwd=cwd, strip_out=False)
+ try:
+ return GIT.Capture(command, cwd=cwd, strip_out=False)
+ except subprocess2.CalledProcessError:
+ return ''
@staticmethod
def GenerateDiff(cwd, branch=None, branch_head='HEAD', full_move=False,