On Jan 18, 2009, at 6:13 PM, TK Soh wrote:

> On Sun, Jan 18, 2009 at 3:23 PM, Craig Berry <[email protected]>  
> wrote:
>> After installing TortoiseHg awhile back, I noticed that attempting  
>> to open certain network folders resulted in a hang in explorer and  
>> I would have to kill it with Task Manager.
>
> Thanks for looking into this.

Thanks for the reply.

>>   The hang can be further narrowed to the call to os.path.isdir  
>> with the following test program:
>>
>> ---- begin check_isdir.py -----
>> import os.path
>> import sys
>>
>> hgpath = os.path.join(sys.argv[1], ".hg")
>> print "Checking whether '" + hgpath + "' is a directory."
>> if os.path.isdir(hgpath):
>>   print "Yes, it is"
>> ----- end check_isdir.py -----
>>
>>
>> C:\work>python check_isdir.py \\mynode
>> Checking whether '\\mynode\.hg' is a directory.
>
> Does  '\\mynode\.hg' exist?

No, not as far as I know, but of course part of the point is that I  
don't have read access there to see.  Changing the filename from .hg  
to any arbitrary string makes no difference.

> Also, does it hang if you call
> os.path.isdir("\\mynode")?

os.path.isdir("\\mynode") returns false immediately regardless of  
whether it's a node where I have permissions to see what shares are  
available.

>> and here we hang again.  So, to summarize, calling os.path.isdir("\ 
>> \mynode\.hg") when I do not have read access to the root of \ 
>> \mynode causes a hang.  This may well be a Python bug as it's  
>> actually getting hung in os.stat, which is called by os.path.isdir.
>>
>
> Hopefully not, else it will be hard to fix.


Hmm, can you have an entire SMB share as a Mercurial repository?  If  
not, it may be possible to get the results of os.path.splitunc and  
compare the volume component to where you are as you iterate through  
the components of the path and just bail out before looking for a .hg  
file at the top of the volume.  Or, potentially, you could check read  
access before checking for .hg at the top of a volume.

Sorry not to have a patch.  I know nothing about Python (never looked  
at it before today), and a number of attempts to clone the source from  
bitbucket.org timed out before returning anything.
________________________________________
Craig A. Berry
mailto:[email protected]

"... getting out of a sonnet is much more
  difficult than getting in."
                  Brad Leithauser


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Tortoisehg-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to