Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(5)

Unified Diff: Tools/scripts/patchcheck.py

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Tools/msi/msi.py ('k') | Tools/scripts/reindent.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Tools/scripts/patchcheck.py Tue Jul 26 09:37:46 2011 +0300
+++ b/Tools/scripts/patchcheck.py Mon Jul 25 09:47:18 2011 -0400
@@ -36,14 +36,23 @@
def changed_files():
"""Get the list of changed or added files from the VCS."""
if os.path.isdir('.hg'):
+ vcs = 'hg'
cmd = 'hg status --added --modified --no-status'
+ elif os.path.isdir('.svn'):
+ vcs = 'svn'
+ cmd = 'svn status --quiet --non-interactive --ignore-externals'
else:
sys.exit('need a checkout to get modified files')
st = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE)
try:
st.wait()
- return [x.decode().rstrip() for x in st.stdout]
+ if vcs == 'hg':
+ return [x.decode().rstrip() for x in st.stdout]
+ else:
+ output = (x.decode().rstrip().rsplit(None, 1)[-1]
+ for x in st.stdout if x[0] in b'AM')
+ return set(path for path in output if os.path.isfile(path))
finally:
st.stdout.close()
@@ -63,8 +72,10 @@
def normalize_whitespace(file_paths):
"""Make sure that the whitespace for .py files have been normalized."""
reindent.makebackup = False # No need to create backups.
- fixed = [path for path in file_paths if path.endswith('.py') and
- reindent.check(path)]
+ fixed = []
+ for path in (x for x in file_paths if x.endswith('.py')):
+ if reindent.check(path):
+ fixed.append(path)
return fixed
« no previous file with comments | « Tools/msi/msi.py ('k') | Tools/scripts/reindent.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+