# HG changeset patch # User mpm@selenic.com # Date 1118276914 28800 # Node ID 266396e320062cda6601d029a5237a6625be609e # Parent 97c87ac6d7a4a09ca5efcdd176363ffe1d0f0f4a 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----- diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -165,9 +165,14 @@ def cat(ui, repo, file, rev = []): 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 @@ table = { 'hg annotate [-u] [-c] [-n] [-r id] [files]'), "branch|clone": (branch, [], 'hg branch [path]'), "cat|dump": (cat, [], 'hg cat [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 '),