2 import sys
, os
, string
, getopt
, re
9 opts
, list = getopt
.getopt(sys
.argv
[1:], ':R')
11 print "You must specify a file"
17 if os
.path
.exists(list[0]):
18 input = open(list[0], 'r')
24 matches
= re
.search("#\s+(\w+)\s+\"(.*)\"", line
)
25 if matches
is not None:
26 cmd
= matches
.group(1)
27 fileName
= matches
.group(2)
30 print "%s add %s" % (mtncmd
, fileName
)
32 print "%s drop -e %s" % (mtncmd
, fileName
)
33 elif cmd
== "add" or cmd
== "add_file" or cmd
== "add_dir":
35 print "%s drop -e %s" % (mtncmd
, fileName
)
37 print "%s add %s" % (mtncmd
, fileName
)
40 elif cmd
== "to" and renameFrom
!= "":
42 print "%s rename -e %s %s" % (mtncmd
, fileName
, renameFrom
)
44 print "%s rename -e %s %s" % (mtncmd
, renameFrom
, fileName
)
49 print "patch -R -p0 < %s" % list[0]
51 print "patch -p0 < %s" % list[0]
53 if __name__
== "__main__":