commit: drop the now-unused files parameter
authorMatt Mackall <mpm@selenic.com>
Mon, 01 Jun 2009 14:11:32 -0500
changeset 8706 25e9c71b89de
parent 8705 509083f54e52
child 8707 0550dfe4fca1
commit: drop the now-unused files parameter
hgext/fetch.py
hgext/gpg.py
hgext/keyword.py
hgext/mq.py
hgext/rebase.py
hgext/transplant.py
mercurial/commands.py
mercurial/localrepo.py
--- a/hgext/fetch.py	Mon Jun 01 14:11:19 2009 -0500
+++ b/hgext/fetch.py	Mon Jun 01 14:11:32 2009 -0500
@@ -127,7 +127,7 @@
             editor = cmdutil.commiteditor
             if opts.get('force_editor') or opts.get('edit'):
                 editor = cmdutil.commitforceeditor
-            n = repo.commit(None, message, opts['user'], opts['date'],
+            n = repo.commit(message, opts['user'], opts['date'],
                             force=True, editor=editor)
             ui.status(_('new changeset %d:%s merges remote changes '
                         'with local\n') % (repo.changelog.rev(n),
--- a/hgext/gpg.py	Mon Jun 01 14:11:19 2009 -0500
+++ b/hgext/gpg.py	Mon Jun 01 14:11:32 2009 -0500
@@ -256,7 +256,7 @@
                              for n in nodes])
     try:
         m = match.exact(['.hgsigs'])
-        repo.commit(None, message, opts['user'], opts['date'], match=m)
+        repo.commit(message, opts['user'], opts['date'], match=m)
     except ValueError, inst:
         raise util.Abort(str(inst))
 
--- a/hgext/keyword.py	Mon Jun 01 14:11:19 2009 -0500
+++ b/hgext/keyword.py	Mon Jun 01 14:11:32 2009 -0500
@@ -449,8 +449,8 @@
             data = super(kwrepo, self).wread(filename)
             return kwt.wread(filename, data)
 
-        def commit(self, files=None, text='', user=None, date=None,
-                   match=None, force=False, editor=None, extra={}):
+        def commit(self, text='', user=None, date=None, match=None,
+                   force=False, editor=None, extra={}):
             wlock = lock = None
             _p1 = _p2 = None
             try:
@@ -471,8 +471,8 @@
                     else:
                         _p2 = hex(_p2)
 
-                n = super(kwrepo, self).commit(files, text, user, date, match,
-                                               force, editor, extra)
+                n = super(kwrepo, self).commit(text, user, date, match, force,
+                                               editor, extra)
 
                 # restore commit hooks
                 for name, cmd in commithooks.iteritems():
--- a/hgext/mq.py	Mon Jun 01 14:11:19 2009 -0500
+++ b/hgext/mq.py	Mon Jun 01 14:11:32 2009 -0500
@@ -426,7 +426,7 @@
         ret = hg.merge(repo, rev)
         if ret:
             raise util.Abort(_("update returned %d") % ret)
-        n = repo.commit(None, ctx.description(), ctx.user(), force=1)
+        n = repo.commit(ctx.description(), ctx.user(), force=True)
         if n is None:
             raise util.Abort(_("repo commit failed"))
         try:
@@ -471,7 +471,7 @@
             # the first patch in the queue is never a merge patch
             #
             pname = ".hg.patches.merge.marker"
-            n = repo.commit(None, '[mq]: merge marker', force=1)
+            n = repo.commit('[mq]: merge marker', force=True)
             self.removeundo(repo)
             self.applied.append(statusentry(hex(n), pname))
             self.applied_dirty = 1
@@ -597,8 +597,7 @@
 
             files = patch.updatedir(self.ui, repo, files)
             match = cmdutil.matchfiles(repo, files or [])
-            n = repo.commit(None, message, ph.user, ph.date, match=match,
-                            force=True)
+            n = repo.commit(message, ph.user, ph.date, match=match, force=True)
 
             if n is None:
                 raise util.Abort(_("repo commit failed"))
@@ -763,7 +762,7 @@
                 if hasattr(msg, '__call__'):
                     msg = msg()
                 commitmsg = msg and msg or ("[mq]: %s" % patchfn)
-                n = repo.commit(None, commitmsg, user, date, match=match, force=True)
+                n = repo.commit(commitmsg, user, date, match=match, force=True)
                 if n is None:
                     raise util.Abort(_("repo commit failed"))
                 try:
@@ -1284,8 +1283,8 @@
                 try:
                     # might be nice to attempt to roll back strip after this
                     patchf.rename()
-                    n = repo.commit(None, message, user, ph.date,
-                                    match=match, force=1)
+                    n = repo.commit(message, user, ph.date, match=match,
+                                    force=True)
                     self.applied.append(statusentry(hex(n), patchfn))
                 except:
                     ctx = repo[cparents[0]]
@@ -1470,7 +1469,7 @@
         msg += "\n\nPatch Data:\n"
         text = msg + "\n".join([str(x) for x in self.applied]) + '\n' + (ar and
                    "\n".join(ar) + '\n' or "")
-        n = repo.commit(None, text, force=1)
+        n = repo.commit(text, force=True)
         if not n:
             self.ui.warn(_("repo commit failed\n"))
             return 1
--- a/hgext/rebase.py	Mon Jun 01 14:11:19 2009 -0500
+++ b/hgext/rebase.py	Mon Jun 01 14:11:32 2009 -0500
@@ -174,11 +174,8 @@
         extra = {'rebase_source': repo[rev].hex()}
         if extrafn:
             extrafn(repo[rev], extra)
-        newrev = repo.commit(None,
-                            text=commitmsg,
-                            user=repo[rev].user(),
-                            date=repo[rev].date(),
-                            extra=extra)
+        newrev = repo.commit(text=commitmsg, user=repo[rev].user(),
+                             date=repo[rev].date(), extra=extra)
         repo.dirstate.setbranch(repo[newrev].branch())
         return newrev
     except util.Abort:
--- a/hgext/transplant.py	Mon Jun 01 14:11:19 2009 -0500
+++ b/hgext/transplant.py	Mon Jun 01 14:11:32 2009 -0500
@@ -246,7 +246,7 @@
         else:
             m = match.exact(repo.root, '', files)
 
-        n = repo.commit(None, message, user, date, extra=extra, match=m)
+        n = repo.commit(message, user, date, extra=extra, match=m)
         if not merge:
             self.transplants.set(n, node)
 
@@ -288,7 +288,7 @@
                                  revlog.hex(parents[0]))
             if merge:
                 repo.dirstate.setparents(p1, parents[1])
