Version 1.0.1.2 dev channel.

svn merge -c 30581,30620,30623,30625 https://dart.googlecode.com/svn/branches/bleeding_edge trunk

git-svn-id: http://dart.googlecode.com/svn/trunk@30653 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/tools/VERSION b/tools/VERSION
index b1368da..2225f83 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -1,4 +1,5 @@
+CHANNEL dev
 MAJOR 1
 MINOR 0
 BUILD 1
-PATCH 1
+PATCH 2
diff --git a/tools/create_editor.py b/tools/create_editor.py
index 59fb6c8..086c119 100644
--- a/tools/create_editor.py
+++ b/tools/create_editor.py
@@ -194,6 +194,7 @@
       '-Dbuild.source=' + os.path.abspath('editor'),
       '-Dbuild.dart.sdk=' + GetSdkPath(),
       '-Dbuild.no.properties=true',
+      '-Dbuild.channel=' + utils.GetChannel(),
       '-buildfile',
       buildScript]
   print build_cmd
diff --git a/tools/publish_barback.py b/tools/publish_barback.py
index 58ca64a..a4b9c3d 100755
--- a/tools/publish_barback.py
+++ b/tools/publish_barback.py
@@ -20,31 +20,22 @@
 
 import os
 import os.path
-import re
 import shutil
 import sys
 import subprocess
 import tempfile
 
-def ReadVersion(file, field):
-  for line in open(file).read().split('\n'):
-    [k, v] = re.split('\s+', line)
-    if field == k:
-      return int(v)
+import utils
 
 def Main(argv):
   HOME = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
   BARBACK = os.path.join(HOME, 'pkg', 'barback')
 
-  versionFile = os.path.join(HOME, 'tools', 'VERSION')
-  major = ReadVersion(versionFile, 'MAJOR')
-  minor = ReadVersion(versionFile, 'MINOR')
-  build = ReadVersion(versionFile, 'BUILD')
-  patch = ReadVersion(versionFile, 'PATCH')
+  (channel, major, minor, build, patch) = utils.ReadVersionFile()
 
   # The bleeding_edge branch has a fixed version number of 0.1.x.y. Don't allow
   # users to publish packages from there.
-  if major == 0 and minor <= 1:
+  if (major == 0 and minor <= 1) or channel == 'be':
     print 'Error: Do not run this script from a bleeding_edge checkout.'
     return -1
 
diff --git a/tools/utils.py b/tools/utils.py
index b582c9e..ab83b46 100644
--- a/tools/utils.py
+++ b/tools/utils.py
@@ -234,7 +234,8 @@
 # Return the base part of the version, Major.Minor.Build.Patch,
 # without the _revision addition
 def GetShortVersion():
-  (major, minor, build, patch) = ReadVersionFile()
+  (channel, major, minor, build, patch) = ReadVersionFile()
+  # TODO(kustermann/ricow): Add the channel to the version string.
   return '%s.%s.%s.%s' % (major, minor, build, patch)
 
 
@@ -243,7 +244,7 @@
   if not version_tuple:
     return None
 
-  (major, minor, build, patch) = version_tuple
+  (channel, major, minor, build, patch) = version_tuple
   revision = GetSVNRevision()
   user = GetUserName()
   # We don't add username to release builds (or any builds on the bots)
@@ -257,9 +258,14 @@
   if revision:
     revision_string = '_r%s' % revision
 
+  # TODO(kustermann/ricow): Add the channel to the version string.
   return ("%s.%s.%s.%s%s%s" %
           (major, minor, build, patch, revision_string, user_string))
 
+def GetChannel():
+  (channel, _, _, _, _) = ReadVersionFile()
+  return channel
+
 def GetUserName():
   key = 'USER'
   if sys.platform == 'win32':
@@ -275,13 +281,19 @@
   except:
     print "Warning: Couldn't read VERSION file (%s)" % version_file
     return None
-  major_match = re.search('MAJOR (\d+)', content)
-  minor_match = re.search('MINOR (\d+)', content)
-  build_match = re.search('BUILD (\d+)', content)
-  patch_match = re.search('PATCH (\d+)', content)
-  if major_match and minor_match and build_match and patch_match:
-    return (major_match.group(1), minor_match.group(1), build_match.group(1),
-            patch_match.group(1))
+  channel_match = re.search(
+      '^CHANNEL ([A-Za-z0-9]+)$', content, flags=re.MULTILINE)
+  major_match = re.search('^MAJOR (\d+)$', content, flags=re.MULTILINE)
+  minor_match = re.search('^MINOR (\d+)$', content, flags=re.MULTILINE)
+  build_match = re.search('^BUILD (\d+)$', content, flags=re.MULTILINE)
+  patch_match = re.search('^PATCH (\d+)$', content, flags=re.MULTILINE)
+  if (channel_match and
+      major_match and
+      minor_match and
+      build_match and
+      patch_match):
+    return (channel_match.group(1), major_match.group(1), minor_match.group(1),
+            build_match.group(1), patch_match.group(1))
   else:
     print "Warning: VERSION file (%s) has wrong format" % version_file
     return None