# HG changeset patch # User Artem Tikhomirov # Date 1292985217 -3600 # Node ID 5abe5af181bd6a6d3e94c378376c901f0f80da50 # Parent fc265ddeab262ff5c34b4cf4e2522d8d41f1f05b Ant script to build commands and run sample diff -r fc265ddeab26 -r 5abe5af181bd .hgignore --- a/.hgignore Tue Dec 21 05:11:06 2010 +0100 +++ b/.hgignore Wed Dec 22 03:33:37 2010 +0100 @@ -1,3 +1,4 @@ syntax:glob bin src/Extras.java +hgkit.jar diff -r fc265ddeab26 -r 5abe5af181bd build.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build.xml Wed Dec 22 03:33:37 2010 +0100 @@ -0,0 +1,29 @@ + + + + description + + + + + + + + + + + + + + + + + + + + + + + + + diff -r fc265ddeab26 -r 5abe5af181bd design.txt --- a/design.txt Tue Dec 21 05:11:06 2010 +0100 +++ b/design.txt Wed Dec 22 03:33:37 2010 +0100 @@ -20,9 +20,11 @@ ---------- -support patch from baseRev + few deltas ++ support patch from baseRev + few deltas (although done in a way patches are applied one by one instead of accumulated) + command-line samples (-R, filenames) (Log & Cat) to show on any repo ++buildfile + run samples input stream impl + lifecycle delta merge -Changeset to get index (local revision number) \ No newline at end of file +Changeset to get index (local revision number) + diff -r fc265ddeab26 -r 5abe5af181bd src/com/tmate/hgkit/console/Log.java --- a/src/com/tmate/hgkit/console/Log.java Tue Dec 21 05:11:06 2010 +0100 +++ b/src/com/tmate/hgkit/console/Log.java Wed Dec 22 03:33:37 2010 +0100 @@ -29,20 +29,21 @@ cset.dump(); } }; - for (String fname : cmdLineOpts.files) { - HgDataFile f1 = hgRepo.getFileNode(fname); - System.out.println("\nComplete of a file: " + fname); - f1.history(callback); + if (cmdLineOpts.files.isEmpty()) { + System.out.println("Complete history of the repo:"); + hgRepo.getChangelog().all(callback); + } else { + for (String fname : cmdLineOpts.files) { + HgDataFile f1 = hgRepo.getFileNode(fname); + System.out.println("History of the file: " + fname); + f1.history(callback); + } + } // // System.out.println("\n\n========================="); // System.out.println("Range 1-3:"); // f1.history(1,3, callback); - } // - System.out.println("\n\n========================="); - System.out.println("Complete of a repo:"); - hgRepo.getChangelog().all(callback); //new ChangelogWalker().setFile("hello.c").setRevisionRange(1, 4).accept(new Visitor); } - } diff -r fc265ddeab26 -r 5abe5af181bd src/com/tmate/hgkit/ll/RevlogStream.java --- a/src/com/tmate/hgkit/ll/RevlogStream.java Tue Dec 21 05:11:06 2010 +0100 +++ b/src/com/tmate/hgkit/ll/RevlogStream.java Wed Dec 22 03:33:37 2010 +0100 @@ -165,7 +165,7 @@ } while (patchElementIndex < data.length); // byte[] baseRevContent = lastData; - data = apply(baseRevContent, patches); + data = apply(baseRevContent, actualLen, patches); } } else { if (inline) { @@ -261,8 +261,8 @@ // mpatch.c : apply() // FIXME need to implement patch merge (fold, combine, gather and discard from aforementioned mpatch.[c|py]), also see Revlog and Mercurial PDF - private static byte[] apply(byte[] baseRevisionContent, List patch) { - byte[] tempBuf = new byte[512]; // XXX + private static byte[] apply(byte[] baseRevisionContent, int outcomeLen, List patch) { + byte[] tempBuf = new byte[outcomeLen]; // XXX int last = 0, destIndex = 0; for (PatchRecord pr : patch) { System.arraycopy(baseRevisionContent, last, tempBuf, destIndex, pr.start-last);