comparison hg @ 49:14bff5d8e526

Import comments from patches
author mpm@selenic.com
date Wed, 11 May 2005 13:56:22 -0800
parents 93e868fa0db8
children 0263ce8be574
comparison
equal deleted inserted replaced
48:9f64181ff9a9 49:14bff5d8e526
18 18
19 import sys, os, time 19 import sys, os, time
20 from mercurial import hg, mdiff, fancyopts 20 from mercurial import hg, mdiff, fancyopts
21 21
22 def help(): 22 def help():
23 print """\ 23 print """\
24 commands: 24 commands:
25 25
26 init create a new repository in this directory 26 init create a new repository in this directory
27 branch <path> create a branch of <path> in this directory 27 branch <path> create a branch of <path> in this directory
28 merge <path> merge changes from <path> into local repository 28 merge <path> merge changes from <path> into local repository
140 d = ioptions["base"] 140 d = ioptions["base"]
141 strip = ioptions["strip"] 141 strip = ioptions["strip"]
142 142
143 for patch in args: 143 for patch in args:
144 ui.status("applying %s\n" % patch) 144 ui.status("applying %s\n" % patch)
145 pf = d + patch 145 pf = os.path.join(d, patch)
146
147 text = ""
148 for l in file(pf):
149 if l[:3] == "---": break
150 text += l
151
146 os.system("patch -p%d < %s > /dev/null" % (strip, pf)) 152 os.system("patch -p%d < %s > /dev/null" % (strip, pf))
147 f = os.popen("lsdiff --strip %d %s" % (strip, pf)) 153 f = os.popen("lsdiff --strip %d %s" % (strip, pf))
148 files = f.read().splitlines() 154 files = f.read().splitlines()
149 f.close() 155 f.close()
150 repo.commit(repo.current, files) 156 repo.commit(repo.current, files, text)
151 157
152 elif cmd == "status": 158 elif cmd == "status":
153 (c, a, d) = repo.diffdir(repo.root, repo.current) 159 (c, a, d) = repo.diffdir(repo.root, repo.current)
154 for f in c: print "C", f 160 for f in c: print "C", f
155 for f in a: print "?", f 161 for f in a: print "?", f