Mercurial > hg4j
diff src/org/tmatesoft/hg/internal/PatchGenerator.java @ 549:83afa680555d
Annotate merge revision (combined diff against two parents without looking further)
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Tue, 19 Feb 2013 21:17:39 +0100 |
parents | 15b406c7cd9d |
children |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/PatchGenerator.java Mon Feb 18 19:58:51 2013 +0100 +++ b/src/org/tmatesoft/hg/internal/PatchGenerator.java Tue Feb 19 21:17:39 2013 +0100 @@ -21,6 +21,7 @@ import java.util.Map; import org.tmatesoft.hg.repo.HgDataFile; +import org.tmatesoft.hg.repo.HgInvalidStateException; import org.tmatesoft.hg.repo.HgLookup; import org.tmatesoft.hg.repo.HgRepository; @@ -55,6 +56,13 @@ seq2 = s2; prepare(s2); } + + public void init(T s1) { + if (seq2 == null) { + throw new IllegalStateException("Use this #init() only when target sequence shall be matched against different origin"); + } + seq1 = s1; + } private void prepare(T s2) { @@ -200,7 +208,11 @@ added(changeStartS1, changeStartS2, matchStartSeq2); } else { assert changeStartS2 == matchStartSeq2; - System.out.printf("adjustent equal blocks %d, %d and %d,%d\n", changeStartS1, matchStartSeq1, changeStartS2, matchStartSeq2); + if (matchStartSeq1 > 0 || matchStartSeq2 > 0) { + // FIXME perhaps, exception is too much for the case + // once diff is covered with tests, replace with assert false : msg; + throw new HgInvalidStateException(String.format("adjustent equal blocks %d, %d and %d,%d", changeStartS1, matchStartSeq1, changeStartS2, matchStartSeq2)); + } } } if (matchLength > 0) {