hg commit: add -t and -l options
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
hg commit: add -t and -l options
This lets you specify commit text on the command line or point to a
file containing it.
manifest hash:
38201933edb1a89a5c3e0054d1b733cc4af46880
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFCp40yywK+sNU5EO8RAgirAJ9ZAkfN+RyhPQGJBXKz3f7cR2xC0gCgo5l2
I9LQHVXT22rPb4tYUVq/bgQ=
=pA04
-----END PGP SIGNATURE-----
--- a/mercurial/commands.py Wed Jun 08 16:27:03 2005 -0800
+++ b/mercurial/commands.py Wed Jun 08 16:28:34 2005 -0800
@@ -165,9 +165,14 @@
if rev: n = r.lookup(rev)
sys.stdout.write(r.read(n))
-def commit(ui, repo, *files):
+def commit(ui, repo, *files, **opts):
"""commit the specified files or all outstanding changes"""
- repo.commit(relpath(repo, files))
+ text = opts['text']
+ if not text and opts['logfile']:
+ try: text = open(opts['logfile']).read()
+ except IOError: pass
+
+ repo.commit(relpath(repo, files), text)
def debugaddchangegroup(ui, repo):
data = sys.stdin.read()
@@ -481,7 +486,10 @@
'hg annotate [-u] [-c] [-n] [-r id] [files]'),
"branch|clone": (branch, [], 'hg branch [path]'),
"cat|dump": (cat, [], 'hg cat <file> [rev]'),
- "commit|ci": (commit, [], 'hg commit [files]'),
+ "commit|ci": (commit,
+ [('t', 'text', "", 'commit text'),
+ ('l', 'logfile', "", 'commit text file')],
+ 'hg commit [files]'),
"debugaddchangegroup": (debugaddchangegroup, [], 'debugaddchangegroup'),
"debugchangegroup": (debugchangegroup, [], 'debugchangegroup [roots]'),
"debugindex": (debugindex, [], 'debugindex <file>'),