5 # check in files for which rcsdiff returns nonzero exit status
14 EXECMAGIC
= '\001\140\000\010'
16 MAXSIZE
= 200*1024 # Files this big must be binaries and are skipped.
22 print 'No arguments, checking almost *, in "ls -t" order'
24 for file in os
.listdir(os
.curdir
):
25 if not skipfile(file):
26 list.append((getmtime(file), file))
29 print 'Nothing to do -- exit 1'
33 for mtime
, file in list: args
.append(file)
43 badnames
= ['tags', 'TAGS', 'xyzzy', 'nohup.out', 'core']
44 badprefixes
= ['.', ',', '@', '#', 'o.']
46 ['~', '.a', '.o', '.old', '.bak', '.orig', '.new', '.prev', '.not', \
47 '.pyc', '.fdc', '.rgb', '.elc', ',v']
53 ignore
.append(p
+ '*')
55 ignore
.append('*' + p
)
57 f
= open('.xxcign', 'r')
60 ignore
[:] = ignore
+ string
.split(f
.read())
64 if fnmatch
.fnmatch(file, p
): return 1
68 return 1 # Doesn't exist -- skip it
69 # Skip non-plain files.
70 if not S_ISREG(st
[ST_MODE
]): return 1
71 # Skip huge files -- probably binaries.
72 if st
[ST_SIZE
] >= MAXSIZE
: return 1
75 data
= open(file, 'r').read(len(EXECMAGIC
))
76 if data
== EXECMAGIC
: return 1
82 for bad
in badprefixes
:
83 if file[:len(bad
)] == bad
: return 1
87 for bad
in badsuffixes
:
88 if file[-len(bad
):] == bad
: return 1
96 if askyesno('Check in ' + file + ' ? '):
97 sts
= os
.system('rcs -l ' + file) # ignored
98 sts
= os
.system('ci -l ' + file)
101 cmd
= 'co -p ' + file + ' 2>/dev/null | cmp -s - ' + file
106 cmd
= 'rcsdiff ' + file + ' 2>&1 | ${PAGER-more}'
109 def askyesno(prompt
):
110 s
= raw_input(prompt
)
111 return s
in ['y', 'yes']
116 except KeyboardInterrupt: