Mercurial > hg4j
diff src/org/tmatesoft/hg/core/HgIncomingCommand.java @ 208:ef8eba4aa215
Correct index of revisions to be added into a repository
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 28 Apr 2011 03:17:50 +0200 |
parents | ffc5f6d59f7e |
children | 41a778e3fd31 |
line wrap: on
line diff
--- 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) {