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

Mads Kiilerich mads at kiilerich.com
Sun Apr 13 12:13:48 CDT 2014


# HG changeset patch
# User Mads Kiilerich <madski at 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.

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 == '.':


More information about the Mercurial-devel mailing list