-            n = repo.commit(None, message, user, date, extra=extra)
+            n = repo.commit(message, user, date, extra=extra)
             if not n:
                 raise util.Abort(_('commit failed'))
             if not merge:
--- a/mercurial/commands.py	Mon Jun 01 14:11:19 2009 -0500
+++ b/mercurial/commands.py	Mon Jun 01 14:11:32 2009 -0500
@@ -645,8 +645,8 @@
         e = cmdutil.commitforceeditor
 
     def commitfunc(ui, repo, message, match, opts):
-        return repo.commit(None, message, opts.get('user'),
-            opts.get('date'), match, editor=e, extra=extra)
+        return repo.commit(message, opts.get('user'), opts.get('date'), match,
+                           editor=e, extra=extra)
 
     node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
     if not node:
@@ -1754,7 +1754,7 @@
                     files = patch.updatedir(ui, repo, files, similarity=sim/100.)
                 if not opts.get('no_commit'):
                     m = cmdutil.matchfiles(repo, files or [])
-                    n = repo.commit(None, message, opts.get('user') or user,
+                    n = repo.commit(message, opts.get('user') or user,
                                     opts.get('date') or date, match=m,
                                     editor=cmdutil.commiteditor)
                     if opts.get('exact'):
--- a/mercurial/localrepo.py	Mon Jun 01 14:11:19 2009 -0500
+++ b/mercurial/localrepo.py	Mon Jun 01 14:11:32 2009 -0500
@@ -184,7 +184,7 @@
             self.add(['.hgtags'])
 
         m = match_.exact(self.root, '', ['.hgtags'])
-        tagnode = self.commit(None, message, user, date, extra=extra, match=m)
+        tagnode = self.commit(message, user, date, extra=extra, match=m)
 
         for name in names:
             self.hook('tag', node=hex(node), tag=name, local=local)
@@ -773,13 +773,13 @@
 
         return fparent1
 
-    def commit(self, files=None, text="", user=None, date=None, match=None,
-               force=False, editor=False, extra={}):
+    def commit(self, text="", user=None, date=None, match=None, force=False,
+               editor=False, extra={}):
         """Add a new revision to current repository.
 
-        Revision information is gathered from the working directory, files and
-        match can be used to filter the committed files.
-        If editor is supplied, it is called to get a commit message.
+        Revision information is gathered from the working directory,
+        match can be used to filter the committed files. If editor is
+        supplied, it is called to get a commit message.
         """
         wlock = self.wlock()
         try:
@@ -790,21 +790,9 @@
                 raise util.Abort(_('cannot partially commit a merge '
                                    '(do not specify files or patterns)'))
 
-            if files:
-                modified, removed = [], []
-                for f in sorted(set(files)):
-                    s = self.dirstate[f]
-                    if s in 'nma':
-                        modified.append(f)
-                    elif s == 'r':
-                        removed.append(f)
-                    else:
-                        self.ui.warn(_("%s not tracked!\n") % f)
-                changes = [modified, [], removed, [], []]
-            else:
-                changes = self.status(match=match, clean=force)
-                if force:
-                    changes[0].extend(changes[6])
+            changes = self.status(match=match, clean=force)
+            if force:
+                changes[0].extend(changes[6]) # mq may commit unchanged files
 
             if (not force and not extra.get("close") and p2 == nullid
                 and not (changes[0] or changes[1] or changes[2])