<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[203832] trunk/Tools</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/203832">203832</a></dd>
<dt>Author</dt> <dd>ddkilzer@apple.com</dd>
<dt>Date</dt> <dd>2016-07-28 13:21:02 -0700 (Thu, 28 Jul 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>webkit-patch upload --suggest-reviewers shouldn't break in the presence of deleted or moved files
&lt;https://webkit.org/b/83342&gt;

Reviewed by Ryosuke Niwa.

* Scripts/webkitpy/common/checkout/scm/git.py:
(Git.revisions_changing_file): Remove code to raise an exception
when the file doesn't exist.  If a file was moved or renamed,
then this caused the script to terminate, which was very
frustrating when you wanted a list of reviewers.
* Scripts/webkitpy/common/checkout/scm/scm_unittest.py:
(SCMTest._shared_test_revisions_changing_file): Update test
expectation to return an empty list of revisions.
(test_create_patch_is_full_patch): Drive-by fix when running all
webkitpy tests (including scm tests).
* Scripts/webkitpy/common/checkout/scm/svn.py:
(SVN.revisions_changing_file): Catch ScriptError exceptions and
return an empty array of revisions if this occurs.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptswebkitpycommoncheckoutscmgitpy">trunk/Tools/Scripts/webkitpy/common/checkout/scm/git.py</a></li>
<li><a href="#trunkToolsScriptswebkitpycommoncheckoutscmscm_unittestpy">trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py</a></li>
<li><a href="#trunkToolsScriptswebkitpycommoncheckoutscmsvnpy">trunk/Tools/Scripts/webkitpy/common/checkout/scm/svn.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (203831 => 203832)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-07-28 20:18:42 UTC (rev 203831)
+++ trunk/Tools/ChangeLog        2016-07-28 20:21:02 UTC (rev 203832)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2016-07-28  David Kilzer  &lt;ddkilzer@apple.com&gt;
+
+        webkit-patch upload --suggest-reviewers shouldn't break in the presence of deleted or moved files
+        &lt;https://webkit.org/b/83342&gt;
+
+        Reviewed by Ryosuke Niwa.
+
+        * Scripts/webkitpy/common/checkout/scm/git.py:
+        (Git.revisions_changing_file): Remove code to raise an exception
+        when the file doesn't exist.  If a file was moved or renamed,
+        then this caused the script to terminate, which was very
+        frustrating when you wanted a list of reviewers.
+        * Scripts/webkitpy/common/checkout/scm/scm_unittest.py:
+        (SCMTest._shared_test_revisions_changing_file): Update test
+        expectation to return an empty list of revisions.
+        (test_create_patch_is_full_patch): Drive-by fix when running all
+        webkitpy tests (including scm tests).
+        * Scripts/webkitpy/common/checkout/scm/svn.py:
+        (SVN.revisions_changing_file): Catch ScriptError exceptions and
+        return an empty array of revisions if this occurs.
+
</ins><span class="cx"> 2016-07-28  Aakash Jain  &lt;aakash_jain@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         EWS error message &quot;Error: * did not process patch&quot; should include explanation
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpycommoncheckoutscmgitpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/common/checkout/scm/git.py (203831 => 203832)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/common/checkout/scm/git.py        2016-07-28 20:18:42 UTC (rev 203831)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/scm/git.py        2016-07-28 20:21:02 UTC (rev 203832)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> # Copyright (c) 2009, 2010, 2011 Google Inc. All rights reserved.
</span><del>-# Copyright (c) 2009 Apple Inc. All rights reserved.
</del><ins>+# Copyright (c) 2009, 2016 Apple Inc. All rights reserved.
</ins><span class="cx"> #
</span><span class="cx"> # Redistribution and use in source and binary forms, with or without
</span><span class="cx"> # modification, are permitted provided that the following conditions are
</span><span class="lines">@@ -242,10 +242,6 @@
</span><span class="cx">         return self._changes_files_for_commit(commit_id)
</span><span class="cx"> 
</span><span class="cx">     def revisions_changing_file(self, path, limit=5):
</span><del>-        # raise a script error if path does not exists to match the behavior of  the svn implementation.
-        if not self._filesystem.exists(path):
-            raise ScriptError(message=&quot;Path %s does not exist.&quot; % path)
-
</del><span class="cx">         # git rev-list head --remove-empty --limit=5 -- path would be equivalent.
</span><span class="cx">         commit_ids = self._run_git([&quot;log&quot;, &quot;--remove-empty&quot;, &quot;--pretty=format:%H&quot;, &quot;-%s&quot; % limit, &quot;--&quot;, path]).splitlines()
</span><span class="cx">         return filter(lambda revision: revision, map(self.svn_revision_from_git_commit, commit_ids))
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpycommoncheckoutscmscm_unittestpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py (203831 => 203832)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py        2016-07-28 20:18:42 UTC (rev 203831)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py        2016-07-28 20:21:02 UTC (rev 203832)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> # Copyright (C) 2009 Google Inc. All rights reserved.
</span><del>-# Copyright (C) 2009 Apple Inc. All rights reserved.
</del><ins>+# Copyright (C) 2009, 2016 Apple Inc. All rights reserved.
</ins><span class="cx"> # Copyright (C) 2011 Daniel Bates (dbates@intudata.com). All rights reserved.
</span><span class="cx"> #
</span><span class="cx"> # Redistribution and use in source and binary forms, with or without
</span><span class="lines">@@ -410,7 +410,7 @@
</span><span class="cx"> 
</span><span class="cx">     def _shared_test_revisions_changing_file(self):
</span><span class="cx">         self.assertItemsEqual(self.scm.revisions_changing_file(&quot;test_file&quot;), [5, 4, 3, 2])
</span><del>-        self.assertRaises(ScriptError, self.scm.revisions_changing_file, &quot;non_existent_file&quot;)
</del><ins>+        self.assertItemsEqual(self.scm.revisions_changing_file(&quot;non_existent_file&quot;), [])
</ins><span class="cx"> 
</span><span class="cx">     def _shared_test_committer_email_for_revision(self):
</span><span class="cx">         self.assertEqual(self.scm.committer_email_for_revision(3), getpass.getuser())  # Committer &quot;email&quot; will be the current user
</span><span class="lines">@@ -704,9 +704,16 @@
</span><span class="cx">         os.chdir(test_dir_path)
</span><span class="cx">         scm = detect_scm_system(test_dir_path)
</span><span class="cx">         self.assertEqual(scm.checkout_root, self.svn_checkout_path) # Sanity check that detection worked right.
</span><del>-        patch_contents = scm.create_patch()
-        # Our fake 'svn-create-patch' returns $PWD instead of a patch, check that it was executed from the root of the repo.
-        self.assertEqual(&quot;%s\n&quot; % os.path.realpath(scm.checkout_root), patch_contents)  # Add a \n because echo adds a \n.
</del><ins>+        actual_patch_contents = scm.create_patch()
+        expected_patch_contents = &quot;&quot;&quot;Index: test_dir2/test_file2
+===================================================================
+--- test_dir2/test_file2\t(revision 0)
++++ test_dir2/test_file2\t(working copy)
+@@ -0,0 +1 @@
++test content
+\\ No newline at end of file
+&quot;&quot;&quot;
+        self.assertEqual(expected_patch_contents, actual_patch_contents)
</ins><span class="cx"> 
</span><span class="cx">     def test_detection(self):
</span><span class="cx">         self.assertEqual(self.scm.display_name(), &quot;svn&quot;)
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpycommoncheckoutscmsvnpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/common/checkout/scm/svn.py (203831 => 203832)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/common/checkout/scm/svn.py        2016-07-28 20:18:42 UTC (rev 203831)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/scm/svn.py        2016-07-28 20:21:02 UTC (rev 203832)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> # Copyright (c) 2009, 2010, 2011 Google Inc. All rights reserved.
</span><del>-# Copyright (c) 2009 Apple Inc. All rights reserved.
</del><ins>+# Copyright (c) 2009, 2016 Apple Inc. All rights reserved.
</ins><span class="cx"> #
</span><span class="cx"> # Redistribution and use in source and binary forms, with or without
</span><span class="cx"> # modification, are permitted provided that the following conditions are
</span><span class="lines">@@ -236,9 +236,13 @@
</span><span class="cx"> 
</span><span class="cx">     def revisions_changing_file(self, path, limit=5):
</span><span class="cx">         revisions = []
</span><del>-        # svn log will exit(1) (and thus self.run will raise) if the path does not exist.
</del><ins>+        # svn log will exit(1) (and thus self.run will raise) if a path is not known to svn.
</ins><span class="cx">         log_command = ['log', '--quiet', '--limit=%s' % limit, path]
</span><del>-        for line in self._run_svn(log_command, cwd=self.checkout_root).splitlines():
</del><ins>+        try:
+            log_output = self._run_svn(log_command, cwd=self.checkout_root)
+        except ScriptError, e:
+            return []
+        for line in log_output.splitlines():
</ins><span class="cx">             match = re.search('^r(?P&lt;revision&gt;\d+) ', line)
</span><span class="cx">             if not match:
</span><span class="cx">                 continue
</span></span></pre>
</div>
</div>

</body>
</html>