Mercurial > jhg
comparison src/org/tmatesoft/hg/internal/PatchGenerator.java @ 543:1e95f48d9886
Report line index for insertion and deletion, test against 'hg diff' output
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
|---|---|
| date | Fri, 15 Feb 2013 15:52:03 +0100 |
| parents | a71a05ec11bc |
| children | 7f5998a9619d |
comparison
equal
deleted
inserted
replaced
| 542:a71a05ec11bc | 543:1e95f48d9886 |
|---|---|
| 185 if (changeStartS1 < matchStartSeq1) { | 185 if (changeStartS1 < matchStartSeq1) { |
| 186 if (changeStartS2 < matchStartSeq2) { | 186 if (changeStartS2 < matchStartSeq2) { |
| 187 changed(changeStartS1, matchStartSeq1, changeStartS2, matchStartSeq2); | 187 changed(changeStartS1, matchStartSeq1, changeStartS2, matchStartSeq2); |
| 188 } else { | 188 } else { |
| 189 assert changeStartS2 == matchStartSeq2; | 189 assert changeStartS2 == matchStartSeq2; |
| 190 deleted(changeStartS1, matchStartSeq1); | 190 deleted(matchStartSeq2, changeStartS1, matchStartSeq1); |
| 191 } | 191 } |
| 192 } else { | 192 } else { |
| 193 assert changeStartS1 == matchStartSeq1; | 193 assert changeStartS1 == matchStartSeq1; |
| 194 if(changeStartS2 < matchStartSeq2) { | 194 if(changeStartS2 < matchStartSeq2) { |
| 195 added(matchStartSeq1, changeStartS2, matchStartSeq2); | 195 added(matchStartSeq1, changeStartS2, matchStartSeq2); |
| 208 */ | 208 */ |
| 209 protected void changed(int s1From, int s1To, int s2From, int s2To) { | 209 protected void changed(int s1From, int s1To, int s2From, int s2To) { |
| 210 // NO-OP | 210 // NO-OP |
| 211 } | 211 } |
| 212 | 212 |
| 213 protected void deleted(int s1From, int s1To) { | 213 protected void deleted(int s2DeletePoint, int s1From, int s1To) { |
| 214 // NO-OP | 214 // NO-OP |
| 215 } | 215 } |
| 216 | 216 |
| 217 protected void added(int s1InsertPoint, int s2From, int s2To) { | 217 protected void added(int s1InsertPoint, int s2From, int s2To) { |
| 218 // NO-OP | 218 // NO-OP |
| 229 protected void changed(int s1From, int s1To, int s2From, int s2To) { | 229 protected void changed(int s1From, int s1To, int s2From, int s2To) { |
| 230 System.out.printf("changed [%d..%d) with [%d..%d)\n", s1From, s1To, s2From, s2To); | 230 System.out.printf("changed [%d..%d) with [%d..%d)\n", s1From, s1To, s2From, s2To); |
| 231 } | 231 } |
| 232 | 232 |
| 233 @Override | 233 @Override |
| 234 protected void deleted(int s1From, int s1To) { | 234 protected void deleted(int s2DeletionPoint, int s1From, int s1To) { |
| 235 System.out.printf("deleted [%d..%d)\n", s1From, s1To); | 235 System.out.printf("deleted [%d..%d)\n", s1From, s1To); |
| 236 } | 236 } |
| 237 | 237 |
| 238 @Override | 238 @Override |
| 239 protected void added(int s1InsertPoint, int s2From, int s2To) { | 239 protected void added(int s1InsertPoint, int s2From, int s2To) { |
| 257 byte[] data = seq2.data(s2From, s2To); | 257 byte[] data = seq2.data(s2From, s2To); |
| 258 deltaCollector.add(from, to, data); | 258 deltaCollector.add(from, to, data); |
| 259 } | 259 } |
| 260 | 260 |
| 261 @Override | 261 @Override |
| 262 protected void deleted(int s1From, int s1To) { | 262 protected void deleted(int s2DeletionPoint, int s1From, int s1To) { |
| 263 int from = seq1.chunk(s1From).getOffset(); | 263 int from = seq1.chunk(s1From).getOffset(); |
| 264 int to = seq1.chunk(s1To).getOffset(); | 264 int to = seq1.chunk(s1To).getOffset(); |
| 265 deltaCollector.add(from, to, new byte[0]); | 265 deltaCollector.add(from, to, new byte[0]); |
| 266 } | 266 } |
| 267 | 267 |
