New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gsoc: Merge Severity line output #4626

Merged
merged 2 commits into from Aug 14, 2017
Jump to file or symbol
Failed to load files and symbols.
+17 −22
Diff settings

Always

Just for now

Viewing a subset of changes. View all
Prev

Add line number in "[ ]" for the line diff

  • Loading branch information...
Nosferatul committed Aug 10, 2017
commit 360a6245d88260631c8a9019de026e835e43df3d
@@ -39,14 +39,17 @@ def print_beautified_diff(difflines, printer):
elif line.startswith('+++'):
print_to_name(printer, line[4:])
elif line.startswith('+'):
print_to_name(printer, line[1:])
printer.print(format_line(line[1:], real_nr=current_line_added),
color='green')
current_line_added += 1
elif line.startswith('-'):
printer.print(format_line
('Line affected {}'.format(current_line_added)))
printer.print(format_line(''))
print_from_name(printer, line[1:])
printer.print(format_line(line[1:],
real_nr=current_line_subtracted),
color='red')
current_line_subtracted += 1
else:
current_line_subtracted += 1
current_line_added += 1
class ShowPatchAction(ResultAction):
@@ -56,13 +56,11 @@ def test_apply(self):
self.assertEqual(stdout.getvalue(),
'[----] a\n'
'[++++] a\n'
'[++++] test\n'
'[ ] Line affected 2\n'
'[ ] \n'
'[----] c\n'
'[ 2] test\n'
'[ 3] c\n'
'[----] b\n'
'[++++] b\n'
'[++++] first\n')
'[ 1] first\n')
def test_apply_renaming_only(self):
with retrieve_stdout() as stdout:
@@ -102,13 +100,11 @@ def test_apply_with_previous_patches(self):
self.assertEqual(stdout.getvalue(),
'[----] a\n'
'[++++] a\n'
'[++++] test\n'
'[ ] Line affected 2\n'
'[ ] \n'
'[----] c\n'
'[ 2] test\n'
'[ 3] c\n'
'[----] b\n'
'[++++] b\n'
'[++++] first\n')
'[ 1] first\n')
def test_apply_with_rename(self):
with retrieve_stdout() as stdout:
@@ -131,12 +127,8 @@ def test_apply_with_rename(self):
self.assertEqual(stdout.getvalue(),
'[----] a\n'
'[++++] a.rename\n'
'[++++] test\n'
'[ ] Line affected 2\n'
'[ ] \n'
'[----] c\n'
'[ 2] test\n'
'[ 3] c\n'
'[----] b\n'
'[++++] /dev/null\n'
'[ ] Line affected 0\n'
'[ ] \n'
'[----] old_first\n')
'[ 1] old_first\n')
ProTip! Use n and p to navigate between commits in a pull request.