Hi Stevel,
> I'm not super keen on doing this SCM-detection dance for every single 
> file we pass through hdrchk.  HdrChk is called by many different 
> routines/tools, and I hate to add more performance bottlenecks 
> unnecessarily.
I agree.
>
> Rich and I were discussing it and we thought it might make sense to 
> split a new Keywords module, and have the presence-of-keywords 
> detection moved to there, and only have HdrChk check the 
> position/style of keywords.  This way - Teamware users continue to 
> invoke 'wx keywords' which calls the old keywords check (which can 
> assume Teamware), and we invoke Keywords via the Cadmium extension 
> (which can then assume Mercurial) which saves us having to do the SCM 
> detection.
If we add another wrapper file for Mercurial, why not add one argument 
for function hdrchk in HdrChd.py as well?  This new argument can be used 
to identify what kind of rule the tools should follow to check file 
head. Teamware or Mercurial? Currently, HdrChk.py check presence of 
keywords, also if keywords are put to the right position according to 
specified condition. For example, 'hdrchk -a' will allow 'ident' before 
file head guard. For Teamware, tool keywords need to check if ident is 
presented correctly according to if the file has been checked out or 
not.  However, the 'ident' rule for Mercurial is really simple, just no 
'ident' any more.

So, how about changing it like this way:
1. Add one argument noident for function hdrchk(fh, filename=None, 
lenient=False, noident=False) in Check/HdrChk.py
2. Add one new wrapper script/Hdrchk.py to call function hdrchk(..., 
..., ..., noident=True).

In this way, any existing interfaces don't need to be modified. Also, 
both Teamware and Mercurial share the check module code. The user 
interface like:
Teamware: wx hdrchk
Mercurial : Cadmium Hdrchk

Anything I am missing, please give me your feedback.

-- 
Thanks,

Forrest Wu, Sun China Engineering & Research
+86 10 62673294 http://blogs.sun.com/forrest


Reply via email to