Skip to content

Commit 80912c2

Browse files
code review
1 parent b218d90 commit 80912c2

5 files changed

Lines changed: 24 additions & 15 deletions

File tree

DiffViewer/SyntaxHighlighter.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#
1010
# Audit
1111
#
12-
# - 02/04/2012 Fabrice
12+
# - 04/06/2012 Fabrice
1313
# Check design: purpose of HighlightedText ? Merge code?
1414
#
1515
####################################################################################################
@@ -64,7 +64,7 @@ class HighlightedText(list):
6464
def __init__(self, raw_text_document, lexer):
6565

6666
""" The parameter *raw_text_document* is a :class:`DiffViewer.RawTextDocument` instance and
67-
the parameter *lexer* is Pygments lexer instance.
67+
the parameter *lexer* is a Pygments lexer instance.
6868
"""
6969

7070
super(HighlightedText, self).__init__()
@@ -93,10 +93,10 @@ def highlight_text(raw_text_document, lexer):
9393
""" Highlight a text.
9494
9595
The parameter *raw_text_document* is a :class:`DiffViewer.RawTextDocument` instance and the
96-
parameter *lexer* is Pygments lexer instance.
96+
parameter *lexer* is a Pygments lexer instance.
9797
98-
Return an :class:`TextDocumentModel` instance. The document has one text block that contains
99-
all the fragments. Text fragments use light views.
98+
Return an :class:`DiffViewer.TextDocumentModel` instance. The document has one text block that
99+
contains all the fragments. Text fragments use light views.
100100
"""
101101

102102
highlighted_text = HighlightedText(raw_text_document, lexer)

DiffViewer/diff-viewer

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,20 +74,28 @@ class Application(QtGui.QApplication):
7474
self._raw_text_documents.append(raw_text_document)
7575
lexer = get_lexer_for_filename(file_name, stripnl=False)
7676
self._lexers.append(lexer)
77-
77+
78+
self._highlighted_documents = []
7879
if not args.show:
7980
file_diff = TwoWayFileDiffFactory().process(* self._raw_text_documents)
8081
self._document_models = TextDocumentDiffModelFactory().process(file_diff)
8182
self._highlighted_texts = []
8283
for raw_text_document, lexer in zip(self._raw_text_documents, self._lexers):
8384
highlighted_text = HighlightedText(raw_text_document, lexer)
8485
self._highlighted_texts.append(highlighted_text)
85-
self._highlighted_documents = []
8686
for document_model, highlighted_text in zip(self._document_models, self._highlighted_texts):
8787
highlighted_document = highlight_document(document_model, highlighted_text)
8888
self._highlighted_documents.append(highlighted_document)
8989
else:
90-
self._highlighted_documents = []
90+
# Fixme: broken
91+
# self._diff_view.set_document_models(self._highlighted_documents, complete_mode)
92+
# File "/home/gv/fabrice/unison-osiris/git-python/DiffViewer/DiffWidget.py", line 333, in set_document_models
93+
# cursor.begin_block(side, text_block.frame_type)
94+
# File "/home/gv/fabrice/unison-osiris/git-python/DiffViewer/DiffWidget.py", line 99, in begin_block
95+
# if ((side == LEFT and frame_type == chunk_type.insert) or
96+
# File "/home/gv/fabrice/unison-osiris/git-python/DiffViewer/Tools/EnumFactory.py", line 107, in __eq__
97+
# return self._value == int(other)
98+
# TypeError: int() argument must be a string or a number, not 'NoneType'
9199
for raw_text_document, lexer in zip(self._raw_text_documents, self._lexers):
92100
highlighted_document = highlight_text(raw_text_document, lexer)
93101
self._highlighted_documents.append(highlighted_document)

review-log.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ DiffViewer.Tools
1515
+ TextDocumentModel.py
1616
? RawTextDocumentDiff.py : see audit
1717
? SyntaxHighlighter.py : see audit
18-
- TextDocumentDiffModel.py : review and complete !
18+
? TextDocumentDiffModel.py : check code
1919
x DiffWidget.py
2020
x __init__.py
2121
x diff-viewer

setenv.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
####################################################################################################
44

5+
append_to_ld_library_path_if_not /usr/local/lib
56
append_to_python_path_if_not ${PWD}
67

78
####################################################################################################

test/git-python

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /usr/bin/env python
22

3-
#####################################################################################################
3+
####################################################################################################
44

55
from __future__ import print_function
66

@@ -9,7 +9,7 @@ import os
99
import sys
1010
import time
1111

12-
#####################################################################################################
12+
####################################################################################################
1313

1414
if len(sys.argv) != 2:
1515
print("Give a repository path")
@@ -23,7 +23,7 @@ repository_path = os.path.normpath(repository_path)
2323

2424
print("Repository:", repository_path)
2525

26-
#####################################################################################################
26+
####################################################################################################
2727

2828
repository = git.Repo(repository_path)
2929

@@ -71,7 +71,7 @@ Commit:
7171
print('-'*25)
7272
print(entry.data_stream.read())
7373

74-
#####################################################################################################
74+
####################################################################################################
7575

7676
print('*'*80)
7777
print('Diff:')
@@ -84,8 +84,8 @@ for diff_type in 'A', 'D', 'R', 'M':
8484
print(diff_type)
8585
print(entry)
8686

87-
#####################################################################################################
87+
####################################################################################################
8888
#
8989
# End
9090
#
91-
#####################################################################################################
91+
####################################################################################################

0 commit comments

Comments
 (0)