Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Need to get exact changed lines when using UnifiedDiffUtils.parseUnifiedDiff #89

Closed
@HuGanghui

Description

@HuGanghui

Describe the bug
A clear and concise description of what the bug is.

This is not bug, but a improvement issue. we need to get exact changed lines when using UnifiedDiffUtils.parseUnifiedDiff in current version we will get aPatch<String>

publicstaticPatch<String>parseUnifiedDiff(List<String>diff) {

InPatch<String>, the core is the structureChunk<T>

patch.addDelta(newChangeDelta<>(newChunk<>(
old_ln -1,oldChunkLines),newChunk<>(
new_ln -1,newChunkLines)));

but now the information that we can use only theposition andlines

privatefinalintposition;
privateList<T>lines;

and in thelines, we can't tell the difference between no changed lines and changed lines, because we do not do this work when we get thelines:

privatestaticvoidprocessLinesInPrevChunk(List<String[]>rawChunk,Patch<String>patch,intold_ln,intnew_ln) {
Stringtag;
Stringrest;
if (!rawChunk.isEmpty()) {
List<String>oldChunkLines =newArrayList<>();
List<String>newChunkLines =newArrayList<>();
for (String[]raw_line :rawChunk) {
tag =raw_line[0];
rest =raw_line[1];
if (" ".equals(tag) ||"-".equals(tag)) {
oldChunkLines.add(rest);
}
if (" ".equals(tag) ||"+".equals(tag)) {
newChunkLines.add(rest);
}
}
patch.addDelta(newChangeDelta<>(newChunk<>(
old_ln -1,oldChunkLines),newChunk<>(
new_ln -1,newChunkLines)));
rawChunk.clear();
}
}

we do not make full use oftag, actually we can:

To Reproduce
Steps to reproduce the behavior:

  1. Example data
  2. simple programm snippet
  3. See error

no reproduce, this is improvement issue.

Expected behavior
A clear and concise description of what you expected to happen.

System

  • Java version
  • Version [e.g. 22]

latest master branch in Github.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp