5 # check in files for which rcsdiff returns nonzero exit status
13 EXECMAGIC
= '\001\140\000\010'
15 MAXSIZE
= 200*1024 # Files this big must be binaries and are skipped.
21 print 'No arguments, checking almost *, in "ls -t" order'
23 for file in os
.listdir(os
.curdir
):
24 if not skipfile(file):
25 list.append((getmtime(file), file))
28 print 'Nothing to do -- exit 1'
32 for mtime
, file in list: args
.append(file)
42 badnames
= ['tags', 'TAGS', 'xyzzy', 'nohup.out', 'core']
43 badprefixes
= ['.', ',', '@', '#', 'o.']
45 ['~', '.a', '.o', '.old', '.bak', '.orig', '.new', '.prev', '.not', \
46 '.pyc', '.fdc', '.rgb', '.elc', ',v']
52 ignore
.append(p
+ '*')
54 ignore
.append('*' + p
)
56 f
= open('.xxcign', 'r')
59 ignore
[:] = ignore
+ f
.read().split()
63 if fnmatch
.fnmatch(file, p
): return 1
67 return 1 # Doesn't exist -- skip it
68 # Skip non-plain files.
69 if not S_ISREG(st
[ST_MODE
]): return 1
70 # Skip huge files -- probably binaries.
71 if st
[ST_SIZE
] >= MAXSIZE
: return 1
74 data
= open(file, 'r').read(len(EXECMAGIC
))
75 if data
== EXECMAGIC
: return 1
81 for bad
in badprefixes
:
82 if file[:len(bad
)] == bad
: return 1
86 for bad
in badsuffixes
:
87 if file[-len(bad
):] == bad
: return 1
95 if askyesno('Check in ' + file + ' ? '):
96 sts
= os
.system('rcs -l ' + file) # ignored
97 sts
= os
.system('ci -l ' + file)
100 cmd
= 'co -p ' + file + ' 2>/dev/null | cmp -s - ' + file
105 cmd
= 'rcsdiff ' + file + ' 2>&1 | ${PAGER-more}'
108 def askyesno(prompt
):
109 s
= raw_input(prompt
)
110 return s
in ['y', 'yes']
115 except KeyboardInterrupt: