# HG changeset patch # User jrice@netbeans.org # Date 1205334190 0 # Node ID 2ed7eae382f1b59f2cfc29212ef79611e6e813b9 # Parent a38ee9409186c68408bc1611f28a41aa59edd7bd #129799: Fetching Revisions for Export is slow on large repos - adding similar support to Backout, Strip, Revert and Update diff -r a38ee9409186 -r 2ed7eae382f1 mercurial/src/org/netbeans/modules/mercurial/ui/diff/ExportDiff.java --- a/mercurial/src/org/netbeans/modules/mercurial/ui/diff/ExportDiff.java Wed Mar 12 12:28:33 2008 +0000 +++ b/mercurial/src/org/netbeans/modules/mercurial/ui/diff/ExportDiff.java Wed Mar 12 15:03:10 2008 +0000 @@ -66,10 +66,10 @@ public class ExportDiff implements Prope /** Creates a new instance of ExportDiff */ - public ExportDiff(File repository, RepositoryRevision repoRev, File fileToDiff) { + public ExportDiff(File repository, RepositoryRevision repoRev, File [] roots, File fileToDiff) { this.fileToDiff = fileToDiff; this.repoRev = repoRev; - panel = new ExportDiffPanel(repository, repoRev, fileToDiff); + panel = new ExportDiffPanel(repository, repoRev, roots, fileToDiff); okButton = new JButton(); org.openide.awt.Mnemonics.setLocalizedText(okButton, org.openide.util.NbBundle.getMessage(ExportDiff.class, "CTL_ExportForm_Action_Export")); // NOI18N okButton.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(ExportDiff.class, "ACSN_ExportForm_Action_Export")); // NOI18N @@ -86,12 +86,12 @@ public class ExportDiff implements Prope panel.outputFileTextField.getDocument().addDocumentListener(listener); } - public ExportDiff(File repository, RepositoryRevision repoRev) { - this(repository, repoRev, null); + public ExportDiff(File repository, RepositoryRevision repoRev, File [] roots) { + this(repository, repoRev, roots, null); } - public ExportDiff(File repository) { - this(repository, null, null); + public ExportDiff(File repository, File [] roots) { + this(repository, null, roots, null); } public boolean showDialog() { diff -r a38ee9409186 -r 2ed7eae382f1 mercurial/src/org/netbeans/modules/mercurial/ui/diff/ExportDiffAction.java --- a/mercurial/src/org/netbeans/modules/mercurial/ui/diff/ExportDiffAction.java Wed Mar 12 12:28:33 2008 +0000 +++ b/mercurial/src/org/netbeans/modules/mercurial/ui/diff/ExportDiffAction.java Wed Mar 12 15:03:10 2008 +0000 @@ -86,7 +86,8 @@ public class ExportDiffAction extends Co private static void exportDiff(VCSContext ctx) { final File root = HgUtils.getRootFile(ctx); - ExportDiff ed = new ExportDiff(root); + File[] files = ctx != null? ctx.getFiles().toArray(new File[0]): null; + ExportDiff ed = new ExportDiff(root, files); if (!ed.showDialog()) { return; } @@ -120,7 +121,7 @@ public class ExportDiffAction extends Co if(repoRev.getRepositoryRootUrl() == null || repoRev.getRepositoryRootUrl().equals("")) return; final File root = new File(repoRev.getRepositoryRootUrl()); - ExportDiff ed = new ExportDiff(root, repoRev, fileToDiff); + ExportDiff ed = new ExportDiff(root, repoRev, null, fileToDiff); final String revStr = repoRev.getLog().getRevision(); if (!ed.showDialog()) { return; @@ -148,11 +149,11 @@ public class ExportDiffAction extends Co support.start(rp, root.getAbsolutePath(), org.openide.util.NbBundle.getMessage(ExportDiffAction.class, "LBL_ExportDiff_Progress")); // NOI18N } - public static void exportDiffRevision(final RepositoryRevision repoRev) { + public static void exportDiffRevision(final RepositoryRevision repoRev, final File[] roots) { if(repoRev == null || repoRev.getRepositoryRootUrl() == null || repoRev.getRepositoryRootUrl().equals("")) return; final File root = new File(repoRev.getRepositoryRootUrl()); - ExportDiff ed = new ExportDiff(root, repoRev); + ExportDiff ed = new ExportDiff(root, repoRev, roots); final String revStr = repoRev.getLog().getRevision(); if (!ed.showDialog()) { return; diff -r a38ee9409186 -r 2ed7eae382f1 mercurial/src/org/netbeans/modules/mercurial/ui/diff/ExportDiffPanel.java --- a/mercurial/src/org/netbeans/modules/mercurial/ui/diff/ExportDiffPanel.java Wed Mar 12 12:28:33 2008 +0000 +++ b/mercurial/src/org/netbeans/modules/mercurial/ui/diff/ExportDiffPanel.java Wed Mar 12 15:03:10 2008 +0000 @@ -50,6 +50,8 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.Dialog; +import java.util.Arrays; +import java.util.HashSet; import javax.swing.JFileChooser; import javax.swing.filechooser.FileFilter; import org.netbeans.api.progress.ProgressHandleFactory; @@ -83,13 +85,15 @@ public class ExportDiffPanel extends jav private HgLogMessage[] messages; private int fetchRevisionLimit = Mercurial.HG_NUMBER_TO_FETCH_DEFAULT; private boolean bGettingRevisions = false; + private File [] roots; /** Creates new form ExportDiffPanel */ - public ExportDiffPanel(File repo, RepositoryRevision repoRev, File fileToDiff) { + public ExportDiffPanel(File repo, RepositoryRevision repoRev, File [] roots, File fileToDiff) { this.fileToDiff = fileToDiff; this.repoRev = repoRev; - repository = repo; - refreshViewTask = rp.create(new RefreshViewTask()); + this.roots = roots; + this.repository = repo; + this.refreshViewTask = rp.create(new RefreshViewTask()); initComponents(); revisionsComboBox.setMaximumRowCount(Mercurial.HG_MAX_REVISION_COMBO_SIZE); if(fileToDiff != null){ @@ -313,7 +317,8 @@ private void revisionsComboBoxActionPerf private void refreshRevisions() { bGettingRevisions = true; OutputLogger logger = OutputLogger.getLogger(Mercurial.MERCURIAL_OUTPUT_TAB_TITLE); - messages = HgCommand.getLogMessagesNoFileInfo(repository.getAbsolutePath(), fetchRevisionLimit, logger); + Set setRoots = new HashSet(Arrays.asList(roots)); + messages = HgCommand.getLogMessagesNoFileInfo(repository.getAbsolutePath(), setRoots, fetchRevisionLimit, logger); Set targetRevsSet = new LinkedHashSet(); int size; diff -r a38ee9409186 -r 2ed7eae382f1 mercurial/src/org/netbeans/modules/mercurial/ui/log/SummaryView.java --- a/mercurial/src/org/netbeans/modules/mercurial/ui/log/SummaryView.java Wed Mar 12 12:28:33 2008 +0000 +++ b/mercurial/src/org/netbeans/modules/mercurial/ui/log/SummaryView.java Wed Mar 12 15:03:10 2008 +0000 @@ -501,7 +501,7 @@ class SummaryView implements MouseListen Object o = dispResults.get(idx); if (o instanceof RepositoryRevision) { RepositoryRevision repoRev = (RepositoryRevision) o; - ExportDiffAction.exportDiffRevision(repoRev); + ExportDiffAction.exportDiffRevision(repoRev, master.getRoots()); } } diff -r a38ee9409186 -r 2ed7eae382f1 mercurial/src/org/netbeans/modules/mercurial/ui/rollback/Backout.java --- a/mercurial/src/org/netbeans/modules/mercurial/ui/rollback/Backout.java Wed Mar 12 12:28:33 2008 +0000 +++ b/mercurial/src/org/netbeans/modules/mercurial/ui/rollback/Backout.java Wed Mar 12 15:03:10 2008 +0000 @@ -63,14 +63,14 @@ public class Backout implements Property private RepositoryRevision repoRev; /** Creates a new instance of Backout */ - public Backout(File repository, RepositoryRevision repoRev) { - this (repository, null, repoRev); + public Backout(File repository, RepositoryRevision repoRev, File [] roots) { + this (repository, null, repoRev, roots); } - public Backout(File repository, String defaultRevision, RepositoryRevision repoRev) { + public Backout(File repository, String defaultRevision, RepositoryRevision repoRev, File [] roots) { this.repoRev = repoRev; this.repository = repository; - panel = new BackoutPanel(repository, repoRev); + panel = new BackoutPanel(repository, repoRev, roots); okButton = new JButton(); org.openide.awt.Mnemonics.setLocalizedText(okButton, org.openide.util.NbBundle.getMessage(Backout.class, "CTL_BackoutForm_Action_Backout")); // NOI18N okButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(Backout.class, "ACSD_BackoutForm_Action_Backout")); // NOI18N diff -r a38ee9409186 -r 2ed7eae382f1 mercurial/src/org/netbeans/modules/mercurial/ui/rollback/BackoutAction.java --- a/mercurial/src/org/netbeans/modules/mercurial/ui/rollback/BackoutAction.java Wed Mar 12 12:28:33 2008 +0000 +++ b/mercurial/src/org/netbeans/modules/mercurial/ui/rollback/BackoutAction.java Wed Mar 12 15:03:10 2008 +0000 @@ -93,6 +93,7 @@ public class BackoutAction extends Conte public static void backout(final VCSContext ctx, final RepositoryRevision repoRev){ final File root; + File[] files = ctx != null? ctx.getFiles().toArray(new File[0]): null; if(repoRev != null){ if(repoRev.getRepositoryRootUrl() == null || repoRev.getRepositoryRootUrl().equals("")){ return; @@ -107,7 +108,7 @@ public class BackoutAction extends Conte String rev = null; String commitMsg = null; - final Backout backout = new Backout(root, repoRev); + final Backout backout = new Backout(root, repoRev, files); if (!backout.showDialog()) { return; } diff -r a38ee9409186 -r 2ed7eae382f1 mercurial/src/org/netbeans/modules/mercurial/ui/rollback/BackoutPanel.java --- a/mercurial/src/org/netbeans/modules/mercurial/ui/rollback/BackoutPanel.java Wed Mar 12 12:28:33 2008 +0000 +++ b/mercurial/src/org/netbeans/modules/mercurial/ui/rollback/BackoutPanel.java Wed Mar 12 15:03:10 2008 +0000 @@ -41,6 +41,8 @@ package org.netbeans.modules.mercurial.u package org.netbeans.modules.mercurial.ui.rollback; import java.io.File; +import java.util.Arrays; +import java.util.HashSet; import java.util.Set; import java.util.Vector; import java.util.LinkedHashSet; @@ -72,10 +74,12 @@ public class BackoutPanel extends javax. private HgLogMessage[] messages; private int fetchRevisionLimit = Mercurial.HG_NUMBER_TO_FETCH_DEFAULT; private boolean bGettingRevisions = false; + File [] roots; /** Creates new form ReverModificationsPanel */ - public BackoutPanel(File repo, RepositoryRevision repoRev) { + public BackoutPanel(File repo, RepositoryRevision repoRev, File [] roots) { this.repoRev = repoRev; + this.roots = roots; repository = repo; refreshViewTask = rp.create(new RefreshViewTask()); initComponents(); @@ -316,7 +320,8 @@ private void revisionsComboBoxActionPerf private void refreshRevisions() { bGettingRevisions = true; OutputLogger logger = OutputLogger.getLogger(Mercurial.MERCURIAL_OUTPUT_TAB_TITLE); - messages = HgCommand.getLogMessagesNoFileInfo(repository.getAbsolutePath(), fetchRevisionLimit, logger); + Set setRoots = new HashSet(Arrays.asList(roots)); + messages = HgCommand.getLogMessagesNoFileInfo(repository.getAbsolutePath(), setRoots, fetchRevisionLimit, logger); Set targetRevsSet = new LinkedHashSet(); diff -r a38ee9409186 -r 2ed7eae382f1 mercurial/src/org/netbeans/modules/mercurial/ui/rollback/Strip.java --- a/mercurial/src/org/netbeans/modules/mercurial/ui/rollback/Strip.java Wed Mar 12 12:28:33 2008 +0000 +++ b/mercurial/src/org/netbeans/modules/mercurial/ui/rollback/Strip.java Wed Mar 12 15:03:10 2008 +0000 @@ -61,9 +61,9 @@ public class Strip implements PropertyCh private File repository; /** Creates a new instance of Strip */ - public Strip(File repository) { + public Strip(File repository, File [] roots) { this.repository = repository; - panel = new StripPanel(repository); + panel = new StripPanel(repository, roots); okButton = new JButton(); org.openide.awt.Mnemonics.setLocalizedText(okButton, org.openide.util.NbBundle.getMessage(Strip.class, "CTL_StripForm_Action_Strip")); // NOI18N okButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(Strip.class, "ACSD_StripForm_Action_Strip")); // NOI18N diff -r a38ee9409186 -r 2ed7eae382f1 mercurial/src/org/netbeans/modules/mercurial/ui/rollback/StripAction.java --- a/mercurial/src/org/netbeans/modules/mercurial/ui/rollback/StripAction.java Wed Mar 12 12:28:33 2008 +0000 +++ b/mercurial/src/org/netbeans/modules/mercurial/ui/rollback/StripAction.java Wed Mar 12 15:03:10 2008 +0000 @@ -85,11 +85,12 @@ public class StripAction extends Context public static void strip(final VCSContext ctx){ final File root = HgUtils.getRootFile(ctx); if (root == null) return; + File[] files = ctx != null? ctx.getFiles().toArray(new File[0]): null; String repository = root.getAbsolutePath(); String rev = null; - final Strip strip = new Strip(root); + final Strip strip = new Strip(root, files); if (!strip.showDialog()) { return; } diff -r a38ee9409186 -r 2ed7eae382f1 mercurial/src/org/netbeans/modules/mercurial/ui/rollback/StripPanel.java --- a/mercurial/src/org/netbeans/modules/mercurial/ui/rollback/StripPanel.java Wed Mar 12 12:28:33 2008 +0000 +++ b/mercurial/src/org/netbeans/modules/mercurial/ui/rollback/StripPanel.java Wed Mar 12 15:03:10 2008 +0000 @@ -41,6 +41,8 @@ package org.netbeans.modules.mercurial.u package org.netbeans.modules.mercurial.ui.rollback; import java.io.File; +import java.util.Arrays; +import java.util.HashSet; import java.util.Set; import java.util.Vector; import java.util.LinkedHashSet; @@ -70,9 +72,11 @@ public class StripPanel extends javax.sw private HgLogMessage[] messages; private int fetchRevisionLimit = Mercurial.HG_NUMBER_TO_FETCH_DEFAULT; private boolean bGettingRevisions = false; + private File [] roots; /** Creates new form ReverModificationsPanel */ - public StripPanel(File repo) { + public StripPanel(File repo, File [] roots) { + this.roots = roots; repository = repo; refreshViewTask = rp.create(new RefreshViewTask()); initComponents(); @@ -291,7 +295,8 @@ private void revisionsComboBoxActionPerf private void refreshRevisions() { bGettingRevisions = true; OutputLogger logger = OutputLogger.getLogger(Mercurial.MERCURIAL_OUTPUT_TAB_TITLE); - messages = HgCommand.getLogMessagesNoFileInfo(repository.getAbsolutePath(), fetchRevisionLimit, logger); + Set setRoots = new HashSet(Arrays.asList(roots)); + messages = HgCommand.getLogMessagesNoFileInfo(repository.getAbsolutePath(), setRoots, fetchRevisionLimit, logger); Set targetRevsSet = new LinkedHashSet(); diff -r a38ee9409186 -r 2ed7eae382f1 mercurial/src/org/netbeans/modules/mercurial/ui/update/Update.java --- a/mercurial/src/org/netbeans/modules/mercurial/ui/update/Update.java Wed Mar 12 12:28:33 2008 +0000 +++ b/mercurial/src/org/netbeans/modules/mercurial/ui/update/Update.java Wed Mar 12 15:03:10 2008 +0000 @@ -61,13 +61,13 @@ public class Update implements PropertyC private File repository; /** Creates a new instance of Update */ - public Update(File repository) { - this (repository, null); + public Update(File repository, File [] roots) { + this (repository, roots, null); } - public Update(File repository, String defaultRevision) { + public Update(File repository, File [] roots, String defaultRevision) { this.repository = repository; - panel = new UpdatePanel(repository); + panel = new UpdatePanel(repository, roots); okButton = new JButton(); org.openide.awt.Mnemonics.setLocalizedText(okButton, org.openide.util.NbBundle.getMessage(RevertModifications.class, "CTL_UpdateForm_Action_Update")); // NOI18N okButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(RevertModifications.class, "ACSD_UpdateForm_Action_Update")); // NOI18N diff -r a38ee9409186 -r 2ed7eae382f1 mercurial/src/org/netbeans/modules/mercurial/ui/update/UpdateAction.java --- a/mercurial/src/org/netbeans/modules/mercurial/ui/update/UpdateAction.java Wed Mar 12 12:28:33 2008 +0000 +++ b/mercurial/src/org/netbeans/modules/mercurial/ui/update/UpdateAction.java Wed Mar 12 15:03:10 2008 +0000 @@ -82,10 +82,11 @@ public class UpdateAction extends Contex public static void update(final VCSContext ctx){ final File root = HgUtils.getRootFile(ctx); if (root == null) return; + File[] files = ctx != null? ctx.getFiles().toArray(new File[0]): null; String repository = root.getAbsolutePath(); String rev = null; - final Update update = new Update(root); + final Update update = new Update(root, files); if (!update.showDialog()) { return; } diff -r a38ee9409186 -r 2ed7eae382f1 mercurial/src/org/netbeans/modules/mercurial/ui/update/UpdatePanel.java --- a/mercurial/src/org/netbeans/modules/mercurial/ui/update/UpdatePanel.java Wed Mar 12 12:28:33 2008 +0000 +++ b/mercurial/src/org/netbeans/modules/mercurial/ui/update/UpdatePanel.java Wed Mar 12 15:03:10 2008 +0000 @@ -41,6 +41,8 @@ package org.netbeans.modules.mercurial.u package org.netbeans.modules.mercurial.ui.update; import java.io.File; +import java.util.Arrays; +import java.util.HashSet; import java.util.Set; import java.util.Vector; import java.util.LinkedHashSet; @@ -70,10 +72,12 @@ public class UpdatePanel extends javax.s private HgLogMessage[] messages; private int fetchRevisionLimit = Mercurial.HG_NUMBER_TO_FETCH_DEFAULT; private boolean bGettingRevisions = false; + private File [] roots; /** Creates new form ReverModificationsPanel */ - public UpdatePanel(File repo) { + public UpdatePanel(File repo, File [] roots) { repository = repo; + this.roots = roots; refreshViewTask = rp.create(new RefreshViewTask()); initComponents(); revisionsComboBox.setMaximumRowCount(Mercurial.HG_MAX_REVISION_COMBO_SIZE); @@ -251,7 +255,8 @@ private void revisionsComboBoxActionPerf private void refreshRevisions() { bGettingRevisions = true; OutputLogger logger = OutputLogger.getLogger(Mercurial.MERCURIAL_OUTPUT_TAB_TITLE); - messages = HgCommand.getLogMessagesNoFileInfo(repository.getAbsolutePath(), fetchRevisionLimit, logger); + Set setRoots = new HashSet(Arrays.asList(roots)); + messages = HgCommand.getLogMessagesNoFileInfo(repository.getAbsolutePath(), setRoots, fetchRevisionLimit, logger); Set targetRevsSet = new LinkedHashSet(); diff -r a38ee9409186 -r 2ed7eae382f1 mercurial/src/org/netbeans/modules/mercurial/util/HgCommand.java --- a/mercurial/src/org/netbeans/modules/mercurial/util/HgCommand.java Wed Mar 12 12:28:33 2008 +0000 +++ b/mercurial/src/org/netbeans/modules/mercurial/util/HgCommand.java Wed Mar 12 15:03:10 2008 +0000 @@ -889,6 +889,9 @@ public class HgCommand { public static HgLogMessage[] getLogMessagesNoFileInfo(final String rootUrl, int limit, OutputLogger logger) { return getLogMessages(rootUrl, null, null, null, true, false, limit, logger); + } + public static HgLogMessage[] getLogMessagesNoFileInfo(final String rootUrl, final Set files, int limit, OutputLogger logger) { + return getLogMessages(rootUrl, files, null, null, true, false, limit, logger); } public static HgLogMessage[] getLogMessages(final String rootUrl, int limit, OutputLogger logger) {