5 # check in files for which rcsdiff returns nonzero exit status
12 EXECMAGIC
= '\001\140\000\010'
14 MAXSIZE
= 200*1024 # Files this big must be binaries and are skipped.
20 print 'No arguments, checking almost *, in "ls -t" order'
22 for file in os
.listdir(os
.curdir
):
23 if not skipfile(file):
24 list.append((getmtime(file), file))
27 print 'Nothing to do -- exit 1'
31 for mtime
, file in list: args
.append(file)
41 badnames
= ['tags', 'TAGS', 'xyzzy', 'nohup.out', 'core']
42 badprefixes
= ['.', ',', '@', '#', 'o.']
44 ['~', '.a', '.o', '.old', '.bak', '.orig', '.new', '.prev', '.not', \
45 '.pyc', '.fdc', '.rgb', '.elc', ',v']
51 ignore
.append(p
+ '*')
53 ignore
.append('*' + p
)
55 f
= open('.xxcign', 'r')
58 ignore
[:] = ignore
+ f
.read().split()
62 if fnmatch
.fnmatch(file, p
): return 1
66 return 1 # Doesn't exist -- skip it
67 # Skip non-plain files.
68 if not S_ISREG(st
[ST_MODE
]): return 1
69 # Skip huge files -- probably binaries.
70 if st
[ST_SIZE
] >= MAXSIZE
: return 1
73 data
= open(file, 'r').read(len(EXECMAGIC
))
74 if data
== EXECMAGIC
: return 1
80 for bad
in badprefixes
:
81 if file[:len(bad
)] == bad
: return 1
85 for bad
in badsuffixes
:
86 if file[-len(bad
):] == bad
: return 1
94 if askyesno('Check in ' + file + ' ? '):
95 sts
= os
.system('rcs -l ' + file) # ignored
96 sts
= os
.system('ci -l ' + file)
99 cmd
= 'co -p ' + file + ' 2>/dev/null | cmp -s - ' + file
104 cmd
= 'rcsdiff ' + file + ' 2>&1 | ${PAGER-more}'
107 def askyesno(prompt
):
108 s
= raw_input(prompt
)
109 return s
in ['y', 'yes']
111 if __name__
== '__main__':
115 except KeyboardInterrupt: