changeset 58:69718b21b5bb

Function variable naming and signature cleanup Saves a nested function in crecord as side-effect. Analogous to 0aa59f532ef9 for record in main.
author Christian Ebert <blacktrash@gmx.net>
date Mon, 26 Apr 2010 23:12:20 +0200
parents a77a8002662f
children 648a08c398a1
files crecord/crecord_core.py
diffstat 1 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/crecord/crecord_core.py
+++ b/crecord/crecord_core.py
@@ -19,7 +19,7 @@
 import crpatch
 import chunk_selector
 
-def dorecord(ui, repo, committer, *pats, **opts):
+def dorecord(ui, repo, commitfunc, *pats, **opts):
     if not ui.interactive:
         raise util.Abort(_('running non-interactively, use commit instead'))
 
@@ -139,7 +139,7 @@
             cwd = os.getcwd()
             os.chdir(repo.root)
             try:
-                committer(ui, repo, newfiles, opts)
+                commitfunc(ui, repo, *newfiles, **opts)
             finally:
                 os.chdir(cwd)
 
@@ -171,9 +171,7 @@
     those you would like to apply to the commit.
 
     '''
-    def record_committer(ui, repo, pats, opts):
-        commands.commit(ui, repo, *pats, **opts)
-    dorecord(ui, repo, record_committer, *pats, **opts)
+    dorecord(ui, repo, commands.commit, *pats, **opts)
 
 
 def qcrecord(ui, repo, patch, *pats, **opts):
@@ -187,9 +185,9 @@
     except KeyError:
         raise util.Abort(_("'mq' extension not loaded"))
 
-    def qrecord_committer(ui, repo, pats, opts):
+    def committomq(ui, repo, *pats, **opts):
         mq.new(ui, repo, patch, *pats, **opts)
 
     opts = opts.copy()
     opts['force'] = True    # always 'qnew -f'
-    dorecord(ui, repo, qrecord_committer, *pats, **opts)
+    dorecord(ui, repo, committomq, *pats, **opts)