History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEADEV-22138
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Normal Normal
Assignee: Dmitry Jemerov
Reporter: Chuck Canning
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
IDEA: Development

p4v does not start when doing revision graph or time-lapse...

Created: 03 Oct 07 22:38   Updated: 29 Jan 08 05:16
Component/s: Version Control Integration. Perforce
Fix Version/s: Selena RC3 (7330), Selena 7.0.3

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown
Environment: Linux

Build: 7,318
Fixed in build: 7,653
Severity: Medium


 Description  « Hide
This appears to be a regression because when the ability to configure p4v was added, this feature worked for me (this bug was also assigned by me). Now, I get no errors, but p4v does not run. The menu options appear to do nothing.

 All   Comments   Work Log   Change History      Sort Order:
Serge Baranov - 26 Dec 07 22:20
Customer's comment:

In version, 723x, you had fixed the p4v support (but only for a few
updates). In the latest, it doesn't work (but it does fail correctly if
the path is not set. Is there a way for me to see the commands that it
is executing to try to debug the issue. There is nothing in the idea.log
(was tailing it) and their is nothing specific in the p4.output file.

The p4 integration works great until you need to look at the revision
graph and it needs to start the external p4v client. None of our idea
users here can get it to work. I had filed a bug early in the EA process
and it was fixed (version 7234 maybe??). I tested and it worked. Shortly
thereafter, it stopped working. I was trying to find out how the call is
being made to start the external p4v client so I can trey to debug why
it is not starting (idea thinks it was started successfully). I tested
by using an incorrect path and idea reported errors in a dialogue.


Chuck Canning - 16 Jan 08 08:11
The arguments to exec are parsed using a StringTokenizer using " " so the command is being split.

Chuck Canning - 16 Jan 08 08:12
This should fix the issue:

/*

  • Copyright 2000-2007 JetBrains s.r.o.
    *
  • Licensed under the Apache License, Version 2.0 (the "License");
  • you may not use this file except in compliance with the License.
  • You may obtain a copy of the License at
    *
  • http://www.apache.org/licenses/LICENSE-2.0
    *
  • Unless required by applicable law or agreed to in writing, software
  • distributed under the License is distributed on an "AS IS" BASIS,
  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  • See the License for the specific language governing permissions and
  • limitations under the License.
    */

package org.jetbrains.idea.perforce.actions;

import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DataKeys;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.vcs.FileStatus;
import com.intellij.openapi.vcs.FileStatusManager;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.EnvironmentUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.idea.perforce.PerforceBundle;
import org.jetbrains.idea.perforce.application.PerforceClient;
import org.jetbrains.idea.perforce.application.PerforceManager;
import org.jetbrains.idea.perforce.perforce.FStat;
import org.jetbrains.idea.perforce.perforce.P4File;
import org.jetbrains.idea.perforce.perforce.PerforceSettings;
import org.jetbrains.idea.perforce.perforce.connections.P4Connection;
import org.jetbrains.idea.perforce.perforce.connections.PerforceConnectionManager;

import java.io.IOException;
import java.util.List;
import java.util.ArrayList;

/**

  • @author yole
    */
    public class RevisionGraphAction extends AnAction {
    private static final Logger LOG = Logger.getInstance("#org.jetbrains.idea.perforce.actions.RevisionGraphAction");

public void actionPerformed(AnActionEvent e) {
final Project project = e.getData(DataKeys.PROJECT);
final VirtualFile virtualFile = e.getData(DataKeys.VIRTUAL_FILE);
assert project != null && virtualFile != null;
final P4Connection connection = PerforceConnectionManager.getInstance(project).getConnectionForFile(virtualFile);
final PerforceClient client = PerforceManager.getInstance(project).getClient(connection);
final PerforceSettings settings = PerforceSettings.getSettings(project);
List<String> cmd = new ArrayList<String>();

//create the command
cmd.add(settings.PATH_TO_P4V);
cmd.add("-p");
cmd.add(client.getServerPort());
cmd.add("-u");
cmd.add(client.getUserName());
cmd.add("-c");
cmd.add(client.getName());
if (SystemInfo.isWindows) { cmd.add("-win"); cmd.add("0"); }
cmd.add("-cmd");
@NonNls StringBuilder command = new StringBuilder(getCommandName()).append(" ");

FStat fStat = null;
if (settings.ENABLED) {
final P4File p4File = P4File.create(virtualFile);
try { fStat = p4File.getFstat(project, false); }
catch (VcsException ex) { Messages.showErrorDialog(project, PerforceBundle.message("failed.to.retrieve.p4.status.information", FileUtil.toSystemDependentName(virtualFile.getPath()), ex.getMessage()), "Perforce"); return; }
}
if (fStat != null && !StringUtil.isEmpty(fStat.depotFile)) { command.append(fStat.depotFile); }
else { command.append(FileUtil.toSystemDependentName(virtualFile.getPath())); }

command.append("\"");

cmd.add(command.toString());

try { Runtime.getRuntime().exec(cmd.toArray(new String[cmd.size()]), EnvironmentUtil.getEnvironment()); }
catch (IOException ex) { Messages.showErrorDialog(project, PerforceBundle.message("p4v.run.failed", ex.getMessage()), "P4V"); }
}

@NonNls
protected String getCommandName() { return "tree"; }

@Override
public void update(final AnActionEvent e) {
final Project project = e.getData(DataKeys.PROJECT);
final VirtualFile virtualFile = e.getData(DataKeys.VIRTUAL_FILE);
if (project == null || virtualFile == null || !virtualFile.isInLocalFileSystem()) { e.getPresentation().setEnabled(false); }
else { FileStatus fileStatus = FileStatusManager.getInstance(project).getStatus(virtualFile); e.getPresentation().setEnabled(fileStatus != FileStatus.ADDED && fileStatus != FileStatus.UNKNOWN && fileStatus != FileStatus.IGNORED); }
}


Chuck Canning - 29 Jan 08 05:16
Can you re-open this issue. The command.append("\""); needs to be removed. Problem with copying code from one class to another. It adds an extra " to the end which it doesn't like.