Print this page
OS-1823 git-pbchk should not depend on mercurial

@@ -15,10 +15,11 @@
 #
 
 #
 # Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
 # Copyright 2008, 2012 Richard Lowe
+# Copyright (c) 2013, Joyent Inc. All rights reserved.
 #
 
 import getopt
 import os
 import re

@@ -26,14 +27,10 @@
 import sys
 import tempfile
 
 from cStringIO import StringIO
 
-# This is necessary because, in a fit of pique, we used hg-format ignore lists
-# for NOT files.
-from mercurial import ignore
-
 #
 # Adjust the load path based on our location and the version of python into
 # which it is being loaded.  This assumes the normal onbld directory
 # structure, where we are in bin/ and the modules are in
 # lib/python(version)?/onbld/Scm/.  If that changes so too must this.

@@ -45,10 +42,11 @@
 # Add the relative path to usr/src/tools to the load path, such that when run
 # from the source tree we use the modules also within the source tree.
 #
 sys.path.insert(2, os.path.join(os.path.dirname(__file__), ".."))
 
+from onbld.Scm import Ignore
 from onbld.Checks import Comments, Copyright, CStyle, HdrChk
 from onbld.Checks import JStyle, Keywords, Mapfile
 
 
 class GitError(Exception):

@@ -175,14 +173,11 @@
     should be excluded from the check named by 'cmd'"""
 
     ignorefiles = filter(os.path.exists,
                          [os.path.join(root, ".git", "%s.NOT" % cmd),
                           os.path.join(root, "exception_lists", cmd)])
-    if len(ignorefiles) > 0:
-        return ignore.ignore(root, ignorefiles, sys.stderr.write)
-    else:
-        return lambda x: False
+    return Ignore.ignore(root, ignorefiles)
 
 
 def gen_files(root, parent, paths, exclude):
     """Return a function producing file names, relative to the current
     directory, of any file changed on this branch (limited to 'paths' if