[PATCH 2 of 3] largefiles: enable islfilesrepo() prior to a commit (issue3541)

Na'Tosha Bard natosha at unity3d.com
Thu Aug 9 07:57:09 CDT 2012


2012/8/9 Matt Harbison <matt_harbison at yahoo.com>

> Na'Tosha Bard wrote:
>
>> 2012/8/7 Matt Harbison <matt_harbison at yahoo.com
>> <mailto:matt_harbison at yahoo.**com <matt_harbison at yahoo.com>>>
>>
>>
>>     # HG changeset patch
>>     # User Matt Harbison <matt_harbison at yahoo.com
>>     <mailto:matt_harbison at yahoo.**com <matt_harbison at yahoo.com>>>
>>
>>     # Date 1343696201 14400
>>     # Node ID 40fc3ecfffc7727537a11f5a26064e**97f1dd0e7b
>>     # Parent  542cfb521b1297a887410173f5971a**fc537f2fb3
>>     largefiles: enable islfilesrepo() prior to a commit (issue3541)
>>
>>     -def openlfdirstate(ui, repo):
>>     +def openlfdirstate(ui, repo, create=True):
>>     '''
>>           Return a dirstate object that tracks largefiles: i.e. its root
>> is
>>           the repo root, but it is saved in .hg/largefiles/dirstate.
>>     @@ -154,7 +154,7 @@
>>           # If the largefiles dirstate does not exist, populate and create
>>           # it. This ensures that we create it on the first meaningful
>>           # largefiles operation in a new clone.
>>     -    if not os.path.exists(os.path.join(**admin, 'dirstate')):
>>     +    if create and not os.path.exists(os.path.join(**admin,
>> 'dirstate')):
>>               util.makedirs(admin)
>>               matcher = getstandinmatcher(repo)
>>               for standin in dirstatewalk(repo.dirstate, matcher):
>>     @@ -435,8 +435,11 @@
>>           return util.pconvert(os.path.**normpath(path))
>>
>>       def islfilesrepo(repo):
>>     -    return ('largefiles' in repo.requirements and
>>     -            util.any(shortname + '/' in f[0] for f in
>>     repo.store.datafiles()))
>>     +    if ('largefiles' in repo.requirements and
>>     +            util.any(shortname + '/' in f[0] for f in
>>     repo.store.datafiles())):
>>     +        return True
>>     +
>>     +    return util.any(openlfdirstate(repo.**ui, repo, False))
>>
>>
>> Does this have any effect on performance?
>>
> I didn't run any benchmarks (I'm not sure how to collect numbers or
> structure the tests to avoid caching and the usual benchmarking caveats),
> but I didn't notice any issues with admittedly trivial use.
>
> My thinking was that by passing false here, the dirstate walk and initial
> population of lfdirstate is avoided, even if the file doesn't exist.  All
> openlfdirstate() does in the case is:
>
> 1) join a path
> 2) create an opener instance
> 3) create a largefilesdirstate instance
>
> all of which seem trivial to me.  Any particular cases you're worried
> about?
>

Nevermind, when I pull down the patch and apply it, and am able to see the
diff in context, it seems fine.  I guess it's still possible to be in the
situation of adding a file as a large file, then changing your mind and not
comitting it -- but the file is now a largefiles repo?  Probably we need to
handle that somehow; likely it's related to the other issue we're
discussing about adding --large to init.

Cheers,
N.



-- 
*Na'Tosha Bard*
Software Developer | Unity Technologies - Copenhagen

*E-Mail:* natosha at unity3d.com
*Skype:* natosha.bard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20120809/e6ff8aa0/attachment.html>


More information about the Mercurial-devel mailing list