[PATCH] largefiles: makes verify to work on local content by default (issue4242) (BC)
Piotr Listkiewicz
piotr.listkiewicz at gmail.com
Tue Mar 8 17:46:27 EST 2016
>
> 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/20160308/86e3c2fb/attachment.html>
More information about the Mercurial-devel
mailing list