Commit 00fdcb33 authored by maruel@chromium.org's avatar maruel@chromium.org

Fix bug introduced in r51121: gcl upload crashes on a 'revived' file.

To reproduce, svn delete a file, then svn merge -c -N the file to revive it.

Also fix a unit test that was broken for a while.

TEST=none
BUG=none

Review URL: http://codereview.chromium.org/6576005

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@75835 0039d316-1c4b-4281-b951-d872f2087c98
parent 22501af8
......@@ -659,6 +659,7 @@ class SVN(object):
used.
The diff will always use relative paths.
"""
assert isinstance(filenames, (list, tuple))
previous_cwd = os.getcwd()
root = root or SVN.GetCheckoutRoot(previous_cwd)
root = os.path.normcase(os.path.join(root, ''))
......@@ -703,7 +704,14 @@ class SVN(object):
rev = int(info.get('Copied From Rev'))
assert srcurl.startswith(root)
src = srcurl[len(root)+1:]
srcinfo = SVN.CaptureInfo(srcurl)
try:
srcinfo = SVN.CaptureInfo(srcurl)
except gclient_utils.CheckCallError, e:
if not 'Not a valid URL' in e.stderr:
raise
# Assume the file was deleted. No idea how to figure out at which
# revision the file was deleted.
srcinfo = {'Revision': rev}
if (srcinfo.get('Revision') != rev and
SVN.Capture(['diff', '-r', '%d:head' % rev, srcurl])):
metaheaders.append("#$ svn cp -r %d %s %s "
......
......@@ -257,8 +257,8 @@ class PresubmitUnittest(PresubmitTestsBase):
presubmit.scm.SVN.CaptureInfo(notfound).AndReturn({})
presubmit.scm.SVN.CaptureInfo(flap).AndReturn(
{'URL': 'svn:/foo/boo/flap.h'})
presubmit.scm.SVN.GenerateDiff(blat).AndReturn(self.presubmit_diffs)
presubmit.scm.SVN.GenerateDiff(notfound).AndReturn(self.presubmit_diffs)
presubmit.scm.SVN.GenerateDiff([blat]).AndReturn(self.presubmit_diffs)
presubmit.scm.SVN.GenerateDiff([notfound]).AndReturn(self.presubmit_diffs)
self.mox.ReplayAll()
......@@ -776,8 +776,8 @@ class InputApiUnittest(PresubmitTestsBase):
presubmit.scm.SVN.GetFileProperty(another, 'svn:mime-type').AndReturn(None)
presubmit.scm.SVN.GetFileProperty(third_party, 'svn:mime-type'
).AndReturn(None)
presubmit.scm.SVN.GenerateDiff(blat).AndReturn(self.presubmit_diffs)
presubmit.scm.SVN.GenerateDiff(another).AndReturn(self.presubmit_diffs)
presubmit.scm.SVN.GenerateDiff([blat]).AndReturn(self.presubmit_diffs)
presubmit.scm.SVN.GenerateDiff([another]).AndReturn(self.presubmit_diffs)
self.mox.ReplayAll()
......
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