# HG changeset patch # User Artem Tikhomirov # Date 1303953470 -7200 # Node ID ef8eba4aa2157b33e179fe9f52d5373251d9faf3 # Parent 1bf0a5af2d5d8fe1bea60b2d0f21b4a407f29a0a Correct index of revisions to be added into a repository diff -r 1bf0a5af2d5d -r ef8eba4aa215 cmdline/org/tmatesoft/hg/console/ChangesetDumpHandler.java --- a/cmdline/org/tmatesoft/hg/console/ChangesetDumpHandler.java Thu Apr 28 03:10:56 2011 +0200 +++ b/cmdline/org/tmatesoft/hg/console/ChangesetDumpHandler.java Thu Apr 28 03:17:50 2011 +0200 @@ -36,7 +36,7 @@ // params private boolean complete = false; // roughly --debug private boolean reverseOrder = false; - private boolean verbose = true; // roughly -v + private boolean verbose = false; // roughly -v // own private LinkedList l = new LinkedList(); private final HgRepository repo; diff -r 1bf0a5af2d5d -r ef8eba4aa215 cmdline/org/tmatesoft/hg/console/Incoming.java --- a/cmdline/org/tmatesoft/hg/console/Incoming.java Thu Apr 28 03:10:56 2011 +0200 +++ b/cmdline/org/tmatesoft/hg/console/Incoming.java Thu Apr 28 03:17:50 2011 +0200 @@ -63,6 +63,7 @@ List missing = cmd.executeLite(null); Collections.reverse(missing); // useful to test output, from newer to older Outgoing.dump("Nodes to fetch:", missing); + System.out.printf("Total: %d\n\n", missing.size()); // // Complete final ChangesetDumpHandler h = new ChangesetDumpHandler(hgRepo.getRepository()); diff -r 1bf0a5af2d5d -r ef8eba4aa215 src/org/tmatesoft/hg/core/HgIncomingCommand.java --- a/src/org/tmatesoft/hg/core/HgIncomingCommand.java Thu Apr 28 03:10:56 2011 +0200 +++ b/src/org/tmatesoft/hg/core/HgIncomingCommand.java Thu Apr 28 03:17:50 2011 +0200 @@ -132,16 +132,16 @@ HgBundle changegroup = remoteRepo.getChanges(common); try { changegroup.changes(localRepo, new HgChangelog.Inspector() { - private int localIndex = -1; // in case we start with empty repo and localIndex would not get initialized in regular way + private int localIndex; private final HgChangelog.ParentWalker parentHelper; private final ChangesetTransformer transformer; - private final HgChangelog changelog; - + { transformer = new ChangesetTransformer(localRepo, handler, getParentHelper()); transformer.limitBranches(branches); parentHelper = getParentHelper(); - changelog = localRepo.getChangelog(); + // new revisions, if any, would be added after all existing, and would get numbered started with last+1 + localIndex = localRepo.getChangelog().getRevisionCount(); } public void next(int revisionNumber, Nodeid nodeid, RawChangeset cset) { @@ -149,10 +149,9 @@ if (!common.contains(nodeid)) { throw new HgBadStateException("Bundle shall not report known nodes other than roots we've supplied"); } - localIndex = changelog.getLocalRevision(nodeid); return; } - transformer.next(++localIndex, nodeid, cset); + transformer.next(localIndex++, nodeid, cset); } }); } catch (IOException ex) {