cdf0c1d55d9b3b6beaf994835440dfb01aef5cf0mjnelson# CDDL HEADER START
cdf0c1d55d9b3b6beaf994835440dfb01aef5cf0mjnelson# The contents of this file are subject to the terms of the
cdf0c1d55d9b3b6beaf994835440dfb01aef5cf0mjnelson# Common Development and Distribution License (the "License").
cdf0c1d55d9b3b6beaf994835440dfb01aef5cf0mjnelson# You may not use this file except in compliance with the License.
cdf0c1d55d9b3b6beaf994835440dfb01aef5cf0mjnelson# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
cdf0c1d55d9b3b6beaf994835440dfb01aef5cf0mjnelson# See the License for the specific language governing permissions
cdf0c1d55d9b3b6beaf994835440dfb01aef5cf0mjnelson# and limitations under the License.
cdf0c1d55d9b3b6beaf994835440dfb01aef5cf0mjnelson# When distributing Covered Code, include this CDDL HEADER in each
cdf0c1d55d9b3b6beaf994835440dfb01aef5cf0mjnelson# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
cdf0c1d55d9b3b6beaf994835440dfb01aef5cf0mjnelson# If applicable, add the following below this CDDL HEADER, with the
cdf0c1d55d9b3b6beaf994835440dfb01aef5cf0mjnelson# fields enclosed by brackets "[]" replaced with your own identifying
cdf0c1d55d9b3b6beaf994835440dfb01aef5cf0mjnelson# information: Portions Copyright [yyyy] [name of copyright owner]
cdf0c1d55d9b3b6beaf994835440dfb01aef5cf0mjnelson# CDDL HEADER END
cdf0c1d55d9b3b6beaf994835440dfb01aef5cf0mjnelson# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
cdf0c1d55d9b3b6beaf994835440dfb01aef5cf0mjnelson# Use is subject to license terms.
cdf0c1d55d9b3b6beaf994835440dfb01aef5cf0mjnelson# ident "%Z%%M% %I% %E% SMI"
cdf0c1d55d9b3b6beaf994835440dfb01aef5cf0mjnelson# Mercurial (lack of) keyword checks
cdf0c1d55d9b3b6beaf994835440dfb01aef5cf0mjnelson# A general 'ident'-style decleration, to allow for leniency.
cdf0c1d55d9b3b6beaf994835440dfb01aef5cf0mjnelsonident = re.compile(r'((\%Z\%(\%M\%)\s+\%I\%|\%W\%)\s+\%E\% SMI)')
cdf0c1d55d9b3b6beaf994835440dfb01aef5cf0mjnelson# Absolutely anything that appears to be an SCCS keyword.
cdf0c1d55d9b3b6beaf994835440dfb01aef5cf0mjnelson# It's impossible to programatically differentiate between these
cdf0c1d55d9b3b6beaf994835440dfb01aef5cf0mjnelson# and other, legitimate, uses of matching strings.
cdf0c1d55d9b3b6beaf994835440dfb01aef5cf0mjnelsondef keywords(fh, filename=None, lenient=False, verbose=False,
cdf0c1d55d9b3b6beaf994835440dfb01aef5cf0mjnelson '''Search FH for SCCS keywords, which should not be present when
cdf0c1d55d9b3b6beaf994835440dfb01aef5cf0mjnelson Mercurial is in use.
cdf0c1d55d9b3b6beaf994835440dfb01aef5cf0mjnelson If LENIENT, accept #ident-style declarations, for the purposes of
cdf0c1d55d9b3b6beaf994835440dfb01aef5cf0mjnelson migration'''
cdf0c1d55d9b3b6beaf994835440dfb01aef5cf0mjnelson output.write('%s: %d: contains SCCS keywords "%s"\n' %