[PATCH 2 of 3] manifest: rename 'mf', 'map', and 'mapping' to 'm'

Martin von Zweigbergk martinvonz at google.com
Thu Feb 26 18:02:48 CST 2015


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1424797734 28800
#      Tue Feb 24 09:08:54 2015 -0800
# Node ID ef7dde10dc5941491a19dbd17ccb47a776f0dadd
# Parent  8415c2e64dd7ce24ee3bd56fcd44941efbe05491
manifest: rename 'mf', 'map', and 'mapping' to 'm'

We mostly call manifest variables 'm', so let's use that in
manifest.py too. This makes it clearer that the variables do, in fact,
contain manifestsdict instances and never a plain dict.

diff -r 8415c2e64dd7 -r ef7dde10dc59 mercurial/manifest.py
--- a/mercurial/manifest.py	Mon Feb 23 13:41:02 2015 -0800
+++ b/mercurial/manifest.py	Tue Feb 24 09:08:54 2015 -0800
@@ -48,11 +48,11 @@
             (not match.anypats() and util.all(fn in self for fn in files))):
             return self.intersectfiles(files)
 
-        mf = self.copy()
-        for fn in mf.keys():
+        m = self.copy()
+        for fn in m.keys():
             if not match(fn):
-                del mf[fn]
-        return mf
+                del m[fn]
+        return m
 
     def diff(self, m2, clean=False):
         '''Finds changes between the current manifest and m2.
@@ -247,16 +247,16 @@
             return self._mancache[node][0]
         text = self.revision(node)
         arraytext = array.array('c', text)
-        mapping = _parse(text)
-        self._mancache[node] = (mapping, arraytext)
-        return mapping
+        m = _parse(text)
+        self._mancache[node] = (m, arraytext)
+        return m
 
     def find(self, node, f):
         '''look up entry for a single file efficiently.
         return (node, flags) pair if found, (None, None) if not.'''
         if node in self._mancache:
-            mapping = self._mancache[node][0]
-            return mapping.get(f), mapping.flags(f)
+            m = self._mancache[node][0]
+            return m.get(f), m.flags(f)
         text = self.revision(node)
         start, end = _msearch(text, f)
         if start == end:
@@ -265,7 +265,7 @@
         f, n = l.split('\0')
         return revlog.bin(n[:40]), n[40:-1]
 
-    def add(self, map, transaction, link, p1, p2, added, removed):
+    def add(self, m, transaction, link, p1, p2, added, removed):
         if p1 in self._mancache:
             # If our first parent is in the manifest cache, we can
             # compute a delta here using properties we know about the
@@ -280,7 +280,7 @@
             # since the lists are already sorted
             work.sort()
 
-            arraytext, deltatext = map.fastdelta(self._mancache[p1][1], work)
+            arraytext, deltatext = m.fastdelta(self._mancache[p1][1], work)
             cachedelta = self.rev(p1), deltatext
             text = util.buffer(arraytext)
         else:
@@ -288,11 +288,11 @@
             # just encode a fulltext of the manifest and pass that
             # through to the revlog layer, and let it handle the delta
             # process.
-            text = map.text()
+            text = m.text()
             arraytext = array.array('c', text)
             cachedelta = None
 
         n = self.addrevision(text, transaction, link, p1, p2, cachedelta)
-        self._mancache[n] = (map, arraytext)
+        self._mancache[n] = (m, arraytext)
 
         return n


More information about the Mercurial-devel mailing list