Import comments from patches
authormpm@selenic.com
Wed, 11 May 2005 13:56:22 -0800
changeset 49 14bff5d8e526
parent 48 9f64181ff9a9
child 50 0263ce8be574
Import comments from patches
hg
--- a/hg	Wed May 11 09:44:12 2005 -0800
+++ b/hg	Wed May 11 13:56:22 2005 -0800
@@ -20,7 +20,7 @@
 from mercurial import hg, mdiff, fancyopts
 
 def help():
-        print """\
+    print """\
  commands:
 
  init                  create a new repository in this directory
@@ -142,12 +142,18 @@
 
     for patch in args:
         ui.status("applying %s\n" % patch)
-        pf = d + patch
+        pf = os.path.join(d, patch)
+
+	text = ""
+	for l in file(pf):
+            if l[:3] == "---": break
+	    text += l
+	    
         os.system("patch -p%d < %s > /dev/null" % (strip, pf))
         f = os.popen("lsdiff --strip %d %s" % (strip, pf))
         files = f.read().splitlines()
         f.close()
-        repo.commit(repo.current, files)
+        repo.commit(repo.current, files, text)
 
 elif cmd == "status":
     (c, a, d) = repo.diffdir(repo.root, repo.current)