style.py (5465:4cff095bbf2b) | style.py (5747:ffded3077c63) |
---|---|
1#! /usr/bin/env python 2# Copyright (c) 2006 The Regents of The University of Michigan 3# Copyright (c) 2007 The Hewlett-Packard Development Company 4# All rights reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions are 8# met: redistributions of source code must retain the above copyright --- 300 unchanged lines hidden (view full) --- 309 if skip(fname): 310 continue 311 312 if not whitespace_file(fname): 313 continue 314 315 fctx = wctx.filectx(fname) 316 pctx = fctx.parents() | 1#! /usr/bin/env python 2# Copyright (c) 2006 The Regents of The University of Michigan 3# Copyright (c) 2007 The Hewlett-Packard Development Company 4# All rights reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions are 8# met: redistributions of source code must retain the above copyright --- 300 unchanged lines hidden (view full) --- 309 if skip(fname): 310 continue 311 312 if not whitespace_file(fname): 313 continue 314 315 fctx = wctx.filectx(fname) 316 pctx = fctx.parents() |
317 assert len(pctx) in (1, 2) | |
318 319 file_data = fctx.data() 320 lines = mdiff.splitnewlines(file_data) | 317 318 file_data = fctx.data() 319 lines = mdiff.splitnewlines(file_data) |
321 mod_lines = modified_lines(pctx[0].data(), file_data, len(lines)) 322 if len(pctx) == 2: 323 m2 = modified_lines(pctx[1].data(), file_data, len(lines)) 324 mod_lines = mod_lines & m2 # only the lines that are new in both | 320 if len(pctx) in (1, 2): 321 mod_lines = modified_lines(pctx[0].data(), file_data, len(lines)) 322 if len(pctx) == 2: 323 m2 = modified_lines(pctx[1].data(), file_data, len(lines)) 324 mod_lines = mod_lines & m2 # only the lines that are new in both 325 else: 326 mod_lines = xrange(0, len(lines)) |
325 326 fixonly = set() 327 for i,line in enumerate(lines): 328 if i not in mod_lines: 329 continue 330 331 if checkwhite_line(line): 332 continue --- 111 unchanged lines hidden --- | 327 328 fixonly = set() 329 for i,line in enumerate(lines): 330 if i not in mod_lines: 331 continue 332 333 if checkwhite_line(line): 334 continue --- 111 unchanged lines hidden --- |