Merge branch 'master' into amakeev/build-number
authorAnton Makeev <Anton.Makeev@jetbrains.com>
Thu, 7 Apr 2016 08:58:23 +0000 (10:58 +0200)
committerAnton Makeev <Anton.Makeev@jetbrains.com>
Thu, 7 Apr 2016 08:58:23 +0000 (10:58 +0200)
1  2 
community-resources/src/idea/IdeaApplicationInfo.xml
platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateInfoDialog.java
platform/util/src/com/intellij/openapi/util/BuildNumber.java
platform/util/testSrc/com/intellij/openapi/util/BuildNumberTest.java
python/educational-python/resources/idea/PyCharmEduApplicationInfo.xml
python/python-community-ide-resources/resources/idea/PyCharmCoreApplicationInfo.xml

index 62f2e6878f1ceca6cb893ca8d99c96fd59e9befa,500ea220abffd8d5c62827d0cafbd59219a62c9a..a78f5cae00fd2a4cb4d6ae0d5271aa6fd6c97ab8
@@@ -1,8 -1,7 +1,7 @@@
  <component>
 -  <version codename="Community Edition 2016.2" major="2016" minor="2" eap="true"/>
 +  <version codename="Community Edition" major="2016" minor="2" eap="true"/>
    <company name="JetBrains s.r.o." url="https://www.jetbrains.com/?fromIDE"/>
    <build number="__BUILD_NUMBER__" date="__BUILD_DATE__"/>
-   <install-over minbuild="129.1" maxbuild="139.9999" version="14"/>
    <logo url="/idea_community_logo.png" textcolor="444444" progressColor="f87206" progressX="0" progressY="271" progressHeight="3" licenseOffsetY="30" />
    <about url="/idea_community_about.png" foreground="444444" copyrightForeground="7A858F" linkColor="9b5121" logoX="300" logoY="265" logoW="75" logoH="30"/>
    <icon size32="/icon_CE.png" size16="/icon_CEsmall.png" size128="/icon_CE_128.png" ico="idea_CE.ico"/>
