We got nominated! Help us out and vote for GitHub as Best Bootstrapped Startup of 2008. (You can vote once a day.) [ hide ]

public
Description: Git support for IntelliJ
Clone URL: git://github.com/Fudge/gitidea.git
Fudge (author)
Wed Apr 09 02:18:54 -0700 2008
commit  5d9d9d4ba40ab77735827dfdd578e73ba0dbaf33
tree    b57c0e6a536ca4651d20de2eb0b4b55817602778
gitidea / src / com / aspiro / git / actions / GitTag.java
100644 75 lines (64 sloc) 2.438 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package com.aspiro.git.actions;
 
import com.aspiro.git.GitUtil;
import com.aspiro.git.GitVcs;
import com.aspiro.git.commands.GitCommand;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.vcs.AbstractVcs;
import com.intellij.openapi.vcs.ProjectLevelVcsManager;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
 
import java.util.List;
 
/**
* Created by IntelliJ IDEA.
* User: mike.aizatsky
* Date: Jul 19, 2007
* Time: 9:25:44 AM
*
* Modified for Git by Erlend Simonsen
* <p/>
* Copyright 2007 Decentrix Inc
* Copyright 2007 Aspiro AS
* <p/>
* 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
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* 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.
*/
public class GitTag extends BasicAction
{
  public void perform( @NotNull Project project, GitVcs vcs, @NotNull List<VcsException> exceptions,
   @NotNull VirtualFile[] affectedFiles ) throws VcsException
  {
    saveAll();
 
    if( !ProjectLevelVcsManager.getInstance( project ).checkAllFilesAreUnder( vcs, affectedFiles ) )
      return;
 
 
    final String tagName = Messages.showInputDialog( project, "Specify tag name", "Tag", Messages.getQuestionIcon() );
    if( tagName == null )
      return;
 
        //todo: support multiple roots?
        GitCommand command = new GitCommand(
                project,
                vcs.getSettings() ,
                GitUtil.getVcsRoot(project, affectedFiles[0]));
 
        final String output = command.tag( tagName );
    if( output.trim().length() != 0 )
    {
      Messages.showInfoMessage( project, output, "Result" );
    }
  }
 
  @NotNull
  protected String getActionName( @NotNull AbstractVcs abstractvcs )
  {
    return "Tag";
  }
 
  protected boolean isEnabled( @NotNull Project project, @NotNull GitVcs vcs, @NotNull VirtualFile... vFiles )
  {
    return true;
  }
}