Mercurial > jhg
changeset 60:613c936d74e4
Log operation to output mode detailed (added, removed) files
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Tue, 18 Jan 2011 00:30:41 +0100 |
parents | b771e94a4f7c |
children | fac8e7fcc8b0 |
files | design.txt src/com/tmate/hgkit/console/Log.java |
diffstat | 2 files changed, 54 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/design.txt Tue Jan 18 00:08:15 2011 +0100 +++ b/design.txt Tue Jan 18 00:30:41 2011 +0100 @@ -32,18 +32,18 @@ +Nodeid to keep 20 bytes always, Revlog.Inspector to get nodeid array of meaningful data exact size (nor heading 00 bytes, nor 12 extra bytes from the spec) +DataAccess - implement memory mapped files, +Changeset to get index (local revision number) ++RevisionWalker (on manifest) and WorkingCopyWalker (io.File) talking to ? and/or dirstate (StatusCollector and WCSC) ++RevlogStream - Inflater. Perhaps, InflaterStream instead? branch:wrap-data-access ++repo.status - use same collector class twice, difference as external code. add external walker that keeps collected maps and use it in Log operation to give files+,files- -DataAccess - collect debug info (buffer misses, file size/total read operations) to find out better strategy to buffer size detection. Compare performance. -delta merge -RevisionWalker (on manifest) and WorkingCopyWalker (io.File) talking to ? and/or dirstate -RevlogStream - Inflater. Perhaps, InflaterStream instead? + Implement use of fncache (use names from it - perhaps, would help for Mac issues Alex mentioned) along with 'digest'-ing long file names +delta merge +DataAccess - collect debug info (buffer misses, file size/total read operations) to find out better strategy to buffer size detection. Compare performance. -repo.status - use same collector class twice, difference as external code. add external walker that keeps collected maps and use it - in Log operation to give files+,files- - + Status operation from GUI - guess, usually on a file/subfolder, hence API should allow for starting path (unlike cmdline, seems useless to implement include/exclide patterns - GUI users hardly enter them, ever) - + -> recently introduced FileWalker may perhaps help solving this (if starts walking from selected folder) for status op against WorkingDir? ??? encodings of fncache, .hgignore, dirstate ??? http://mercurial.selenic.com/wiki/Manifest says "Multiple changesets may refer to the same manifest revision". To me, each changeset @@ -56,6 +56,8 @@ and allows buffer management (i.e. reuse. Single buffer for all reads). Scheduling multiple operations (in future, to deal with writes - single queue for FS operations - no locks?) +WRITE: Need to register instances that cache files (e.g. dirstate or .hgignore) to FS notifier, so that cache may get cleared if the file changes (i.e. WriteOperation touches it). + File access: * NIO and mapped files - should be fast. Although seems to give less control on mem usage. * Regular InputStreams and chunked stream on top - allocate List<byte[]>, each (but last) chunk of fixed size (depending on initial file size)
--- a/src/com/tmate/hgkit/console/Log.java Tue Jan 18 00:08:15 2011 +0100 +++ b/src/com/tmate/hgkit/console/Log.java Tue Jan 18 00:30:41 2011 +0100 @@ -16,6 +16,7 @@ import com.tmate.hgkit.ll.HgRepository; import com.tmate.hgkit.ll.Nodeid; import com.tmate.hgkit.ll.Revlog; +import com.tmate.hgkit.ll.StatusCollector; /** * @author artem @@ -33,6 +34,7 @@ System.out.println(hgRepo.getLocation()); final Dump dump = new Dump(hgRepo); dump.complete = true; //cmdLineOpts; + dump.verbose = false; //cmdLineOpts; dump.reverseOrder = true; dump.branches = cmdLineOpts.branches; if (cmdLineOpts.users != null) { @@ -96,15 +98,17 @@ // - complete == true (--debug) files are not broke down to modified,+ and - private static final class Dump implements Changeset.Inspector { // params - boolean complete = false; + boolean complete = false; // roughly --debug boolean reverseOrder = false; Set<String> branches; Set<String> users; // shall be lowercased + boolean verbose = true; // roughly -v // own private LinkedList<String> l = new LinkedList<String>(); private final HgRepository repo; private Revlog.ParentWalker changelogWalker; - private final int tip ; + private final int tip ; + private StatusCollector statusHelper; public Dump(HgRepository hgRepo) { repo = hgRepo; @@ -176,23 +180,58 @@ f.format("parent: %d:%s\nparent: %d:%s\nmanifest: %d:%s\n", p1x, p1, p2x, p2, mx, cset.manifest()); } f.format("user: %s\ndate: %s\n", cset.user(), cset.dateString()); - if (complete) { + if (!complete && verbose) { final List<String> files = cset.files(); sb.append("files: "); for (String s : files) { sb.append(' '); sb.append(s); } + sb.append('\n'); + } + if (complete) { + if (statusHelper == null) { + statusHelper = new StatusCollector(repo); + } + StatusCollector.Record r = new StatusCollector.Record(); + statusHelper.change(revNumber, r); + if (!r.getModified().isEmpty()) { + sb.append("files: "); + for (String s : r.getModified()) { + sb.append(' '); + sb.append(s); + } + sb.append('\n'); + } + if (!r.getAdded().isEmpty()) { + sb.append("files+: "); + for (String s : r.getAdded()) { + sb.append(' '); + sb.append(s); + } + sb.append('\n'); + } + if (!r.getRemoved().isEmpty()) { + sb.append("files-: "); + for (String s : r.getRemoved()) { + sb.append(' '); + sb.append(s); + } + sb.append('\n'); + } if (cset.extras() != null) { - sb.append("\nextra: "); + sb.append("extra: "); for (Map.Entry<String, String> e : cset.extras().entrySet()) { sb.append(' '); sb.append(e.getKey()); sb.append('='); sb.append(e.getValue()); } + sb.append('\n'); } - f.format("\ndescription:\n%s\n\n", cset.comment()); + } + if (complete || verbose) { + f.format("description:\n%s\n\n", cset.comment()); } else { f.format("summary: %s\n\n", cset.comment()); }