[meld] maint: Check that we're on a release branch before pulling
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] maint: Check that we're on a release branch before pulling
- Date: Sat, 23 Aug 2014 04:18:26 +0000 (UTC)
commit 2235becb57678c2d19fe316c62ea249c412841f2
Author: Kai Willadsen <kai willadsen gmail com>
Date: Fri Aug 22 08:09:39 2014 +1000
maint: Check that we're on a release branch before pulling
maint.py | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/maint.py b/maint.py
index eb9a102..9bf901f 100755
--- a/maint.py
+++ b/maint.py
@@ -3,6 +3,7 @@
import collections
import datetime
import os
+import re
import subprocess
import click
@@ -12,6 +13,7 @@ import meld.conf
PO_DIR = "po"
HELP_DIR = "help"
+RELEASE_BRANCH_RE = r'%s-\d+-\d+' % meld.conf.__package__
NEWS_TEMPLATE = """
{{ [date, app, version]|join(' ') }}
@@ -228,6 +230,16 @@ def call_with_output(cmd, stdin_text=None, echo_stdout=True):
click.secho('\n' + stderr.decode('utf-8'), fg='red')
+def check_release_branch():
+ cmd = ['git', 'rev-parse', '--abbrev-ref', 'HEAD']
+ branch = subprocess.check_output(cmd).strip().decode('utf-8')
+ if branch != 'master' and not re.match(RELEASE_BRANCH_RE, branch):
+ click.echo(
+ '\nBranch "%s" doesn\'t appear to be a release branch.\n' % branch)
+ click.confirm('Are you sure you wish to continue?', abort=True)
+ return branch
+
+
@click.group()
def cli():
pass
@@ -252,6 +264,11 @@ def markdown():
@cli.command()
+def pull():
+ branch = check_release_branch()
+
+
+ cli command()
def dist():
archive = '%s-%s.tar.bz2' % (meld.conf.__package__, meld.conf.__version__)
dist_archive_path = os.path.abspath(os.path.join('dist', archive))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]