Patchwork [4,of,6,misc] dirstate: inline local finish function

login
register
mail settings
Submitter Mads Kiilerich
Date April 13, 2014, 5:13 p.m.
Message ID <8674a2e7d16fb130b0af.1397409228@localhost.localdomain>
Download mbox | patch
Permalink /patch/4332/
State Accepted
Commit 5b4669c174c2be65af6702762897d0d169ca4c7c
Headers show

Comments

Mads Kiilerich - April 13, 2014, 5:13 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1367097592 -7200
#      Sat Apr 27 23:19:52 2013 +0200
# Node ID 8674a2e7d16fb130b0af9c541c663462a54bc454
# Parent  9d250940811ae2c5556b00ac5e02ff1e06565d41
dirstate: inline local finish function

Having it as a local function adds no value.

Patch

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -503,17 +503,13 @@  class dirstate(object):
         if not self._dirty:
             return
         st = self._opener("dirstate", "w", atomictemp=True)
-
-        def finish(s):
-            st.write(s)
-            st.close()
-            self._lastnormaltime = 0
-            self._dirty = self._dirtypl = False
-
         # use the modification time of the newly created temporary file as the
         # filesystem's notion of 'now'
         now = util.fstat(st).st_mtime
-        finish(parsers.pack_dirstate(self._map, self._copymap, self._pl, now))
+        st.write(parsers.pack_dirstate(self._map, self._copymap, self._pl, now))
+        st.close()
+        self._lastnormaltime = 0
+        self._dirty = self._dirtypl = False
 
     def _dirignore(self, f):
         if f == '.':