[PATCH 1 of 4] revlog: generate full revisions when parent node is missing
Benoit Boissinot
benoit.boissinot at ens-lyon.org
Wed Aug 11 09:00:04 CDT 2010
On Tue, Aug 10, 2010 at 06:38:53PM +0530, Vishakh H wrote:
> # HG changeset patch
> # User Vishakh H <vsh426 at gmail.com>
> # Date 1281445634 -19800
> # Node ID 85bb4e5aa6292f74714b613ba17a0dde3d825253
> # Parent 6a5e159eb93ed120407e533bda4eceb0cf7f0435
> revlog: generate full revisions when parent node is missing
>
> The full revision is sent if the first parent, against which diff is calculated, is
> missing at remote. This happens in the case of shallow clones.
>
> diff --git a/mercurial/revlog.py b/mercurial/revlog.py
> --- a/mercurial/revlog.py
> +++ b/mercurial/revlog.py
> @@ -1172,7 +1172,7 @@
> self._cache = (node, curr, text)
> return node
>
> - def group(self, nodelist, lookup, infocollect=None):
> + def group(self, nodelist, lookup, infocollect=None, missingrev=-1):
> """Calculate a delta group, yielding a sequence of changegroup chunks
> (strings).
>
> @@ -1204,7 +1204,7 @@
>
> p = self.parents(nb)
> meta = nb + p[0] + p[1] + lookup(nb)
> - if a == -1:
> + if a == missingrev:
I find the logic here a bit confusing (the original code already is). I
think a full rev can only be inserted as the first diff. Maybe the code
could be restructured to make it clear? What do you think?
Something like:
def group(..., fullrev=False):
....
if parents[0] == nullrev:
fullrev = True
for ...:
if fullrev:
d = self.revision(...)
meta += mdiff.trivialdiffheader(len(d))
fullrev = False
else:
...
> d = self.revision(nb)
> meta += mdiff.trivialdiffheader(len(d))
> else:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
--
:wq
More information about the Mercurial-devel
mailing list