Revert 195308 "Tweak GenerateDiff:"
Reverting r195363, r195328 and r195308. gcl upload is hanging for me unless I revert these changes.
f:\src\chrome3\src>gcl upload o0m7
at this point, there's no output. If I press enter, I get:
Got an exception
Command svn diff --config-dir c:\users\jabdel~1\appdata\local\temp\tmp7dwbyp -r 195324:head svn://chrome-svn/chrome/trun
k/src/webkit/glue/dom_operations_unittest.cc returned non-zero exit status 1 in f:\src\chrome3\src
Authentication realm: <svn://chrome-svn:3690> 0039d316-1c4b-4281-b951-d872f2087c98
Password for 'jabdelmalek':
Authentication realm: <svn://chrome-svn:3690> 0039d316-1c4b-4281-b951-d872f2087c98
> Tweak GenerateDiff:
>
> * Update comment for accuracy
> * Keep the base diff command in a variable; this fixes an oversight where GenerateDiff would run svn diff without the --config-dir hack, and makes later refactoring easy
> * Apply review comments from https://codereview.chromium.org/14247007/ to existing code
>
> Review URL: https://chromiumcodereview.appspot.com/14366029
TBR=pkasting@chromium.org
Review URL: https://codereview.chromium.org/14297017
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@195422 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/scm.py b/scm.py
index 85eea42..d920e9e 100644
--- a/scm.py
+++ b/scm.py
@@ -790,16 +790,15 @@
# If the user specified a custom diff command in their svn config file,
# then it'll be used when we do svn diff, which we don't want to happen
# since we want the unified diff. Using --diff-cmd=diff doesn't always
- # work, since e.g. Windows cmd users may not have a "diff" executable in
- # their path at all. So we use an empty temporary directory as the config
- # directory, which gets around these problems.
+ # work, since they can have another diff executable in their path that
+ # gives different line endings. So we use a bogus temp directory as the
+ # config directory, which gets around these problems.
bogus_dir = tempfile.mkdtemp()
- command = ['diff', '--config-dir', bogus_dir]
try:
# Cleanup filenames
filenames = [RelativePath(f, root) for f in filenames]
# Get information about the modified items (files and directories)
- data = dict((f, SVN.CaptureLocalInfo([f], root)) for f in filenames)
+ data = dict([(f, SVN.CaptureLocalInfo([f], root)) for f in filenames])
diffs = []
if full_move:
# Eliminate modified files inside moved/copied directory.
@@ -832,7 +831,7 @@
# revision the file was deleted.
srcinfo = {'Revision': rev}
if (srcinfo.get('Revision') != rev and
- SVN.Capture(command + ['-r', '%d:head' % rev, srcurl], cwd)):
+ SVN.Capture(['diff', '-r', '%d:head' % rev, srcurl], cwd)):
metaheaders.append("#$ svn cp -r %d %s %s "
"### WARNING: note non-trunk copy\n" %
(rev, src, filename))
@@ -845,9 +844,9 @@
diffs.extend(metaheaders)
diffs.append("### END SVN COPY METADATA\n")
# Now ready to do the actual diff.
- for filename in sorted(data):
+ for filename in sorted(data.iterkeys()):
diffs.append(SVN._DiffItemInternal(
- filename, cwd, data[filename], command, full_move, revision))
+ filename, cwd, data[filename], bogus_dir, full_move, revision))
# Use StringIO since it can be messy when diffing a directory move with
# full_move=True.
buf = cStringIO.StringIO()
@@ -860,9 +859,9 @@
gclient_utils.RemoveDirectory(bogus_dir)
@staticmethod
- def _DiffItemInternal(filename, cwd, info, diff_command, full_move, revision):
+ def _DiffItemInternal(filename, cwd, info, bogus_dir, full_move, revision):
"""Grabs the diff data."""
- command = diff_command + [filename]
+ command = ["diff", "--config-dir", bogus_dir, filename]
if revision:
command.extend(['--revision', revision])
data = None