Patchwork [3,of,9,V2] revlog: rename some "text"s to "rawtext"

login
register
mail settings
Submitter Jun Wu
Date March 31, 2017, 4:45 a.m.
Message ID <3fb26d049c52534835fd.1490935512@x1c>
Download mbox | patch
Permalink /patch/19856/
State Accepted
Headers show

Comments

Jun Wu - March 31, 2017, 4:45 a.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1490910969 25200
#      Thu Mar 30 14:56:09 2017 -0700
# Node ID 3fb26d049c52534835fd397ceb70b0f83068695a
# Parent  31aa38709dbd983b87302a0f24f4cf78a138ae83
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 3fb26d049c52
revlog: rename some "text"s to "rawtext"

This makes code easier to understand. "_addrevision" is left untouched - it
will be changed in a later patch.

Patch

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1272,5 +1272,5 @@  class revlog(object):
 
         # look up what we need to read
-        text = None
+        rawtext = None
         if rev is None:
             rev = self.rev(node)
@@ -1278,5 +1278,5 @@  class revlog(object):
         chain, stopped = self._deltachain(rev, stoprev=cachedrev)
         if stopped:
-            text = self._cache[2]
+            rawtext = self._cache[2]
 
         # drop cache to save memory
@@ -1284,12 +1284,12 @@  class revlog(object):
 
         bins = self._chunks(chain, df=_df)
-        if text is None:
-            text = bytes(bins[0])
+        if rawtext is None:
+            rawtext = bytes(bins[0])
             bins = bins[1:]
 
-        text = mdiff.patches(text, bins)
+        rawtext = mdiff.patches(rawtext, bins)
 
-        text, validatehash = self._processflags(text, self.flags(rev), 'read',
-                                                raw=raw)
+        text, validatehash = self._processflags(rawtext, self.flags(rev),
+                                                'read', raw=raw)
         if validatehash:
             self.checkhash(text, node, rev=rev)
@@ -1452,23 +1452,22 @@  class revlog(object):
             node = node or self.hash(text, p1, p2)
 
-        newtext, validatehash = self._processflags(text, flags, 'write')
+        rawtext, validatehash = self._processflags(text, flags, 'write')
 
         # If the flag processor modifies the revision data, ignore any provided
         # cachedelta.
-        if newtext != text:
+        if rawtext != text:
             cachedelta = None
-        text = newtext
 
-        if len(text) > _maxentrysize:
+        if len(rawtext) > _maxentrysize:
             raise RevlogError(
                 _("%s: size of %d bytes exceeds maximum revlog storage of 2GiB")
-                % (self.indexfile, len(text)))
+                % (self.indexfile, len(rawtext)))
 
-        node = node or self.hash(text, p1, p2)
+        node = node or self.hash(rawtext, p1, p2)
         if node in self.nodemap:
             return node
 
         if validatehash:
-            self.checkhash(text, node, p1=p1, p2=p2)
+            self.checkhash(rawtext, node, p1=p1, p2=p2)
 
         dfh = None
@@ -1477,5 +1476,5 @@  class revlog(object):
         ifh = self.opener(self.indexfile, "a+", checkambig=self._checkambig)
         try:
-            return self._addrevision(node, text, transaction, link, p1, p2,
+            return self._addrevision(node, rawtext, transaction, link, p1, p2,
                                      flags, cachedelta, ifh, dfh)
         finally: