[Python-checkins] release: Add a check for the correct branch when tagging.

georg.brandl python-checkins at python.org
Sun May 8 10:09:43 CEST 2011


http://hg.python.org/release/rev/55798757d032
changeset:   57:55798757d032
user:        Georg Brandl <georg at python.org>
date:        Sun May 08 10:09:39 2011 +0200
summary:
  Add a check for the correct branch when tagging.

files:
  release.py |  10 ++++++++++
  1 files changed, 10 insertions(+), 0 deletions(-)


diff --git a/release.py b/release.py
--- a/release.py
+++ b/release.py
@@ -45,6 +45,10 @@
         return code
 
 
+def get_output(args):
+    return subprocess.check_output(SPACE.join(args), shell=True)
+
+
 def check_env():
     if 'EDITOR' not in os.environ:
         error('editor not detected.',
@@ -362,6 +366,12 @@
 
 
 def make_tag(tag):
+    # make sure we're on the correct branch
+    if tag.patch > 0:
+        if get_output(['hg', 'branch']).strip().decode() != tag.basic_version:
+            print('It doesn\'t look like you\'re on the correct branch.')
+            if input('Are you sure you want to tag?') != "y":
+                return
     run_cmd(['hg', 'tag', tag.hgname])
 
 

-- 
Repository URL: http://hg.python.org/release


More information about the Python-checkins mailing list