Patchwork D6336: localrepo: don't use defaults arguments that will never be overridden

login
register
mail settings
Submitter phabricator
Date May 3, 2019, 3:55 p.m.
Message ID <differential-rev-PHID-DREV-m3aqnrna5zk6wsf526sk-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/39931/
State Superseded
Headers show

Comments

phabricator - May 3, 2019, 3:55 p.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The commithook() callback will be called when the lock is
  released. lock.release() calls the callback without arguments, so it
  was quite confusing to me that this function declared extra
  arguments. We can just close on the variables in the outer scope
  instead.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6336

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -2536,12 +2536,12 @@ 
                         _('note: commit message saved in %s\n') % msgfn)
                 raise
 
-        def commithook(node=hex(ret), parent1=hookp1, parent2=hookp2):
+        def commithook():
             # hack for command that use a temporary commit (eg: histedit)
             # temporary commit got stripped before hook release
             if self.changelog.hasnode(ret):
-                self.hook("commit", node=node, parent1=parent1,
-                          parent2=parent2)
+                self.hook("commit", node=hex(ret), parent1=hookp1,
+                          parent2=hookp2)
         self._afterlock(commithook)
         return ret