[PATCH 08 of 14] changelog: add support for shallowroot
Peter Arrenbrecht
peter.arrenbrecht at gmail.com
Fri Jul 30 01:36:17 CDT 2010
On Fri, Jul 16, 2010 at 9:15 AM, Vishakh H <vsh426 at gmail.com> wrote:
> # HG changeset patch
> # User Vishakh H <vsh426 at gmail.com>
> # Date 1279263210 -19800
> # Node ID 0218b69c65e2014af11f287cac005ffd206d45c5
> # Parent 8a0c8d3600e2cbd14e2ddf5353ca58b038187be0
> changelog: add support for shallowroot
>
> cleate list of shallownodes and check if manifest node requested is available
> else return null manifest id.
>
> diff --git a/mercurial/changelog.py b/mercurial/changelog.py
> --- a/mercurial/changelog.py
> +++ b/mercurial/changelog.py
> @@ -98,11 +98,16 @@
> return o
>
> class changelog(revlog.revlog):
> - def __init__(self, opener):
> - revlog.revlog.__init__(self, opener, "00changelog.i")
> + def __init__(self, opener, shallowroot):
> + revlog.revlog.__init__(self, opener, "00changelog.i",
> + shallow=shallowroot)
Inconsistent names strike again.
> self._realopener = opener
> self._delayed = False
> self._divert = False
> + if self._shallow and shallowroot in self.nodemap:
> + self._shallownodes.add(shallowroot)
> + self._shallownodes.update(map(self.node,
> + self.descendants(self.rev(self._shallowroot))))
You create _shallownodes in revlog, but only every access it in changelog. Why?
Also, you initialize this set, but never update it (during a pull, for
example). Is this correct? I could imagine that if someone uses the
API to pull and then accesses a manifest, it would return nullid.
> def delayupdate(self):
> "delay visibility of index updates to other readers"
> @@ -176,7 +181,10 @@
> last = text.index("\n\n")
> desc = encoding.tolocal(text[last + 2:])
> l = text[:last].split('\n')
> - manifest = bin(l[0])
> + if self._shallow and node not in self._shallownodes:
> + manifest = nullid
> + else:
> + manifest = bin(l[0])
> user = encoding.tolocal(l[1])
>
> extra_data = l[2].split(' ', 2)
-parren
More information about the Mercurial-devel
mailing list