Benoît Allard avatar Benoît Allard committed c251c46

integrate with the b extension

Comments (0)

Files changed (1)

 
 from math import exp
 
-from mercurial import cmdutil, scmutil, commands
+from mercurial import cmdutil, scmutil, commands, extensions
 from mercurial.i18n import _
 from mercurial.node import nullrev
 from mercurial.match import match
     print "Mercurial version too old, please upgrade to at least 1.9"
     raise
 
+def getb():
+    try:
+        b = extensions.find('b')
+    except KeyError:
+        return None
+    if b is None:
+        return None
+    bversionfunc = getattr(b, 'version')
+    if bversionfunc is None:
+        return None
+    if bversionfunc() < bversionfunc('0.6.2'):
+        return None
+    return b
+
 @command('hotfiles',
          [('r', 'rev', '', _('operate up to a given revision'), 'REV'),
           ('p', 'pattern', '', _('pattern to filter issue-fixing commits'),
     ui.debug('using %s as pattern to filter changesets\n' % pattern)
     r = re.compile(pattern)
 
+    b = getb()
+
     excludeglob = ui.configlist('hotfiles', 'exclude.glob', [])
     excludeglob.extend(opts.get('exclude', []))
+    if b is not None:
+        excludeglob.append(b.bugs_dir(ui))
     includeglob = ui.configlist('hotfiles', 'include.glob', [])
     includeglob.extend(opts.get('include', []))
     m = match(repo.root, '', None, exclude=excludeglob, include=includeglob)
             continue
         if not (r.search(ctx.description())):
             continue
+        if b is not None and not b.is_bugfix_rev(ui, repo, ctx.rev()):
+            continue
 
         t = ti(*ctx.date())
 
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.