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

Side by Side Diff: presubmit_support.py

Issue 113782: Fix AffectedFile.IsDirectory() to use the right path. (Closed)
Patch Set: Created 11 years, 7 months 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Enables directory-specific presubmit checks to run at upload and/or commit. 6 """Enables directory-specific presubmit checks to run at upload and/or commit.
7 """ 7 """
8 8
9 __version__ = '1.0.1' 9 __version__ = '1.0.1'
10 10
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 """ 339 """
340 return normpath(self.path) 340 return normpath(self.path)
341 341
342 def AbsoluteLocalPath(self): 342 def AbsoluteLocalPath(self):
343 """Returns the absolute path of this file on the local disk. 343 """Returns the absolute path of this file on the local disk.
344 """ 344 """
345 return normpath(os.path.join(self.repository_root, self.LocalPath())) 345 return normpath(os.path.join(self.repository_root, self.LocalPath()))
346 346
347 def IsDirectory(self): 347 def IsDirectory(self):
348 """Returns true if this object is a directory.""" 348 """Returns true if this object is a directory."""
349 if os.path.exists(self.path): 349 path = self.AbsoluteLocalPath()
350 if os.path.exists(path):
350 # Retrieve directly from the file system; it is much faster than querying 351 # Retrieve directly from the file system; it is much faster than querying
351 # subversion, especially on Windows. 352 # subversion, especially on Windows.
352 return os.path.isdir(self.path) 353 return os.path.isdir(path)
353 else: 354 else:
354 return gclient.CaptureSVNInfo(self.path).get('Node Kind') in ('dir', 355 return gclient.CaptureSVNInfo(path).get('Node Kind') in ('dir',
355 'directory') 356 'directory')
356 357
357 def SvnProperty(self, property_name): 358 def SvnProperty(self, property_name):
358 """Returns the specified SVN property of this file, or the empty string 359 """Returns the specified SVN property of this file, or the empty string
359 if no such property. 360 if no such property.
360 """ 361 """
361 return gcl.GetSVNFileProperty(self.AbsoluteLocalPath(), property_name) 362 return gcl.GetSVNFileProperty(self.AbsoluteLocalPath(), property_name)
362 363
363 def Action(self): 364 def Action(self):
364 """Returns the action on this opened file, e.g. A, M, D, etc.""" 365 """Returns the action on this opened file, e.g. A, M, D, etc."""
365 return self.action 366 return self.action
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 return not DoPresubmitChecks(gcl.ChangeInfo(name='temp', files=files), 711 return not DoPresubmitChecks(gcl.ChangeInfo(name='temp', files=files),
711 options.commit, 712 options.commit,
712 options.verbose, 713 options.verbose,
713 sys.stdout, 714 sys.stdout,
714 sys.stdin, 715 sys.stdin,
715 default_presubmit=None) 716 default_presubmit=None)
716 717
717 718
718 if __name__ == '__main__': 719 if __name__ == '__main__':
719 sys.exit(Main(sys.argv)) 720 sys.exit(Main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698