Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1350)

Side by Side Diff: scm.py

Issue 391072: Fix 2 recently introduced errors. (Closed)
Patch Set: Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | trychange.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """SCM-specific utility classes.""" 5 """SCM-specific utility classes."""
6 6
7 import os 7 import os
8 import re 8 import re
9 import subprocess 9 import subprocess
10 import sys 10 import sys
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 Args: 356 Args:
357 file: The file to check 357 file: The file to check
358 property_name: The name of the SVN property, e.g. "svn:mime-type" 358 property_name: The name of the SVN property, e.g. "svn:mime-type"
359 359
360 Returns: 360 Returns:
361 The value of the property, which will be the empty string if the property 361 The value of the property, which will be the empty string if the property
362 is not set on the file. If the file is not under version control, the 362 is not set on the file. If the file is not under version control, the
363 empty string is also returned. 363 empty string is also returned.
364 """ 364 """
365 output = SVN.Run(["propget", property_name, file], None) 365 output = SVN.Run(["propget", property_name, file], None)
366 if (output.startswith("svn: ") and 366 if (output and
367 output.startswith("svn: ") and
367 output.endswith("is not under version control")): 368 output.endswith("is not under version control")):
368 return "" 369 return ""
369 else: 370 else:
370 return output 371 return output
371 372
372 @staticmethod 373 @staticmethod
373 def DiffItem(filename): 374 def DiffItem(filename):
374 """Diff a single file""" 375 """Diff a single file"""
375 # Use svn info output instead of os.path.isdir because the latter fails 376 # Use svn info output instead of os.path.isdir because the latter fails
376 # when the file is deleted. 377 # when the file is deleted.
(...skipping 29 matching lines...) Expand all
406 filename = filename.replace('\\', '/') 407 filename = filename.replace('\\', '/')
407 data = "Index: %s\n" % filename 408 data = "Index: %s\n" % filename
408 data += ("=============================================================" 409 data += ("============================================================="
409 "======\n") 410 "======\n")
410 # Note: Should we use /dev/null instead? 411 # Note: Should we use /dev/null instead?
411 data += "--- %s\n" % filename 412 data += "--- %s\n" % filename
412 data += "+++ %s\n" % filename 413 data += "+++ %s\n" % filename
413 data += "@@ -0,0 +1,%d @@\n" % nb_lines 414 data += "@@ -0,0 +1,%d @@\n" % nb_lines
414 data += ''.join(file_content) 415 data += ''.join(file_content)
415 return data 416 return data
OLDNEW
« no previous file with comments | « no previous file | trychange.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698