Perforce Changelist Number

I'm developing a CommitExecutor plugin so that instead of submitting directly to perforce my developers can submit to a remote machine that scrubs the changelist (checks for build breakages, etc) and then submits it perforce on their behalf.  We force people to do this but currently they have to use an ant target.  it would be nice if it were integrated into intellij so that they could get the the advantages of code analysis, etc.

I have an instance of LocalChangeList but I can't figure out how to go from there to the changelist number (which is required by my remote process).

How do I determine the perfoce changelist number of a changelist?   I know it is available because I can see it displayed in the changes UI.

Thanks,
-G

3 comments
Comment actions Permalink

Ok.  I worked out a solution.    I figured out how to depend on the perforce plugin and then I just fstat the first file in the change.  

Is there a better way or is this it?


       @Override
        public boolean canExecute(Collection<Change> changes, String commitMessage) {
            return changes != null && !changes.isEmpty();
        }

        @Override
        public void execute(Collection<Change> changes, String commitMessage) {
            Change c = changes.iterator().next();

            PerforceVcs vcs = PerforceVcs.getInstance(parent.project);
            P4File file = P4File.create(c.getVirtualFile());
            try {
                String changelist = vcs.getFstatSafe(file).change;

0
Comment actions Permalink

I'm trying to write a similar plugin where I need the perforce changelist number.  How were you able to depend on the perforce plugin?

0
Comment actions Permalink

I just added a "depends" to my plugin.xml file.  Like this....

<idea-plugin version="2">

     ..........  

  <depends>PerforceDirectPlugin</depends>

</idea-plugin>

0

Please sign in to leave a comment.