comparison cmdline/org/tmatesoft/hg/console/Log.java @ 514:5dcb4581c8ef

Report renames when following file history tree with HgFileRenameHandlerMixin
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Mon, 17 Dec 2012 19:06:07 +0100
parents 31a89587eb04
children 6526d8adbc0f
comparison
equal deleted inserted replaced
513:a41d955dc360 514:5dcb4581c8ef
1 /* 1 /*
2 * Copyright (c) 2010-2011 TMate Software Ltd 2 * Copyright (c) 2010-2012 TMate Software Ltd
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License. 6 * the Free Software Foundation; version 2 of the License.
7 * 7 *
19 import static org.tmatesoft.hg.console.Options.asSet; 19 import static org.tmatesoft.hg.console.Options.asSet;
20 20
21 import java.util.List; 21 import java.util.List;
22 22
23 import org.tmatesoft.hg.core.HgChangesetHandler; 23 import org.tmatesoft.hg.core.HgChangesetHandler;
24 import org.tmatesoft.hg.core.HgFileRenameHandlerMixin;
24 import org.tmatesoft.hg.core.HgFileRevision; 25 import org.tmatesoft.hg.core.HgFileRevision;
25 import org.tmatesoft.hg.core.HgLogCommand; 26 import org.tmatesoft.hg.core.HgLogCommand;
26 import org.tmatesoft.hg.repo.HgDataFile; 27 import org.tmatesoft.hg.repo.HgDataFile;
27 import org.tmatesoft.hg.repo.HgRepository; 28 import org.tmatesoft.hg.repo.HgRepository;
28 import org.tmatesoft.hg.util.CancelSupport; 29 import org.tmatesoft.hg.util.CancelSupport;
119 start_end[1]--; // range needs index, not length 120 start_end[1]--; // range needs index, not length
120 return rv; 121 return rv;
121 } 122 }
122 123
123 private static final class Dump extends ChangesetDumpHandler implements HgChangesetHandler.WithCopyHistory { 124 private static final class Dump extends ChangesetDumpHandler implements HgChangesetHandler.WithCopyHistory {
125 private final RenameDumpHandler renameHandlerDelegate;
124 126
125 public Dump(HgRepository hgRepo) { 127 public Dump(HgRepository hgRepo) {
126 super(hgRepo); 128 super(hgRepo);
129 renameHandlerDelegate = new RenameDumpHandler();
127 } 130 }
128 131
132 public void copy(HgFileRevision from, HgFileRevision to) {
133 renameHandlerDelegate.copy(from, to);
134 }
135 }
136
137 static class RenameDumpHandler implements HgFileRenameHandlerMixin {
129 public void copy(HgFileRevision from, HgFileRevision to) { 138 public void copy(HgFileRevision from, HgFileRevision to) {
130 System.out.printf("Got notified that %s(%s) was originally known as %s(%s)\n", to.getPath(), to.getRevision(), from.getPath(), from.getRevision()); 139 System.out.printf("Got notified that %s(%s) was originally known as %s(%s)\n", to.getPath(), to.getRevision(), from.getPath(), from.getRevision());
131 } 140 }
132 } 141 }
133 } 142 }