Commit 4dd9f720 authored by maruel@chromium.org's avatar maruel@chromium.org

Make apply_issue.py much more verbose about what it's doing.

It's to help users figuring out what is happening.

TBR=rogerta@chromium.org
BUG=153284


Review URL: https://chromiumcodereview.appspot.com/11028002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@159504 0039d316-1c4b-4281-b951-d872f2087c98
parent 9d5f4ad1
...@@ -132,9 +132,9 @@ def main(): ...@@ -132,9 +132,9 @@ def main():
# chromium_commands.py?view=markup # chromium_commands.py?view=markup
open('.buildbot-patched', 'w').close() open('.buildbot-patched', 'w').close()
# Apply the patch. print('\nApplying the patch.')
try: try:
scm_obj.apply_patch(patchset) scm_obj.apply_patch(patchset, verbose=True)
except checkout.PatchApplicationFailed, e: except checkout.PatchApplicationFailed, e:
print >> sys.stderr, str(e) print >> sys.stderr, str(e)
return 1 return 1
......
This diff is collapsed.
...@@ -100,6 +100,10 @@ class FilePatchBase(object): ...@@ -100,6 +100,10 @@ class FilePatchBase(object):
out += '%s->' % self.source_filename_utf8 out += '%s->' % self.source_filename_utf8
return out + self.filename_utf8 return out + self.filename_utf8
def dump(self):
"""Dumps itself in a verbose way to help diagnosing."""
return str(self)
class FilePatchDelete(FilePatchBase): class FilePatchDelete(FilePatchBase):
"""Deletes a file.""" """Deletes a file."""
...@@ -123,6 +127,9 @@ class FilePatchBinary(FilePatchBase): ...@@ -123,6 +127,9 @@ class FilePatchBinary(FilePatchBase):
def get(self): def get(self):
return self.data return self.data
def __str__(self):
return str(super(FilePatchBinary, self)) + ' %d bytes' % len(self.data)
class Hunk(object): class Hunk(object):
"""Parsed hunk data container.""" """Parsed hunk data container."""
...@@ -491,6 +498,10 @@ class FilePatchDiff(FilePatchBase): ...@@ -491,6 +498,10 @@ class FilePatchDiff(FilePatchBase):
# We're done. # We're done.
return return
def dump(self):
"""Dumps itself in a verbose way to help diagnosing."""
return str(self) + '\n' + self.get(True)
class PatchSet(object): class PatchSet(object):
"""A list of FilePatch* objects.""" """A list of FilePatch* objects."""
......
...@@ -308,9 +308,9 @@ class SvnCheckout(SvnBaseTest): ...@@ -308,9 +308,9 @@ class SvnCheckout(SvnBaseTest):
self._check_exception( self._check_exception(
self._get_co(None), self._get_co(None),
'While running patch -p1 --forward --force --no-backup-if-mismatch;\n' 'While running patch -p1 --forward --force --no-backup-if-mismatch;\n'
'patching file chrome/file.cc\n' ' patching file chrome/file.cc\n'
'Hunk #1 FAILED at 3.\n' ' Hunk #1 FAILED at 3.\n'
'1 out of 1 hunk FAILED -- saving rejects to file ' ' 1 out of 1 hunk FAILED -- saving rejects to file '
'chrome/file.cc.rej\n') 'chrome/file.cc.rej\n')
def testSvnProps(self): def testSvnProps(self):
...@@ -328,8 +328,8 @@ class SvnCheckout(SvnBaseTest): ...@@ -328,8 +328,8 @@ class SvnCheckout(SvnBaseTest):
e.status, e.status,
'While running svn propset svn:ignore foo chrome/file.cc ' 'While running svn propset svn:ignore foo chrome/file.cc '
'--non-interactive;\n' '--non-interactive;\n'
'patching file chrome/file.cc\n' ' patching file chrome/file.cc\n'
'svn: Cannot set \'svn:ignore\' on a file (\'chrome/file.cc\')\n') ' svn: Cannot set \'svn:ignore\' on a file (\'chrome/file.cc\')\n')
co.prepare(None) co.prepare(None)
svn_props = [('svn:eol-style', 'LF'), ('foo', 'bar')] svn_props = [('svn:eol-style', 'LF'), ('foo', 'bar')]
co.apply_patch( co.apply_patch(
...@@ -472,9 +472,10 @@ class RawCheckout(SvnBaseTest): ...@@ -472,9 +472,10 @@ class RawCheckout(SvnBaseTest):
def testException(self): def testException(self):
self._check_exception( self._check_exception(
self._get_co(None), self._get_co(None),
'patching file chrome/file.cc\n' 'While running patch -u --binary -p1;\n'
'Hunk #1 FAILED at 3.\n' ' patching file chrome/file.cc\n'
'1 out of 1 hunk FAILED -- saving rejects to file ' ' Hunk #1 FAILED at 3.\n'
' 1 out of 1 hunk FAILED -- saving rejects to file '
'chrome/file.cc.rej\n') 'chrome/file.cc.rej\n')
def testProcess(self): def testProcess(self):
...@@ -514,9 +515,9 @@ class ReadOnlyCheckout(SvnBaseTest): ...@@ -514,9 +515,9 @@ class ReadOnlyCheckout(SvnBaseTest):
self._check_exception( self._check_exception(
self._get_co(None), self._get_co(None),
'While running patch -p1 --forward --force --no-backup-if-mismatch;\n' 'While running patch -p1 --forward --force --no-backup-if-mismatch;\n'
'patching file chrome/file.cc\n' ' patching file chrome/file.cc\n'
'Hunk #1 FAILED at 3.\n' ' Hunk #1 FAILED at 3.\n'
'1 out of 1 hunk FAILED -- saving rejects to file ' ' 1 out of 1 hunk FAILED -- saving rejects to file '
'chrome/file.cc.rej\n') 'chrome/file.cc.rej\n')
def testProcess(self): def testProcess(self):
......
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