@@ -20,10 +20,10 @@ declare
2020begin
2121 SELECT * INTO latest FROM page_latest WHERE id = page_id;
2222 IF NOT FOUND THEN
23- RAISE notice ' Page % not found' , id;
23+ RAISE ' Page % not found' , id;
2424 END IF;
2525 new_revision := latest .revision + 1 ;
26- raise notice ' new revision: %' , new_revision;
26+ -- raise notice 'new revision: %', new_revision;
2727 -- write out new diff object
2828 INSERT INTO page_diff (page_id, revision, editor, comment)
2929 VALUES (page_id, latest .revision , latest .editor , latest .comment );
@@ -33,21 +33,21 @@ begin
3333 i := array_length(X, 1 ) + 1 ;
3434 j := array_length(Y, 1 ) + 1 ;
3535 -- hunk_start := i;
36- raise notice ' Determining longest common substring table...' ;
3736 C := lcs_length(X, Y);
38- raise notice ' Longest common substring table determined.' ;
39- raise notice ' context_len = %' , context_len;
4037 LOOP -- moving backwards
41- raise notice ' i = %, j = %' , i, j;
42- raise notice ' hunk = %' , hunk;
43- raise notice ' context here = %' , context;
38+ -- raise notice 'i = %, j = %', i, j;
39+ -- raise notice 'hunk = %', hunk;
40+ -- raise notice 'context here = %', context;
4441 if i = 1 or j = 1 then
4542 -- we're done!
4643 IF in_hunk THEN
4744 context_length := array_length(context, 1 );
4845 IF context_length IS NOT NULL THEN
4946 IF context_length > context_len THEN
50- context := context[1 :context_len];
47+ -- raise notice 'context before = %', context;
48+ -- raise notice '% %', context_length-context_len+1, context_length;
49+ context := context[context_length- context_len+ 1 :context_length];
50+ -- raise notice 'context after = %', context;
5151 context_length = context_len;
5252 END IF;
5353 -- prepend context to hunk
@@ -70,11 +70,11 @@ begin
7070 end if;
7171 Xline := X[i- 1 ];
7272 Yline := Y[j- 1 ];
73- raise notice ' Xline = %' , Xline;
74- raise notice ' Yline = %' , Yline;
73+ -- raise notice 'Xline = %', Xline;
74+ -- raise notice 'Yline = %', Yline;
7575 -- handle same line
7676 if Xline = Yline THEN
77- raise notice ' equal lines: %, %' , Xline, Yline;
77+ -- raise notice 'equal lines: %, %', Xline, Yline;
7878 IF NOT in_hunk THEN
7979 -- LIFO queue
8080 IF array_length(context, 1 ) < context_len THEN
@@ -83,13 +83,12 @@ begin
8383 -- hunk_lines_context := hunk_lines_context + 1;
8484 ELSE
8585 -- pull the last one off before you stick the new one in front
86- raise notice ' sliced context = %' , context[1 :context_len- 1 ];
86+ -- raise notice 'sliced context = %', context[1:context_len-1];
8787 context := (' ' || Xline) || context[1 :context_len- 1 ];
8888 END IF;
8989 ELSE
9090 context := (' ' || Xline) || context;
91- raise notice ' context whoa = %' , context;
92- -- hunk_lines_context := hunk_lines_context + 1;
91+ -- raise notice 'context whoa = %', context;
9392 -- are we done with this hunk?
9493 -- we need to check up until twice the context_len, because of
9594 -- pathological splitting case
@@ -118,7 +117,7 @@ begin
118117 end if;
119118 -- reset context array
120119 context_length := array_length(context, 1 );
121- raise notice ' context there = %' , context;
120+ -- raise notice 'context there = %', context;
122121 IF NOT in_hunk THEN
123122 -- start a new hunk
124123 hunk = context;
@@ -136,14 +135,14 @@ begin
136135 context := array[]::text [];
137136 -- done resetting context; handle addition and deletion
138137 if C[i][j- 1 ] > C[i- 1 ][j] THEN
139- raise notice ' added: %' , Yline;
138+ -- raise notice 'added: %', Yline;
140139 -- must have been added
141140 hunk := (' +' || Yline) || hunk;
142141 hunk_lines_added := hunk_lines_added + 1 ;
143142 j := j - 1 ;
144143 continue;
145144 ELSE
146- raise notice ' deleted: %' , Xline;
145+ -- raise notice 'deleted: %', Xline;
147146 -- must have been deleted
148147 hunk := (' -' || Xline) || hunk;
149148 hunk_lines_deleted := hunk_lines_deleted + 1 ;
0 commit comments