changeset 3653:d793e09e1b71

refactor rawcommit
author Matt Mackall <mpm@selenic.com>
date Wed, 15 Nov 2006 15:51:58 -0600
parents f4dece0f7016
children c15c5aedaf47
files mercurial/commands.py
diffstat 1 files changed, 10 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Wed Nov 15 15:51:58 2006 -0600
+++ b/mercurial/commands.py	Wed Nov 15 15:51:58 2006 -0600
@@ -1778,7 +1778,7 @@
     r = repo.push(other, opts['force'], revs=revs)
     return r == 0
 
-def rawcommit(ui, repo, *flist, **rc):
+def rawcommit(ui, repo, *pats, **opts):
     """raw commit interface (DEPRECATED)
 
     (DEPRECATED)
@@ -1793,23 +1793,17 @@
 
     ui.warn(_("(the rawcommit command is deprecated)\n"))
 
-    message = rc['message']
-    if not message and rc['logfile']:
-        try:
-            message = open(rc['logfile']).read()
-        except IOError:
-            pass
-    if not message and not rc['logfile']:
-        raise util.Abort(_("missing commit message"))
-
-    files = relpath(repo, list(flist))
-    if rc['files']:
-        files += open(rc['files']).read().splitlines()
-
-    rc['parent'] = map(repo.lookup, rc['parent'])
+    message = logmessage(opts)
+
+    files, match, anypats = cmdutil.matchpats(repo, pats, opts)
+    if opts['files']:
+        files += open(opts['files']).read().splitlines()
+
+    parents = [repo.lookup(p) for p in opts['parent']]
 
     try:
-        repo.rawcommit(files, message, rc['user'], rc['date'], *rc['parent'])
+        repo.rawcommit(files, message,
+                       opts['user'], opts['date'], *parents)
     except ValueError, inst:
         raise util.Abort(str(inst))