index cde24cfca881d99787417bac96392e4e0d48ecd5,36e0f2c5583c6bb5b23a4a079b37f0a23be3877d..73efdf0a16ffadb544968e41f495829f139141ad
@@@ -99,11 -89,11 +99,11 @@@ public class BuildNumber implements Com
    }
  
    public static BuildNumber fromString(String version, @Nullable String name) {
-     if (version == null) return null;
+     if (StringUtil.isEmptyOrSpaces(version)) return null;
  
 -    if (BUILD_NUMBER.equals(version)) {
 +    if (BUILD_NUMBER.equals(version) || SNAPSHOT.equals(version)) {
        final String productCode = name != null ? name : "";
 -      return new BuildNumber(productCode, Holder.TOP_BASELINE_VERSION, Integer.MAX_VALUE);
 +      return new BuildNumber(productCode, Holder.CURRENT_VERSION.getFormat(), Holder.CURRENT_VERSION.myComponents);
      }
  
      String code = version;
    }
  
    public boolean isSnapshot() {
 -    return myBuildNumber == Integer.MAX_VALUE;
 -  }
 -
 -  public String asStringWithAllDetails() {
 -    return asString(true, true);
 +    for (int each : myComponents) {
 +      if (each == SNAPSHOT_VALUE) return true;
 +    }
 +    return false;
    }
- }
+ }
index 02e35329723c623536f974357657c538eb861e35,c2283c4fa02a0de5a2b5c947b9101cc673aa468b..c0c73c33c950ee348ab4cad85db8b287fb1c3f98
@@@ -19,89 -19,19 +19,95 @@@ import org.junit.Test
  
  import static org.junit.Assert.*;
  
 -/**
 - * @author max
 - */
  public class BuildNumberTest {
+   @Test
+   public void empty() {
+     assertNull(BuildNumber.fromString(null));
+     assertNull(BuildNumber.fromString(" "));
+   }
    @Test
    public void historicBuild() {
 -    assertEquals(new BuildNumber("", 75, 7512), BuildNumber.fromString("7512"));
 +    assertEquals(new BuildNumber("", BuildNumber.Format.HISTORIC, 75, 7512), BuildNumber.fromString("7512"));
 +    assertEquals("75.7512", BuildNumber.fromString("7512").asString());
 +  }
 +
 +  @Test
 +  public void branchBasedBuild() throws Exception {
 +    assertParsed(BuildNumber.fromString("145"), 145, 0, BuildNumber.Format.BRANCH_BASED, "145.0");
 +    assertParsed(BuildNumber.fromString("145.1"), 145, 1, BuildNumber.Format.BRANCH_BASED, "145.1");
 +    assertParsed(BuildNumber.fromString("145.1.2"), 145, 1, BuildNumber.Format.BRANCH_BASED, "145.1.2");
 +    assertParsed(BuildNumber.fromString("IU-145.1.2"), 145, 1, BuildNumber.Format.BRANCH_BASED, "IU-145.1.2");
 +    assertParsed(BuildNumber.fromString("IU-145.SNAPSHOT"), 145, BuildNumber.SNAPSHOT_VALUE, BuildNumber.Format.BRANCH_BASED, "IU-145.SNAPSHOT");
 +    assertParsed(BuildNumber.fromString("IU-145.1.SNAPSHOT"), 145, 1, BuildNumber.Format.BRANCH_BASED, "IU-145.1.SNAPSHOT");
 +  }
 +
 +  @Test
 +  public void yearBasedBuild() throws Exception {
 +    assertParsed(BuildNumber.fromString("2016"), 20160, -1, BuildNumber.Format.YEAR_BASED, "2016.0");
 +    assertParsed(BuildNumber.fromString("2016.1"), 20161, -1, BuildNumber.Format.YEAR_BASED, "2016.1");
 +    assertParsed(BuildNumber.fromString("2016.1.2"), 20161, -1, BuildNumber.Format.YEAR_BASED, "2016.1.2");
 +    assertParsed(BuildNumber.fromString("IU-2016.1.2"), 20161, -1, BuildNumber.Format.YEAR_BASED, "IU-2016.1.2");
 +    assertParsed(BuildNumber.fromString("2016.1.2.3"), 20161, -1, BuildNumber.Format.YEAR_BASED, "2016.1.2.3");
 +    assertParsed(BuildNumber.fromString("IU-2016.1.2.3"), 20161, -1, BuildNumber.Format.YEAR_BASED, "IU-2016.1.2.3");
 +    assertParsed(BuildNumber.fromString("2016.1.2.3.4"), 20161, -1, BuildNumber.Format.YEAR_BASED, "2016.1.2.3.4");
 +    assertParsed(BuildNumber.fromString("IU-2016.1.2.3.4"), 20161, -1, BuildNumber.Format.YEAR_BASED, "IU-2016.1.2.3.4");
 +    
 +    assertParsed(BuildNumber.fromString("IU-2016.1.SNAPSHOT"), 20161, -1, BuildNumber.Format.YEAR_BASED, "IU-2016.1.SNAPSHOT");
 +    assertParsed(BuildNumber.fromString("IU-2016.1.SNAPSHOT.1"), 20161, -1, BuildNumber.Format.YEAR_BASED, "IU-2016.1.SNAPSHOT.1");
 +  }
 +  
 +  private static void assertParsed(BuildNumber n, int expectedBaseline, int expectedBuildNumber, BuildNumber.Format based, String asString) {
 +    assertEquals(expectedBaseline, n.getBaselineVersion());
 +    assertEquals(expectedBuildNumber, n.getBuildNumber());
 +    assertEquals(asString, n.asString());
 +    assertEquals(based, n.getFormat());
 +  }
 +
 +  @Test
 +  public void comparingVersion() throws Exception {
 +    assertTrue(BuildNumber.fromString("2016").compareTo(BuildNumber.fromString("2016.1")) < 0);
 +    assertTrue(BuildNumber.fromString("2015.1").compareTo(BuildNumber.fromString("2016")) < 0);
 +    assertTrue(BuildNumber.fromString("2016.0").compareTo(BuildNumber.fromString("2016.0")) == 0);
 +    
 +    assertTrue(BuildNumber.fromString("2016.1").compareTo(BuildNumber.fromString("2016.1")) == 0);
 +    assertTrue(BuildNumber.fromString("2016.1.1").compareTo(BuildNumber.fromString("2016.1.1")) == 0);
 +    assertTrue(BuildNumber.fromString("2016.1.1.1").compareTo(BuildNumber.fromString("2016.1.1.1")) == 0);
 +    
 +    assertTrue(BuildNumber.fromString("2016.1").compareTo(BuildNumber.fromString("2016.1.1")) < 0);
 +    assertTrue(BuildNumber.fromString("2016.1").compareTo(BuildNumber.fromString("2016.1.1.1")) < 0);
 +    assertTrue(BuildNumber.fromString("2016.1.1").compareTo(BuildNumber.fromString("2016.1.1.1")) < 0);
 +
 +    assertTrue(BuildNumber.fromString("2016.1").compareTo(BuildNumber.fromString("2016.2")) < 0);
 +    assertTrue(BuildNumber.fromString("2016.1").compareTo(BuildNumber.fromString("2016.2.1")) < 0);
 +    assertTrue(BuildNumber.fromString("2016.1.1").compareTo(BuildNumber.fromString("2016.2")) < 0);
 +    assertTrue(BuildNumber.fromString("2016.1.1").compareTo(BuildNumber.fromString("2016.2.1")) < 0);
 +
 +    assertTrue(BuildNumber.fromString("146.1").compareTo(BuildNumber.fromString("2016.1")) < 0);
 +    assertTrue(BuildNumber.fromString("146.9.9").compareTo(BuildNumber.fromString("2016.1")) < 0);
 +    
 +    assertTrue(BuildNumber.fromString("2016.2").compareTo(BuildNumber.fromString("2016.2.*")) < 0);
 +    assertTrue(BuildNumber.fromString("2016.2").compareTo(BuildNumber.fromString("2016.3.*")) < 0);
 +    assertTrue(BuildNumber.fromString("2016.2").compareTo(BuildNumber.fromString("2016.1.*")) > 0);
 +    assertTrue(BuildNumber.fromString("2016.2.2.2.2").compareTo(BuildNumber.fromString("2016.2.*")) < 0);
 +    assertTrue(BuildNumber.fromString("2016.2.*").compareTo(BuildNumber.fromString("2016.2.2.2.2")) > 0);
 +
 +    assertTrue(BuildNumber.fromString("145.1").compareTo(BuildNumber.fromString("145.*")) < 0);
 +    assertTrue(BuildNumber.fromString("145.1.1").compareTo(BuildNumber.fromString("145.*")) < 0);
 +    assertTrue(BuildNumber.fromString("145.1").compareTo(BuildNumber.fromString("146.*")) < 0);
 +    assertTrue(BuildNumber.fromString("145.1").compareTo(BuildNumber.fromString("144.*")) > 0);
 +
 +    assertTrue(BuildNumber.fromString("145.SNAPSHOT").compareTo(BuildNumber.fromString("145.*")) == 0);
 +    assertTrue(BuildNumber.fromString("145.*").compareTo(BuildNumber.fromString("145.SNAPSHOT")) == 0);
 +
 +    assertTrue(BuildNumber.fromString("2016.1.SNAPSHOT").compareTo(BuildNumber.fromString("2016.1.*")) == 0);
 +    assertTrue(BuildNumber.fromString("2016.1.*").compareTo(BuildNumber.fromString("2016.1.SNAPSHOT")) == 0);
 +    
 +    assertTrue(BuildNumber.fromString("2016.1.SNAPSHOT").compareTo(BuildNumber.fromString("2016.*")) < 0);
 +    assertTrue(BuildNumber.fromString("2016.*").compareTo(BuildNumber.fromString("2016.1.SNAPSHOT")) > 0);
 +
 +    assertTrue(BuildNumber.fromString("2016.SNAPSHOT").compareTo(BuildNumber.fromString("2016.1.*")) > 0);
 +    assertTrue(BuildNumber.fromString("2016.1.*").compareTo(BuildNumber.fromString("2016.SNAPSHOT")) < 0);
    }
  
    @Test
      assertTrue(BuildNumber.fromString("IU-90.SNAPSHOT").compareTo(BuildNumber.fromString("RM-100.12345")) < 0);
      assertTrue(BuildNumber.fromString("IU-90.SNAPSHOT").compareTo(BuildNumber.fromString("RM-100.SNAPSHOT")) < 0);
      assertTrue(BuildNumber.fromString("IU-90.SNAPSHOT").compareTo(BuildNumber.fromString("RM-90.SNAPSHOT")) == 0);
 +    
 +    assertTrue(BuildNumber.fromString("2016.1.SNAPSHOT").compareTo(BuildNumber.fromString("2016.1.1")) > 0);
 +    assertTrue(BuildNumber.fromString("2016.1.1").compareTo(BuildNumber.fromString("2016.1.SNAPSHOT")) < 0);
 +    
 +    assertTrue(BuildNumber.fromString("2016.1.SNAPSHOT").compareTo(BuildNumber.fromString("2016.1.SNAPSHOT")) == 0);
 +    
 +    assertTrue(BuildNumber.fromString("2016.1.1.SNAPSHOT").compareTo(BuildNumber.fromString("2016.1.1.1")) > 0);
 +    assertTrue(BuildNumber.fromString("2016.1.1.1").compareTo(BuildNumber.fromString("2016.1.1.SNAPSHOT")) < 0);
 +    
 +    assertTrue(BuildNumber.fromString("2016.1.1.SNAPSHOT").compareTo(BuildNumber.fromString("2016.1.1.SNAPSHOT")) == 0);
 +    
 +    assertTrue(BuildNumber.fromString("2016.1.SNAPSHOT.1").compareTo(BuildNumber.fromString("2016.1.1.1")) > 0);
 +    assertTrue(BuildNumber.fromString("2016.1.1.1").compareTo(BuildNumber.fromString("2016.1.SNAPSHOT.1")) < 0);
 +    
 +    assertTrue(BuildNumber.fromString("2016.1.SNAPSHOT.1").compareTo(BuildNumber.fromString("2016.1.1.SNAPSHOT")) > 0);
 +    assertTrue(BuildNumber.fromString("2016.1.1.SNAPSHOT").compareTo(BuildNumber.fromString("2016.1.SNAPSHOT.1")) < 0);
 +    
 +    assertTrue(BuildNumber.fromString("2016.1.SNAPSHOT.1").compareTo(BuildNumber.fromString("2016.1.SNAPSHOT.SNAPSHOT")) == 0);
 +    assertTrue(BuildNumber.fromString("2016.1.SNAPSHOT.SNAPSHOT").compareTo(BuildNumber.fromString("2016.1.SNAPSHOT.1")) == 0);
 +  }
 +
 +  @Test
 +  public void fallbackVersion() throws Exception {
 +    assertParsed(BuildNumber.fallback(), 29991, -1, BuildNumber.Format.YEAR_BASED, "2999.1.SNAPSHOT");
 +    assertEquals(BuildNumber.Format.YEAR_BASED, BuildNumber.fallback().getFormat());
 +    assertTrue(BuildNumber.fallback().isSnapshot());
 +    
 +    assertTrue(BuildNumber.fallback().compareTo(BuildNumber.fromString("7512")) > 0);
 +    assertTrue(BuildNumber.fallback().compareTo(BuildNumber.fromString("145")) > 0);
 +    assertTrue(BuildNumber.fallback().compareTo(BuildNumber.fromString("145.12")) > 0);
 +    assertTrue(BuildNumber.fallback().compareTo(BuildNumber.fromString("2016.1")) > 0);
 +    assertTrue(BuildNumber.fallback().compareTo(BuildNumber.fromString("2016.1.2")) > 0);
    }
- }
+ }