5 def doCommit(keepFiles
, selFileNames
, msg
):
6 print "Commit message:" + msg
7 runProgram(['hg commit', '-A', '-l', '-'] + selFileNames
, msg
)
10 parseDiffRE
= re
.compile('([AMR?]) (.*)')
12 def __getPatch(file, otherFile
= None):
17 return runProgram(['hg diff'] + f
)
20 inp
= runProgram('hg status')
24 recs
= inp
.split("\n")
25 recs
.pop() # remove last entry (which is '')
29 m
= parseDiffRE
.match(rec
)
32 print "Unknown output from hg status!: " + rec
+ "\n"
37 f
.srcName
= f
.dstName
= m
.group(2)
38 print "Getting patch for file " + f
.srcName
40 f
.patch
= __getPatch(f
.srcName
)
48 # HEAD is src in the returned File objects. That is, srcName is the
49 # name in HEAD and dstName is the name in the cache.
51 files
= __parseStatus()
55 f
.text
= 'Added file: ' + f
.srcName
57 f
.text
= 'New file: ' + f
.srcName
59 f
.text
= 'Removed file: ' + f
.srcName
67 def basicsFailed(msg
):
68 print "hg status: " + msg
69 print "Make sure that the current working directory contains a '.hg' directory."
73 runProgram('hg status')
75 basicsFailed(e
.strerror
)
76 except ProgramError
, e
: