match: stop passing files through commitfunc
authorMatt Mackall <mpm@selenic.com>
Mon, 12 May 2008 11:37:08 -0500
changeset 6600 b822a379860b
parent 6599 cd4db3999ef9
child 6601 cab3ad865444
match: stop passing files through commitfunc
hgext/record.py
mercurial/cmdutil.py
mercurial/commands.py
--- a/hgext/record.py	Mon May 12 11:37:08 2008 -0500
+++ b/hgext/record.py	Mon May 12 11:37:08 2008 -0500
@@ -389,7 +389,7 @@
     if not ui.interactive:
         raise util.Abort(_('running non-interactively, use commit instead'))
 
-    def recordfunc(ui, repo, files, message, match, opts):
+    def recordfunc(ui, repo, message, match, opts):
         """This is generic record driver.
 
         It's job is to interactively filter local changes, and accordingly
@@ -402,15 +402,15 @@
         In the end we'll record intresting changes, and everything else will be
         left in place, so the user can continue his work.
         """
-        if files:
+        if match.files():
             changes = None
         else:
-            changes = repo.status(files=files, match=match)[:5]
+            changes = repo.status(match=match)[:5]
             modified, added, removed = changes[:3]
-            files = modified + added + removed
+            match = cmdutil.matchfiles(repo, modified + added + removed)
         diffopts = mdiff.diffopts(git=True, nodates=True)
         fp = cStringIO.StringIO()
-        patch.diff(repo, repo.dirstate.parents()[0], files=files,
+        patch.diff(repo, repo.dirstate.parents()[0], files=match.files(),
                    match=match, changes=changes, opts=diffopts, fp=fp)
         fp.seek(0)
 
@@ -423,14 +423,15 @@
             try: contenders.update(dict.fromkeys(h.files()))
             except AttributeError: pass
 
-        newfiles = [f for f in files if f in contenders]
+        newfiles = [f for f in match.files() if f in contenders]
 
         if not newfiles:
             ui.status(_('no changes to record\n'))
             return 0
 
         if changes is None:
-            changes = repo.status(files=newfiles, match=match)[:5]
+            match = cmdutil.matchfiles(repo, newfiles)
+            changes = repo.status(files=match.files(), match=match)[:5]
         modified = dict.fromkeys(changes[0])
 
         # 2. backup changed files, so we can restore them in the end
--- a/mercurial/cmdutil.py	Mon May 12 11:37:08 2008 -0500
+++ b/mercurial/cmdutil.py	Mon May 12 11:37:08 2008 -0500
@@ -1183,6 +1183,6 @@
                     raise util.Abort(_("file %s not tracked!") % rel)
         m = matchfiles(repo, files)
     try:
-        return commitfunc(ui, repo, m.files(), message, m, opts)
+        return commitfunc(ui, repo, message, m, opts)
     except ValueError, inst:
         raise util.Abort(str(inst))
--- a/mercurial/commands.py	Mon May 12 11:37:08 2008 -0500
+++ b/mercurial/commands.py	Mon May 12 11:37:08 2008 -0500
@@ -562,9 +562,9 @@
 
     See 'hg help dates' for a list of formats valid for -d/--date.
     """
-    def commitfunc(ui, repo, files, message, match, opts):
-        return repo.commit(files, message, opts['user'], opts['date'], match,
-                           force_editor=opts.get('force_editor'))
+    def commitfunc(ui, repo, message, match, opts):
+        return repo.commit(match.files(), message, opts['user'], opts['date'],
+                           match, force_editor=opts.get('force_editor'))
 
     node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
     if not node: