Pull properly reads the issue number from the current branch
authorFrederic Massart <fred@moodle.com>
Wed, 20 Feb 2013 07:54:31 +0000 (15:54 +0800)
committerFrederic Massart <fred@moodle.com>
Wed, 20 Feb 2013 07:54:31 +0000 (15:54 +0800)
moodle-pull.py

index dc8a876..4668100 100755 (executable)
@@ -49,7 +49,15 @@ if args.testing and args.integration:
     sys.exit(1)
 
 # Tracker issue number.
-issue = re.sub(r'(MDL|mdl)(-|_)?', '', args.issue)
+issuenb = args.issue
+if not issuenb:
+    parsedbranch = tools.parseBranch(M.currentBranch(), C.get('wording.branchRegex'))
+    if not parsedbranch:
+        debug('Could not extract issue number from %s' % M.currentBranch())
+        sys.exit(1)
+    issuenb = parsedbranch['issue']
+
+issue = re.sub(r'(MDL|mdl)(-|_)?', '', issuenb)
 mdl = 'MDL-' + issue
 
 # Reading the information about the current instance.