Patchwork [7,of,8] _builddeltainfo: rename 'rev' to 'base', as it is the base revision

login
register
mail settings
Submitter Paul Morelle
Date Jan. 14, 2018, 10:28 a.m.
Message ID <9f916b7bc16409831776.1515925703@taranis.localdomain>
Download mbox | patch
Permalink /patch/26729/
State Accepted
Headers show

Comments

Paul Morelle - Jan. 14, 2018, 10:28 a.m.
# HG changeset patch
# User Paul Morelle <paul.morelle@octobus.net>
# Date 1515918647 -3600
#      Sun Jan 14 09:30:47 2018 +0100
# Node ID 9f916b7bc16409831776b50d6f400a41fdfbbcb7
# Parent  d321149c4918b0c008fc38f318c4759c7c29ba80
# EXP-Topic refactor-revlog
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 9f916b7bc164
_builddeltainfo: rename 'rev' to 'base', as it is the base revision
Gregory Szorc - Jan. 14, 2018, 9:03 p.m.
On Sun, Jan 14, 2018 at 2:28 AM, Paul Morelle <paul.morelle@octobus.net>
wrote:

> # HG changeset patch
> # User Paul Morelle <paul.morelle@octobus.net>
> # Date 1515918647 -3600
> #      Sun Jan 14 09:30:47 2018 +0100
> # Node ID 9f916b7bc16409831776b50d6f400a41fdfbbcb7
> # Parent  d321149c4918b0c008fc38f318c4759c7c29ba80
> # EXP-Topic refactor-revlog
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r
> 9f916b7bc164
> _builddeltainfo: rename 'rev' to 'base', as it is the base revision
>

Nit: "revlog:"

Also, this commit should ideally have been split into two to make review
easier since there was an existing "base" variable that was also renamed.


>
> diff -r d321149c4918 -r 9f916b7bc164 mercurial/revlog.py
> --- a/mercurial/revlog.py       Sat Jan 13 12:55:18 2018 +0100
> +++ b/mercurial/revlog.py       Sun Jan 14 09:30:47 2018 +0100
> @@ -1948,26 +1948,26 @@
>
>          return delta
>
> -    def _builddeltainfo(self, node, rev, p1, p2, btext, cachedelta, fh,
> flags):
> +    def _builddeltainfo(self, node, base, p1, p2, btext, cachedelta, fh,
> flags):
>          # can we use the cached delta?
> -        if cachedelta and cachedelta[0] == rev:
> +        if cachedelta and cachedelta[0] == base:
>              delta = cachedelta[1]
>          else:
> -            delta = self._builddeltadiff(rev, node, p1, p2, btext,
> cachedelta,
> +            delta = self._builddeltadiff(base, node, p1, p2, btext,
> cachedelta,
>                                           fh, flags)
>          header, data = self.compress(delta)
>          deltalen = len(header) + len(data)
> -        chainbase = self.chainbase(rev)
> +        chainbase = self.chainbase(base)
>          offset = self.end(len(self) - 1)
>          dist = deltalen + offset - self.start(chainbase)
>          if self._generaldelta:
> -            base = rev
> +            deltabase = base
>          else:
> -            base = chainbase
> -        chainlen, compresseddeltalen = self._chaininfo(rev)
> +            deltabase = chainbase
> +        chainlen, compresseddeltalen = self._chaininfo(base)
>          chainlen += 1
>          compresseddeltalen += deltalen
> -        return _deltainfo(dist, deltalen, (header, data), base,
> +        return _deltainfo(dist, deltalen, (header, data), deltabase,
>                           chainbase, chainlen, compresseddeltalen)
>
>      def _addrevision(self, node, rawtext, transaction, link, p1, p2,
> flags,
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

Patch

diff -r d321149c4918 -r 9f916b7bc164 mercurial/revlog.py
--- a/mercurial/revlog.py	Sat Jan 13 12:55:18 2018 +0100
+++ b/mercurial/revlog.py	Sun Jan 14 09:30:47 2018 +0100
@@ -1948,26 +1948,26 @@ 
 
         return delta
 
-    def _builddeltainfo(self, node, rev, p1, p2, btext, cachedelta, fh, flags):
+    def _builddeltainfo(self, node, base, p1, p2, btext, cachedelta, fh, flags):
         # can we use the cached delta?
-        if cachedelta and cachedelta[0] == rev:
+        if cachedelta and cachedelta[0] == base:
             delta = cachedelta[1]
         else:
-            delta = self._builddeltadiff(rev, node, p1, p2, btext, cachedelta,
+            delta = self._builddeltadiff(base, node, p1, p2, btext, cachedelta,
                                          fh, flags)
         header, data = self.compress(delta)
         deltalen = len(header) + len(data)
-        chainbase = self.chainbase(rev)
+        chainbase = self.chainbase(base)
         offset = self.end(len(self) - 1)
         dist = deltalen + offset - self.start(chainbase)
         if self._generaldelta:
-            base = rev
+            deltabase = base
         else:
-            base = chainbase
-        chainlen, compresseddeltalen = self._chaininfo(rev)
+            deltabase = chainbase
+        chainlen, compresseddeltalen = self._chaininfo(base)
         chainlen += 1
         compresseddeltalen += deltalen
-        return _deltainfo(dist, deltalen, (header, data), base,
+        return _deltainfo(dist, deltalen, (header, data), deltabase,
                          chainbase, chainlen, compresseddeltalen)
 
     def _addrevision(self, node, rawtext, transaction, link, p1, p2, flags,