Patchwork [04,of,10] bundlerepo: drop bundlebase wrapper function for basemap

login
register
mail settings
Submitter Mads Kiilerich
Date Jan. 16, 2013, 7:57 p.m.
Message ID <405be105e67022c56c19.1358366248@mk-desktop>
Download mbox | patch
Permalink /patch/664/
State Accepted
Commit 0ccb16f5956a2f12037da3b70bcf09055d0399ea
Headers show

Comments

Mads Kiilerich - Jan. 16, 2013, 7:57 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1358365301 -3600
# Node ID 405be105e67022c56c19265316612f5784b12d46
# Parent  ebdfe3960b92674623689f198853070ae84a72b6
bundlerepo: drop bundlebase wrapper function for basemap
tonfa - Jan. 16, 2013, 8:18 p.m.
LGTM


On Wed, Jan 16, 2013 at 8:57 PM, Mads Kiilerich <mads@kiilerich.com> wrote:

> # HG changeset patch
> # User Mads Kiilerich <madski@unity3d.com>
> # Date 1358365301 -3600
> # Node ID 405be105e67022c56c19265316612f5784b12d46
> # Parent  ebdfe3960b92674623689f198853070ae84a72b6
> bundlerepo: drop bundlebase wrapper function for basemap
>
> diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
> --- a/mercurial/bundlerepo.py
> +++ b/mercurial/bundlerepo.py
> @@ -75,10 +75,9 @@
>          if rev < 0:
>              return False
>          return rev in self.basemap
> -    def bundlebase(self, rev):
> -        return self.basemap[rev]
> +
>      def _chunk(self, rev):
> -        # Warning: in case of bundle, the diff is against bundlebase,
> +        # Warning: in case of bundle, the diff is against self.basemap,
>          # not against rev - 1
>          # XXX: could use some caching
>          if not self.inbundle(rev):
> @@ -90,14 +89,14 @@
>          """return or calculate a delta between two revisions"""
>          if self.inbundle(rev1) and self.inbundle(rev2):
>              # hot path for bundle
> -            revb = self.rev(self.bundlebase(rev2))
> +            revb = self.rev(self.basemap[rev2])
>              if revb == rev1:
>                  return self._chunk(rev2)
>          elif not self.inbundle(rev1) and not self.inbundle(rev2):
>              return revlog.revlog.revdiff(self, rev1, rev2)
>
>          return mdiff.textdiff(self.revision(self.node(rev1)),
> -                         self.revision(self.node(rev2)))
> +                              self.revision(self.node(rev2)))
>
>      def revision(self, nodeorrev):
>          """return an uncompressed revision of a given node or revision
> @@ -122,7 +121,7 @@
>                  text = self._cache[2]
>                  break
>              chain.append(rev)
> -            iter_node = self.bundlebase(rev)
> +            iter_node = self.basemap[rev]
>              rev = self.rev(iter_node)
>          if text is None:
>              text = revlog.revlog.revision(self, iter_node)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>

Patch

diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -75,10 +75,9 @@ 
         if rev < 0:
             return False
         return rev in self.basemap
-    def bundlebase(self, rev):
-        return self.basemap[rev]
+
     def _chunk(self, rev):
-        # Warning: in case of bundle, the diff is against bundlebase,
+        # Warning: in case of bundle, the diff is against self.basemap,
         # not against rev - 1
         # XXX: could use some caching
         if not self.inbundle(rev):
@@ -90,14 +89,14 @@ 
         """return or calculate a delta between two revisions"""
         if self.inbundle(rev1) and self.inbundle(rev2):
             # hot path for bundle
-            revb = self.rev(self.bundlebase(rev2))
+            revb = self.rev(self.basemap[rev2])
             if revb == rev1:
                 return self._chunk(rev2)
         elif not self.inbundle(rev1) and not self.inbundle(rev2):
             return revlog.revlog.revdiff(self, rev1, rev2)
 
         return mdiff.textdiff(self.revision(self.node(rev1)),
-                         self.revision(self.node(rev2)))
+                              self.revision(self.node(rev2)))
 
     def revision(self, nodeorrev):
         """return an uncompressed revision of a given node or revision
@@ -122,7 +121,7 @@ 
                 text = self._cache[2]
                 break
             chain.append(rev)
-            iter_node = self.bundlebase(rev)
+            iter_node = self.basemap[rev]
             rev = self.rev(iter_node)
         if text is None:
             text = revlog.revlog.revision(self, iter_node)