[PATCH] Take commit log on stdin

Mark Williamson mark.williamson at cl.cam.ac.uk
Fri Aug 12 15:01:00 CDT 2005


Small patch to allow a commit message to be fed on standard input.  Convenient 
for external commit tools.

Cheers,
Mark

# HG changeset patch
# User mark.williamson at cl.cam.ac.uk
# Node ID 6a914cd4b6bbab6748a834415bf40146619d462f
# Parent  f199e1887889f208806f70d348678c617839bbb2
Add '-' support to the commit logfile option to read message from stdin.

diff -r f199e1887889 -r 6a914cd4b6bb mercurial/commands.py
--- a/mercurial/commands.py	Thu Jul 28 15:46:08 2005
+++ b/mercurial/commands.py	Fri Aug 12 19:46:36 2005
@@ -476,7 +476,10 @@
     logfile = opts['logfile']
     if not message and logfile:
         try:
-            message = open(logfile).read()
+            if logfile == '-':
+                message = sys.stdin.read()
+            else:
+                message = open(logfile).read()
         except IOError, why:
             ui.warn("Can't read commit message %s: %s\n" % (logfile, why))
 


More information about the Mercurial mailing list