[PATCH] largefiles: makes verify to work on local content by default (issue4242) (BC)

Piotr Listkiewicz piotr.listkiewicz at gmail.com
Fri Mar 11 07:56:56 EST 2016


>
> Hmm it looks for me like this is the other bug in largefile, this would
> mean that so far --lfc for remote repos didnt verify file contents but only
> existence.
> After applying this patch --lfc will use localstore.localstore which
> verifies contents correctly (not just existence) but for remote repos it
> will preserve current( for me it looks like bad) behaviour.



I checked this once again and I was totally wrong about remotestore and
"--lfc" and "--lfc --remote", Im sorry for that.

First of all i made mistake of not changing help, for verify --lfc should
be:
"verify largefile contents, not just existence" , without remote it will
check locally , with --remote it will check on remote server.

After this patch 'hg verify --lfc' (without --remote) will be using
localstore class (with self.remote object pointing to the same local
repository as self.repo). This means that all checking will be done locally
and checking file content will be working correctly(--large and --lfa also
works only locally by default).

As far as we concern local operations, everything is fine. Problem starts
with --remote - that is the old implementation of largefiles verify. I have
no idea how but it uses remotestore/wirestore object and connect to the
other server with them but still verifies things locally.
I have no idea how its working, maybe anybody have any suggestion?

And the other thing, i would like to be able to debug what actions are
taken in remote store when largefiles tries to verify things remotelly, but
i dont know where is the place where 'hg serve' is making action on
repository according to the request, its probably somewhere
in mercurial/hgweb/server._httprequesthandler.do_hgweb (
https://selenic.com/hg/file/tip/mercurial/hgweb/server.py#l109) probably in
line:

for chunk in self.server.application(env, self._start_response):

but i dont know where its jumping next, i tried to debug it but without
result for now.

2016-03-08 23:46 GMT+01:00 Piotr Listkiewicz <piotr.listkiewicz at gmail.com>:

> Is there a difference between "--lfc" and "--lfc --remote" ?
>> It seems a remotestore ignores the contents flag.
>
>
> https://selenic.com/repo/hg/file/tip/hgext/largefiles/remotestore.py#l67
>
> Hmm it looks for me like this is the other bug in largefile, this would
> mean that so far --lfc for remote repos didnt verify file contents but only
> existence.
>
> After applying this patch --lfc will use localstore.localstore which
> verifies contents correctly (not just existence) but for remote repos it
> will preserve current( for me it looks like bad) behaviour.
>
> 2016-03-05 11:23 GMT+01:00 Yuya Nishihara <yuya at tcha.org>:
>
>> On Wed, 02 Mar 2016 14:05:13 +0100, liscju wrote:
>> > # HG changeset patch
>> > # User liscju <piotr.listkiewicz at gmail.com>
>> > # Date 1456917749 -3600
>> > #      Wed Mar 02 12:22:29 2016 +0100
>> > # Node ID 184b0386fad4aff1ec64f0076c74c13e2cf5d036
>> > # Parent  c7f89ad87baef87f00c507545dfd4cc824bc3131
>> > largefiles: makes verify to work on local content by default
>> (issue4242) (BC)
>> >
>> > Before this patch largefiles verify options always tried to do
>> > verification on remote store by default. This patch makes verification
>> > always done locally unless user specify --remote option.
>> >
>> > Implementation of checking locally was implemented before this
>> > patch in basestore._openstore as special case when ui.expandpath
>> > had problem with expanding lfpullsource or default. This patch adds
>> > forcelocal parameter to basestore._openstore function making it
>> > (when set) returns localstore class with remote assigned to
>> > local repository.
>> >
>> > diff -r c7f89ad87bae -r 184b0386fad4 hgext/largefiles/basestore.py
>> > --- a/hgext/largefiles/basestore.py   Mon Feb 29 17:52:17 2016 -0600
>> > +++ b/hgext/largefiles/basestore.py   Wed Mar 02 12:22:29 2016 +0100
>> > @@ -174,27 +174,31 @@ import localstore, wirestore
>> >  # During clone this function is passed the src's ui object
>> >  # but it needs the dest's ui object so it can read out of
>> >  # the config file. Use repo.ui instead.
>> > -def _openstore(repo, remote=None, put=False):
>> > +def _openstore(repo, remote=None, put=False, forcelocal=False):
>> >      ui = repo.ui
>> >
>> >      if not remote:
>> > -        lfpullsource = getattr(repo, 'lfpullsource', None)
>> > -        if lfpullsource:
>> > -            path = ui.expandpath(lfpullsource)
>> > -        elif put:
>> > -            path = ui.expandpath('default-push', 'default')
>> > -        else:
>> > -            path = ui.expandpath('default')
>> > -
>> > -        # ui.expandpath() leaves 'default-push' and 'default' alone if
>> > -        # they cannot be expanded: fallback to the empty string,
>> > -        # meaning the current directory.
>> > -        if path == 'default-push' or path == 'default':
>> > +        if forcelocal:
>> >              path = ''
>> >              remote = repo
>>
>> I expect _openrepo(repo, remote=something, forcelocal=True) would return a
>> local store or raise exception.
>>
>> > +def verifylfiles(ui, repo, all=False, contents=False,
>> forcelocal=False):
>> >      '''Verify that every largefile revision in the current changeset
>> >      exists in the central store.  With --contents, also verify that
>> >      the contents of each local largefile file revision are correct
>> (SHA-1 hash
>> > @@ -368,7 +368,7 @@ def verifylfiles(ui, repo, all=False, co
>> >      else:
>> >          revs = ['.']
>> >
>> > -    store = basestore._openstore(repo)
>> > +    store = basestore._openstore(repo, forcelocal=forcelocal)
>> >      return store.verify(revs, contents=contents)
>> >
>> >  def cachelfiles(ui, repo, node, filelist=None):
>> > diff -r c7f89ad87bae -r 184b0386fad4 hgext/largefiles/overrides.py
>> > --- a/hgext/largefiles/overrides.py   Mon Feb 29 17:52:17 2016 -0600
>> > +++ b/hgext/largefiles/overrides.py   Wed Mar 02 12:22:29 2016 +0100
>> > @@ -395,10 +395,12 @@ def overrideverify(orig, ui, repo, *pats
>> >      large = opts.pop('large', False)
>> >      all = opts.pop('lfa', False)
>> >      contents = opts.pop('lfc', False)
>> > +    forcelocal = not opts.pop('remote', False)
>> >
>> >      result = orig(ui, repo, *pats, **opts)
>> >      if large or all or contents:
>> > -        result = result or lfcommands.verifylfiles(ui, repo, all,
>> contents)
>> > +        result = result or \
>> > +                 lfcommands.verifylfiles(ui, repo, all, contents,
>> forcelocal)
>>
>> Is there a difference between "--lfc" and "--lfc --remote" ?
>> It seems a remotestore ignores the contents flag.
>>
>> https://selenic.com/repo/hg/file/tip/hgext/largefiles/remotestore.py#l67
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20160311/458f0e21/attachment.html>


More information about the Mercurial-devel mailing list