Patchwork [1,of,6,v6,lazy-manifest] manifest: move parsing functions up in file

login
register
mail settings
Submitter Augie Fackler
Date March 7, 2015, 5:16 p.m.
Message ID <a6865eef42791a2cc6ec.1425748576@106.17.16.172.in-addr.arpa>
Download mbox | patch
Permalink /patch/7927/
State Accepted
Headers show

Comments

Augie Fackler - March 7, 2015, 5:16 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1425746525 18000
#      Sat Mar 07 11:42:05 2015 -0500
# Node ID a6865eef42791a2cc6ecba8f31e81c0555642ffc
# Parent  02d7b5cd373bbb4e8263dad9bfbf9c4c3b0e4e3a
manifest: move parsing functions up in file

These functions are about to change signature and be hidden inside the
manifestdict constructor. Doing the code motion now as an isolated
change to make things easier to review.

Patch

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -9,6 +9,25 @@  from i18n import _
 import mdiff, parsers, error, revlog, util
 import array, struct
 
+# Pure Python fallback
+def _parsemanifest(mfdict, fdict, lines):
+    bin = revlog.bin
+    for l in lines.splitlines():
+        f, n = l.split('\0')
+        if len(n) > 40:
+            fdict[f] = n[40:]
+            mfdict[f] = bin(n[:40])
+        else:
+            mfdict[f] = bin(n)
+
+def _parse(lines):
+    mfdict = manifestdict()
+    try:
+        parsers.parse_manifest(mfdict, mfdict._flags, lines)
+    except AttributeError:
+        _parsemanifest(mfdict, mfdict._flags, lines)
+    return mfdict
+
 class manifestdict(dict):
     def __init__(self):
         self._flags = {}
@@ -217,25 +236,6 @@  def _addlistdelta(addlist, x):
                    + content for start, end, content in x)
     return deltatext, newaddlist
 
-# Pure Python fallback
-def _parsemanifest(mfdict, fdict, lines):
-    bin = revlog.bin
-    for l in lines.splitlines():
-        f, n = l.split('\0')
-        if len(n) > 40:
-            fdict[f] = n[40:]
-            mfdict[f] = bin(n[:40])
-        else:
-            mfdict[f] = bin(n)
-
-def _parse(lines):
-    mfdict = manifestdict()
-    try:
-        parsers.parse_manifest(mfdict, mfdict._flags, lines)
-    except AttributeError:
-        _parsemanifest(mfdict, mfdict._flags, lines)
-    return mfdict
-
 class manifest(revlog.revlog):
     def __init__(self, opener):
         # During normal operations, we expect to deal with not more than four