diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgLogProvider.java b/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgLogProvider.java index 84b070ea35c6..9554e9c59165 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgLogProvider.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgLogProvider.java @@ -38,6 +38,8 @@ import org.zmlx.hg4idea.util.HgUtil; import java.text.SimpleDateFormat; import java.util.*; +import static org.zmlx.hg4idea.util.HgUtil.TIP_REFERENCE; + public class HgLogProvider implements VcsLogProvider { private static final Logger LOG = Logger.getInstance(HgLogProvider.class); @@ -47,8 +49,6 @@ public class HgLogProvider implements VcsLogProvider { @NotNull private final VcsLogRefManager myRefSorter; @NotNull private final VcsLogObjectsFactory myVcsObjectsFactory; - private static final String RECENT_HEAD = "tip"; - public HgLogProvider(@NotNull Project project, @NotNull HgRepositoryManager repositoryManager, @NotNull VcsLogObjectsFactory factory) { myProject = project; myRepositoryManager = repositoryManager; @@ -119,7 +119,7 @@ public class HgLogProvider implements VcsLogProvider { } String currentRevision = repository.getCurrentRevision(); if (currentRevision != null) { // null => fresh repository - refs.add(myVcsObjectsFactory.createRef(myVcsObjectsFactory.createHash(currentRevision), RECENT_HEAD, HgRefManager.HEAD, root)); + refs.add(myVcsObjectsFactory.createRef(myVcsObjectsFactory.createHash(currentRevision), TIP_REFERENCE, HgRefManager.HEAD, root)); } for (HgNameWithHashInfo tagInfo : tags) { refs.add(myVcsObjectsFactory.createRef(tagInfo.getHash(), tagInfo.getName(), HgRefManager.TAG, root)); @@ -172,7 +172,7 @@ public class HgLogProvider implements VcsLogProvider { boolean atLeastOneBranchExists = false; for (String branchName : filterCollection.getBranchFilter().getBranchNames()) { - if (branchName.equals(RECENT_HEAD) || branchExists(repository, branchName)) { + if (branchName.equals(TIP_REFERENCE) || branchExists(repository, branchName)) { filterParameters.add(prepareParameter("branch", branchName)); atLeastOneBranchExists = true; } diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgCommonDialogWithChoices.java b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgCommonDialogWithChoices.java index 4c7ff6214e94..2c28d4c500ed 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgCommonDialogWithChoices.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgCommonDialogWithChoices.java @@ -31,6 +31,8 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Collection; +import static org.zmlx.hg4idea.util.HgUtil.TIP_REFERENCE; + public class HgCommonDialogWithChoices extends DialogWrapper { @@ -119,7 +121,8 @@ public class HgCommonDialogWithChoices extends DialogWrapper { HgRepository repo = hgRepositorySelectorComponent.getRepository(); branchSelector.setModel(new DefaultComboBoxModel(repo.getOpenedBranches().toArray())); DefaultComboBoxModel tagComboBoxModel = new DefaultComboBoxModel(HgUtil.getNamesWithoutHashes(repo.getTags()).toArray()); - tagComboBoxModel.addElement("tip"); //HgRepository does not store 'tip' tag because it is internal and not included in tags file + tagComboBoxModel + .addElement(TIP_REFERENCE); //HgRepository does not store 'tip' tag because it is internal and not included in tags file tagSelector.setModel(tagComboBoxModel); bookmarkSelector.setModel(new DefaultComboBoxModel(HgUtil.getNamesWithoutHashes(repo.getBookmarks()).toArray())); update(); diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/util/HgUtil.java b/plugins/hg4idea/src/org/zmlx/hg4idea/util/HgUtil.java index ad1ad6197ed7..0f3cc45cfd7d 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/util/HgUtil.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/util/HgUtil.java @@ -72,6 +72,7 @@ public abstract class HgUtil { public static final int MANY_FILES = 100; private static final Logger LOG = Logger.getInstance(HgUtil.class); public static final String DOT_HG = ".hg"; + public static final String TIP_REFERENCE = "tip"; public static File copyResourceToTempFile(String basename, String extension) throws IOException { final InputStream in = HgUtil.class.getClassLoader().getResourceAsStream("python/" + basename + extension);