Ubuntu Pastebin

Paste from darin at Sat, 14 Jan 2017 20:04:04 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
diff --git a/lib/git_checks.py b/lib/git_checks.py
index 7dca8a2..1be7802 100644
--- a/lib/git_checks.py
+++ b/lib/git_checks.py
@@ -21,22 +21,23 @@ def kubuntuCheckValidBranch(distribution=None):
     git_repo = Repo('.')
     branch_name = str(git_repo.active_branch)
     branch_name_parts = branch_name.split('_')
+    warning = ''
     try:
         kubuntu = branch_name_parts[0]
         branch_dist = branch_name_parts[1]
         target = branch_name_parts[2]
         if kubuntu != "kubuntu":
-            print("Current branch '%s' is not a Kubuntu branch" % branch_name)
-            sys.exit(1)
+            warning = "Current branch '%s' is not a Kubuntu branch" % branch_name
         if target not in ["archive","backports"]:
-            print("Current branch '%s' is not an archive or backports Kubuntu branch" % branch_name)
-            sys.exit(1)
+            warning += '\n'+ "Current branch '%s' is not an archive or backports Kubuntu branch" % branch_name
         if (distribution != None) and (distribution != branch_dist):
-            print("Current branch '%s' is not a valid branch for distribution '%s'" % (branch_name,distribution))
-            sys.exit(1)
+            warning = '\n'+ "Current branch '%s' is not a valid branch for distribution '%s'" % (branch_name,distribution)
     except Exception:
         if branch_name != "master":
-            print("Couldn't find out distribution name for branch '%s'" % branch_name)
+            warning = "Couldn't find out distribution name for branch '%s'" % branch_name
+    if warning != '':
+        ui = input(warning + '\nContinue anyway y/N :') + ' '
+        if ui.lower()[0] != 'y':
             sys.exit(1)
 
 #Check if the current branch has changes not pushed to git
Download as text