Tetsuya Morimoto avatar Tetsuya Morimoto committed 57e0d4a

fixed to pick up reference ticket ID in comment from 2nd line

Comments (0)

Files changed (1)


 import re
 _RE_REFS_WITH_IDS = re.compile(r"""
-    ^.*?(?P<ref_text>(ref.*?)\s+(\#\d+[,|\s]*){1,})
-""", re.U | re.X)
+    (?P<ref_text>(ref.*?)\s+(\#\d+[,|\s]*){1,})
+""", re.U | re.M | re.X)
 def get_refs_in_comment(comment):
     """ pick out reference text and convert text to ids
     >>> get_refs_in_comment(u"reference#1 #3, #5")
     set([1, 3, 5])
+    >>> get_refs_in_comment(u"adding.\\nrefs #1")
+    set([1])
+    >>> get_refs_in_comment(u"adding.\\nrefs #1 #3, #5")
+    set([1, 3, 5])
+    >>> get_refs_in_comment(u"adding.\\nsecond\\nrefs #2")
+    set([2])
     ref_ids = set([])
-    match = re.match(_RE_REFS_WITH_IDS, comment)
+    match = re.search(_RE_REFS_WITH_IDS, comment)
     if match:
         ref_text = match.groupdict().get("ref_text")
         ref_ids = get_ref_ids_in_comment(ref_text)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.